Skip to content

Commit

Permalink
DPP-1 test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Brummos committed Sep 12, 2023
1 parent dd09f38 commit 7ed1d99
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/data-store/src/entities/contact/BaseContactEntity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { BaseEntity, CreateDateColumn, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn, TableInheritance, UpdateDateColumn } from 'typeorm'
import { BaseEntity,
BeforeInsert,
BeforeUpdate, CreateDateColumn, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn, TableInheritance, UpdateDateColumn } from 'typeorm'
import { PartyEntity } from './PartyEntity'

@Entity('BaseContact')
Expand All @@ -18,4 +20,11 @@ export abstract class BaseContactEntity extends BaseEntity {
})
@JoinColumn({ name: 'party_id' })
party!: PartyEntity

// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
@BeforeInsert()
@BeforeUpdate()
updateUpdatedDate(): void {
this.lastUpdatedAt = new Date()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ export class ElectronicAddressEntity extends BaseEntity {
@UpdateDateColumn({ name: 'last_updated_at', nullable: false })
lastUpdatedAt!: Date

// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
@BeforeInsert()
@BeforeUpdate()
updateUpdatedDate(): void {
this.lastUpdatedAt = new Date()
}

@BeforeInsert()
@BeforeUpdate()
async validate(): Promise<void> {
Expand Down
7 changes: 7 additions & 0 deletions packages/data-store/src/entities/contact/IdentityEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ export class IdentityEntity extends BaseEntity {
@Column({ name: 'partyId', nullable: true })
partyId!: string

// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
@BeforeInsert()
@BeforeUpdate()
updateUpdatedDate(): void {
this.lastUpdatedAt = new Date()
}

@BeforeInsert()
@BeforeUpdate()
async validate(): Promise<void> {
Expand Down
7 changes: 7 additions & 0 deletions packages/data-store/src/entities/contact/PartyEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ export class PartyEntity extends BaseEntity {
@UpdateDateColumn({ name: 'last_updated_at', nullable: false })
lastUpdatedAt!: Date

// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
@BeforeInsert()
@BeforeUpdate()
updateUpdatedDate(): void {
this.lastUpdatedAt = new Date()
}

@BeforeInsert()
@BeforeUpdate()
async checkUniqueTenantId(): Promise<undefined> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ export class PartyRelationshipEntity {
@UpdateDateColumn({ name: 'last_updated_at', nullable: false })
lastUpdatedAt!: Date

// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
@BeforeInsert()
@BeforeUpdate()
updateUpdatedDate(): void {
this.lastUpdatedAt = new Date()
}

@BeforeInsert()
@BeforeUpdate()
async checkRelationshipSides(): Promise<void> {
Expand Down
7 changes: 7 additions & 0 deletions packages/data-store/src/entities/contact/PartyTypeEntity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ export class PartyTypeEntity {
@UpdateDateColumn({ name: 'last_updated_at', nullable: false })
lastUpdatedAt!: Date

// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
@BeforeInsert()
@BeforeUpdate()
updateUpdatedDate(): void {
this.lastUpdatedAt = new Date()
}

@BeforeInsert()
@BeforeUpdate()
async validate(): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ export class BaseLocaleBrandingEntity extends BaseEntity {
@UpdateDateColumn({ name: 'last_updated_at', nullable: false })
lastUpdatedAt!: Date

// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
@BeforeInsert()
@BeforeUpdate()
updateUpdatedDate(): void {
this.lastUpdatedAt = new Date()
}

@BeforeInsert()
@BeforeUpdate()
async validate(): Promise<undefined> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ export class CredentialBrandingEntity extends BaseEntity {
@UpdateDateColumn({ name: 'last_updated_at', nullable: false })
lastUpdatedAt!: Date

// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
@BeforeInsert()
@BeforeUpdate()
updateUpdatedDate(): void {
this.lastUpdatedAt = new Date()
}

@BeforeInsert()
@BeforeUpdate()
async validate(): Promise<undefined> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ export class IssuerBrandingEntity extends BaseEntity {
@UpdateDateColumn({ name: 'last_updated_at', nullable: false })
lastUpdatedAt!: Date

// By default, @UpdateDateColumn in TypeORM updates the timestamp only when the entity's top-level properties change.
@BeforeInsert()
@BeforeUpdate()
updateUpdatedDate(): void {
this.lastUpdatedAt = new Date()
}

@BeforeInsert()
@BeforeUpdate()
async validate(): Promise<undefined> {
Expand Down

0 comments on commit 7ed1d99

Please sign in to comment.