Skip to content

Commit

Permalink
Fix(#18): 병합 오류 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
KIMSEI1124 committed Sep 15, 2024
2 parents 6bb8115 + d4be0c5 commit 2283777
Show file tree
Hide file tree
Showing 27 changed files with 473 additions and 30 deletions.
18 changes: 18 additions & 0 deletions common/src/main/java/com/wypl/common/Color.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.wypl.common;

public enum Color {
labelRed,
labelPink,
labelOrange,
labelYellow,
labelGreen,
labelLeaf,
labelBlue,
labelSky,
labelNavy,
labelIndigo,
labelPurple,
labelLavender,
labelCharcoal,
labelBrown
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.wypl.common.exception;

public enum GlobalErrorCode implements ServerErrorCode {
INTERNAL_SERVER_ERROR(500, "GLOBAL_001", "알수 없는 서버의 오류입니다."),
INTERNAL_SERVER_ERROR(500, "GLOBAL_001", "알 수 없는 서버의 오류입니다."),
;

private final int statusCode;
Expand Down
1 change: 1 addition & 0 deletions domain/jpa-calendar-domain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ java {
}

dependencies {
implementation project(':common')
implementation project(':domain:jpa-common')
implementation project(':domain:jpa-member-domain')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.wypl.jpacalendardomain.calendar.data;

public enum InviteStatus {
PENDING,
ACCENTED
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.wypl.jpacalendardomain.calendar.domain;

import org.hibernate.annotations.SQLRestriction;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Builder
@Getter
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SQLRestriction("deleted_at is null")
@Entity
@Table(name = "calendar")
public class Calendar {
// Todo : extends BaseEntity
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "calendar_id")
private Long calendarId;

@Column(name = "name", length = 20, nullable = false)
private String name;

@Column(name = "description", length = 50)
private String description;

@Column(name = "owner_id")
private Long ownerId;

// Todo : boolean type 설정
// private Boolean isShared;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.wypl.jpacalendardomain.calendar.domain;

import org.hibernate.annotations.SQLRestriction;

import com.wypl.common.Color;
import com.wypl.jpacalendardomain.calendar.data.InviteStatus;
import com.wypl.jpamemberdomain.member.Member;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Builder
@Getter
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SQLRestriction("deleted_at is null")
@Entity
@IdClass(MemberCalendarId.class)
@Table(name = "member_calendar")
public class MemberCalendar {
// Todo : extends BaseEntity

@Id
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "member_id")
private Member member;

@Id
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "calendar_id")
private Calendar calendar;

@Column(name = "color", length = 6)
private Color color;

@Enumerated(EnumType.STRING)
@Column(name = "status", length = 10, nullable = false)
private InviteStatus status;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.wypl.jpacalendardomain.calendar.domain;

import java.io.Serializable;

import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = AccessLevel.PROTECTED)
@EqualsAndHashCode
public class MemberCalendarId implements Serializable {
private Long member;
private Long calendar;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.wypl.jpacalendardomain.schedule.data;

public enum RepetitionCycle {
DAY,
WEEK,
MONTH,
YEAR
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.wypl.jpacalendardomain.schedule.domain;

import com.wypl.jpacalendardomain.schedule.data.RepetitionCycle;
import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.SQLRestriction;

@Builder
@Getter
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SQLRestriction("deleted_at is null")
@Entity
@Table(name = "repetition")
public class Repetition {
// Todo : extends BaseEntity

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "repetition_id")
private Long repetitionId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "schedule_info_id", nullable = false)
private ScheduleInfo scheduleInfo;

@Enumerated(EnumType.STRING)
@Column(name = "repetition_cycle")
private RepetitionCycle repetitionCycle;

@Column(name = "day_of_week")
private Integer dayOfWeek; // bit

@Column(name = "week_of_month")
private Integer weekOfMonth;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.wypl.jpacalendardomain.schedule.domain;

import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.SQLRestriction;

import java.time.LocalDateTime;

@Builder
@Getter
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SQLRestriction("deleted_at is null")
@Entity
@Table(name = "schedule")
public class Schedule {
// Todo : extends BaseEntity

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "schedule_id")
private Long scheduleId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "schedule_info_id", nullable = false)
private ScheduleInfo scheduleInfo;

@Column(name = "title", length = 100)
private String title;

@Column(name = "description")
private String description;

@Column(name = "start_datetime", nullable = false)
private LocalDateTime startDateTime;

@Column(name = "end_datetime", nullable = false)
private LocalDateTime endDateTime;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.wypl.jpacalendardomain.schedule.domain;

import com.wypl.jpacalendardomain.calendar.domain.Calendar;
import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.SQLRestriction;

import java.time.LocalDateTime;

@Builder
@Getter
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@SQLRestriction("deleted_at is null")
@Entity
@Table(name = "schedule_info")
public class ScheduleInfo {
// Todo : extends BaseEntity

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "schedule_info_id")
private Long scheduleInfoId;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "calendar_id", nullable = false)
private Calendar calendar;

@Column(name = "start_datetime", nullable = false)
private LocalDateTime startDateTime;

@Column(name = "end_datetime", nullable = false)
private LocalDateTime endDateTime;

@Column(name = "creator_id")
private Long creatorId;

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
import jakarta.persistence.Column;
import jakarta.persistence.EntityListeners;
import jakarta.persistence.MappedSuperclass;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Getter
@MappedSuperclass
@NoArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@EntityListeners(AuditingEntityListener.class)
public abstract class JpaBaseEntity {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

@Getter
public enum JpaErrorCode implements ServerErrorCode {
ALREADY_DELETED_ENTITY(400, "JPA_001", "이미 삭제된 요소는 삭제할 수 없습니다."),
NON_DELETED_ENTITY(400, "JPA_002", "삭제되지 않은 요소는 복구할 수 없습니다.");
ALREADY_DELETED_ENTITY(400, "JPA_001", "이미 삭제된 데이터입니다"),
NON_DELETED_ENTITY(400, "JPA_002", "삭제되지 않은 데이터는 복구할 수 없습니다.");
private final int statusCode;
private final String errorCode;
private final String message;
Expand Down
2 changes: 2 additions & 0 deletions domain/jpa-member-domain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ java {

dependencies {
implementation project(':domain:jpa-common')
implementation project(':common')

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,40 @@
package com.wypl.jpamemberdomain.member;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import com.wypl.common.Color;
import jakarta.persistence.*;

import java.time.LocalDate;

@Entity
@Table(name = "member_tbl")
public class Member {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;

@Column(name = "email", length = 50, unique = true, nullable = false)
private String email;

@Column(name = "nickname", length = 20, nullable = false)
private String nickname;

@Column(name = "birthday")
private LocalDate birthday;

@Column(name = "profile_image", length = 100)
private String profileImage;

@Enumerated(EnumType.STRING)
@Column(name = "color", length = 20, nullable = false)
private Color color;

@Enumerated(EnumType.STRING)
@Column(name = "timezone", length = 10, nullable = false)
private TimeZone timeZone;

// @OneToMany(mappedBy = "member")
// private List<MemberCalendar> memberCalendars;

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.wypl.jpamemberdomain.member;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum OauthProvider {
GOOGLE("gmail.com");

private final String domain;

public boolean equalsName(final String otherName) {
return name().equalsIgnoreCase(otherName);
}
}
Loading

0 comments on commit 2283777

Please sign in to comment.