Skip to content

Commit

Permalink
Merge pull request #114 from boostcampwm2023/fix/112-entity-uuid-uniq…
Browse files Browse the repository at this point in the history
…ue-handling

[Fix] entity에서 uuid에 대해 unique 설정
  • Loading branch information
mingxoxo authored Nov 23, 2023
2 parents 0d824a0 + 7060096 commit add09ad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions BE/src/diaries/diaries.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import {
Generated,
ManyToMany,
JoinTable,
Unique,
} from "typeorm";
import { User } from "src/users/users.entity";
import { Shape } from "src/shapes/shapes.entity";
import { sentimentStatus } from "src/utils/enum";
import { Tag } from "src/tags/tags.entity";

@Entity()
@Unique(["uuid"])
export class Diary extends BaseEntity {
@PrimaryGeneratedColumn()
id: number;
Expand Down
2 changes: 2 additions & 0 deletions BE/src/shapes/shapes.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import {
ManyToOne,
Generated,
OneToMany,
Unique,
} from "typeorm";
import { User } from "src/users/users.entity";
import { Diary } from "src/diaries/diaries.entity";

@Entity()
@Unique(["uuid"])
export class Shape extends BaseEntity {
@PrimaryGeneratedColumn()
id: number;
Expand Down
6 changes: 4 additions & 2 deletions BE/src/users/users.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@ import {
DeleteDateColumn,
BaseEntity,
OneToMany,
Unique,
} from "typeorm";
import { premiumStatus } from "src/utils/enum";
import { Diary } from "../diaries/diaries.entity";
import { Shape } from "src/shapes/shapes.entity";

@Entity()
@Unique(["userId", "email"])
export class User extends BaseEntity {
@PrimaryGeneratedColumn()
id: number;

@Column({ length: 20, unique: true })
@Column({ length: 20 })
userId: string;

@Column({ unique: true })
@Column()
email: string;

@Column({ length: 60 })
Expand Down

0 comments on commit add09ad

Please sign in to comment.