Skip to content

Commit

Permalink
Refactor : 엔티티 및 테이블명 reportee, reporter로 구분
Browse files Browse the repository at this point in the history
  • Loading branch information
kkkapuq committed May 2, 2024
1 parent 6147c27 commit e1840fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@ public class Report extends AuditingField {
private Long targetId;

@ManyToOne(optional = false)
@JoinColumn(name = "user_id", nullable = false)
private User user;
@JoinColumn(name = "reportee_id", nullable = false)
private User reporteeUser;

@ManyToOne(optional = false)
@JoinColumn(name = "reporter_id", nullable = false)
private User reportUser;
private User reporterUser;

private Report(
Long id,
int type,
int reason,
String description,
Long targetId,
User user,
User reportUser
User reporteeUser,
User reporterUser
) {
this.id = id;
this.type = type;
this.reason = reason;
this.description = description;
this.targetId = targetId;
this.user = user;
this.reportUser = reportUser;
this.reporteeUser = reporteeUser;
this.reporterUser = reporterUser;
}

public static Report of(
Expand All @@ -61,17 +61,17 @@ public static Report of(
int reasonCode,
String description,
Long targetId,
User user,
User reportUser
User reporteeUser,
User reporterUser
) {
return new Report(
id,
type,
reasonCode,
description,
targetId,
user,
reportUser
reporteeUser,
reporterUser
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CREATE TABLE `report`
`type` int NOT NULL COMMENT '신고 유형, 1: 게시글 2: 댓글',
`reason` int NOT NULL COMMENT '신고 사유 코드',
`description` varchar(100) NULL COMMENT '신고 사유',
`user_id` bigint(32) NOT NULL COMMENT '신고 대상 유저 id',
`reportee_id` bigint(32) NOT NULL COMMENT '신고 대상 유저 id',
`reporter_id` bigint(32) NOT NULL COMMENT '신고자 id',
`target_id` bigint NOT NULL COMMENT '신고 대상 id',
`created_at` DATETIME NOT NULL COMMENT '@CreatedDate',
Expand All @@ -13,7 +13,7 @@ CREATE TABLE `report`
);

ALTER TABLE `report`
ADD CONSTRAINT `FK_user_id_TO_report` FOREIGN KEY (`user_id`)
ADD CONSTRAINT `FK_reportee_id_TO_report` FOREIGN KEY (`reportee_id`)
REFERENCES `user` (`id`),
ADD CONSTRAINT `FK_reporter_id_TO_report` FOREIGN KEY (`reporter_id`)
REFERENCES `user` (`id`);

0 comments on commit e1840fd

Please sign in to comment.