Skip to content

Commit

Permalink
fix: duplicate fk constraint (see notes)
Browse files Browse the repository at this point in the history
  • Loading branch information
hilyafadhilah committed Jul 14, 2022
1 parent 0e6d8a9 commit 87c0e8f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/controllers/user-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class UserController {
customer = {
...data,
user,
id: user.id,
userId: user.id,
idCardImage: uploadedFile.name,
balance: 0,
};
Expand Down
4 changes: 2 additions & 2 deletions src/entities/customer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class Customer {
@PrimaryColumn()
@IsInt()
@IsPositive()
id!: number;
userId!: number;

@Column()
@IsNotEmpty({
Expand Down Expand Up @@ -47,7 +47,7 @@ export class Customer {
balance!: number;

@OneToOne(() => User, { cascade: true })
@JoinColumn({ name: 'id' })
@JoinColumn({ name: 'userId' })
@Type(() => User)
@IsObject({
groups: ['register'],
Expand Down

0 comments on commit 87c0e8f

Please sign in to comment.