Skip to content

Commit

Permalink
refactor : entity 테이블 구조 수정. #35
Browse files Browse the repository at this point in the history
-  TypeORM의 @manytoone 데코레이터와 @PrimaryColumn 데코레이터를 같이 사용했을 때 발생하는 네이밍 관련 이슈 해결
  • Loading branch information
GeunH committed Nov 23, 2023
1 parent bc192a7 commit 419fa27
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions be/src/user/entities/user.followList.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ import { User } from "./user.entity";
@Entity("follow")
export class FollowEntity {
@ManyToOne(() => User)
@JoinColumn({ name: "following_user_id" })
followingUser: User;

@PrimaryColumn({ name: "following_user_id" })
followingUserId: number;

@ManyToOne(() => User)
@JoinColumn({ name: "followed_user_id" })
followedUser: User;

@PrimaryColumn({ name: "followed_user_id" })
followedUserId: number;

Expand Down
6 changes: 6 additions & 0 deletions be/src/user/entities/user.restaurantlist.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ import { ReviewInfoEntity } from "src/review/entities/review.entity";
@Entity("user_restaurant_lists")
export class UserRestaurantListEntity {
@ManyToOne(() => User)
@JoinColumn({ name: "user_id" })
user: User;

@PrimaryColumn({ name: "user_id" })
userId: number;

@ManyToOne(() => RestaurantInfoEntity)
@JoinColumn({ name: "restaurant_id" })
restaurant: RestaurantInfoEntity;

@PrimaryColumn({ name: "restaurant_id" })
restaurantId: number;

Expand Down

0 comments on commit 419fa27

Please sign in to comment.