Skip to content

Commit

Permalink
#87 fix: 모든 엔티티 대체키 반영
Browse files Browse the repository at this point in the history
기존 id -> token으로 변경
id -> Long 타입
token -> String 타입
  • Loading branch information
rivkode committed Jun 10, 2024
1 parent 2f68349 commit 6db3df7
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
public class PostLike extends BaseTime {
@Id
@Column(name = "post_like_id")
private String id;
private Long id;

@Column(name = "post_like_token")
private String postLikeToken;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
Expand All @@ -32,8 +35,9 @@ public class PostLike extends BaseTime {
private LikeStatus likeStatus = LikeStatus.LIKE;

@Builder
public PostLike(String id, User user, Post post) {
public PostLike(Long id, String postLikeToken, User user, Post post) {
this.id = id;
this.postLikeToken = postLikeToken;
this.user = user;
this.post = post;
post.getLikes().add(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@
public class Project extends BaseTime {
@Id
@Column(name = "project_id")
private String id;
private Long id;

// @Id
// @Column(name = "project_sequence")
// @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long seq;
@Column(name = "project_token")
private String projectToken;

@Embedded
private ProjectName name;
Expand Down Expand Up @@ -88,9 +86,10 @@ public class Project extends BaseTime {
private List<Schedule> schedules = new ArrayList<>();

@Builder
public Project(String id, String name, String content, ProjectField field, Point location, LocalDateTime startAt,
public Project(Long id, String projectToken, String name, String content, ProjectField field, Point location, LocalDateTime startAt,
LocalDateTime endAt, String leaderId) {
this.id = id;
this.projectToken = projectToken;
this.name = new ProjectName(name);
this.content = new ProjectContent(content);
this.field = field;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
public class ProjectLike extends BaseTime {
@Id
@Column(name = "project_like_id")
private String id;
private Long id;

@Column(name = "project_like_token")
private String projectLikeToken;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
Expand All @@ -35,8 +38,9 @@ public class ProjectLike extends BaseTime {


@Builder
public ProjectLike(String id, User user, Project project) {
public ProjectLike(Long id, String projectLikeToken, User user, Project project) {
this.id = id;
this.projectLikeToken = projectLikeToken;
this.user = user;
this.project = project;
project.getLikes().add(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
public class ProjectUser extends BaseTime {
@Id
@Column(name = "project_user_id")
private String id;
private Long id;

@Column(name = "project_user_token")
private String projectUserToken;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "project_id")
Expand All @@ -27,8 +30,9 @@ public class ProjectUser extends BaseTime {
private User user;

@Builder
public ProjectUser(String id, Project project, User user) {
public ProjectUser(Long id, String projectUserToken, Project project, User user) {
this.id = id;
this.projectUserToken = projectUserToken;
this.project = project;
this.user = user;
}
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/seoultech/synergybe/domain/rate/Rate.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
public class Rate extends BaseTime {
@Id
@Column(name = "rate_id")
private String id;
private Long id;

@Column(name = "rate_token")
private String rateToken;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "project_id")
Expand All @@ -49,8 +52,9 @@ public class Rate extends BaseTime {
private RateContent content;

@Builder
public Rate(String id, Project project, User giveUser, User receiveUser, int score, String content) {
public Rate(Long id, String rateToken, Project project, User giveUser, User receiveUser, int score, String content) {
this.id = id;
this.rateToken = rateToken;
this.project = project;
this.giveUser = giveUser;
this.receiveUser = receiveUser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
public class Schedule extends BaseTime {
@Id
@Column(name = "schedule_id")
private String id;
private Long id;

@Column(name = "schedule_token")
private String scheduleToken;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "project_id")
Expand All @@ -48,8 +51,9 @@ public class Schedule extends BaseTime {
private SchedulePeriod period;

@Builder
public Schedule(String id, Project project, String title, String content, String label, LocalDateTime startAt, LocalDateTime endAt) {
public Schedule(Long id, String scheduleToken, Project project, String title, String content, String label, LocalDateTime startAt, LocalDateTime endAt) {
this.id = id;
this.scheduleToken = scheduleToken;
this.title = new ScheduleTitle(title);
this.content = new ScheduleContent(content);
this.label = label;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
public class Ticket extends BaseTime {
@Id
@Column(name = "ticket_id")
private String id;
private Long id;

@Column(name = "ticket_token")
private String ticketToken;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "project_id")
Expand Down Expand Up @@ -60,9 +63,10 @@ public class Ticket extends BaseTime {
private IsDeleted isDeleted = new IsDeleted(IS_DELETED_DEFAULT);

@Builder
public Ticket(String id, String name, String content, Integer orderNumber, String tag, Project project,
public Ticket(Long id, String ticketToken, String name, String content, Integer orderNumber, String tag, Project project,
String tagColor) {
this.id = id;
this.ticketToken = ticketToken;
this.name = new TicketName(name);
this.content = new TicketContent(content);
this.information = new TicketTagInformation(tag, tagColor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
public class TicketUser extends BaseTime {
@Id
@Column(name = "ticket_user_id")
private String id;
private Long id;

@Column(name = "ticket_user_token")
private String ticketUserToken;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ticket_id")
Expand All @@ -26,8 +29,9 @@ public class TicketUser extends BaseTime {
private User user;

@Builder
public TicketUser(String id, Ticket ticket, User user) {
public TicketUser(Long id, String ticketUserToken, Ticket ticket, User user) {
this.id = id;
this.ticketUserToken = ticketUserToken;
this.ticket = ticket;
this.user = user;
}
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/com/seoultech/synergybe/domain/user/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ public class User extends BaseTime {

@Id
@Column(name = "user_id")
private String id;
private Long id;

@Column(name = "user_token")
private String userToken;

@Embedded
private UserEmail email;
Expand All @@ -35,14 +38,16 @@ public class User extends BaseTime {

@Builder
public User(
String id,
Long id,
String userToken,
String email,
String password,
String name,
CustomPasswordEncoder passwordEncoder,
String major
) {
this.id = id;
this.userToken = userToken;
this.email = new UserEmail(email);
this.password = new UserPassword(password, passwordEncoder);
this.name = new UserName(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ public class UserRefreshToken {
private Long id;

@Column(name = "user_id")
private String userId;
private Long userId;


@Embedded
private RefreshToken refreshToken;

public UserRefreshToken(
String userId
Long userId
) {
this.userId = userId;
this.refreshToken = new RefreshToken();
Expand Down

0 comments on commit 6db3df7

Please sign in to comment.