-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Entity 추가 #7
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package gdsc.sc.bsafe.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.DiscriminatorValue; | ||
import jakarta.persistence.Entity; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@DiscriminatorValue("AI") | ||
public class AIRecord extends Record { | ||
|
||
@Column(nullable = false) | ||
private Integer grade; | ||
|
||
@Builder | ||
public AIRecord(User user, String image, String title, String detail, Integer grade){ | ||
super(user, image, title, detail); | ||
this.grade = grade; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package gdsc.sc.bsafe.domain; | ||
|
||
import jakarta.persistence.DiscriminatorValue; | ||
import jakarta.persistence.Entity; | ||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@DiscriminatorValue("BASIC") | ||
public class BasicRecord extends Record { | ||
|
||
@Builder | ||
public BasicRecord(User user, String image, String title, String detail){ | ||
super(user, image, title, detail); | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package gdsc.sc.bsafe.domain; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@DiscriminatorColumn | ||
@Table(name = "record") | ||
public class Record { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "record_id") | ||
private Long recordId; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "user_id", nullable = false) | ||
private User user; | ||
|
||
@Column(nullable = false) | ||
private String image; | ||
|
||
@Column(nullable = false) | ||
private String title; | ||
|
||
@Column(nullable = false) | ||
private String detail; | ||
|
||
/* | ||
ENUM 타입으로 변경하기 | ||
private String category; | ||
*/ | ||
|
||
public Record(User user, String image, String title, String detail){ | ||
this.user = user; | ||
this.image = image; | ||
this.title = title; | ||
this.detail = detail; | ||
} | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package gdsc.sc.bsafe.domain.enums; | ||
|
||
public enum RequestStatus { | ||
REQUESTED("요청"), | ||
PROCEEDING("진행"), | ||
COMPLETED("완료"); | ||
|
||
private String description; | ||
RequestStatus(String description){this.description=description;} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package gdsc.sc.bsafe.domain.mapping; | ||
|
||
import gdsc.sc.bsafe.domain.Record; | ||
import gdsc.sc.bsafe.domain.User; | ||
import gdsc.sc.bsafe.domain.common.BaseTimeEntity; | ||
import gdsc.sc.bsafe.domain.enums.RequestStatus; | ||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.Date; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Table(name = "help_record") | ||
public class HelpRecord extends BaseTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "report_id") | ||
private Long reportId; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "record_id", nullable = false) | ||
private Record record; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "helper_id", nullable = false) | ||
private User helper; | ||
|
||
@Column(nullable = false) | ||
private RequestStatus status; | ||
|
||
@Column(nullable = false) | ||
private Date date; | ||
|
||
@Column(nullable = false) | ||
private String placeId; | ||
|
||
@Column(nullable = false) | ||
private String district; | ||
|
||
@Column(nullable = false) | ||
private String address; | ||
Comment on lines
+35
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 생각해봤는데 이 부분에 대한 값을 사용자가 보수 신청할 때 함께 요청하는 거면 Record로 옮겨야 할 것 같아요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
일반 저장(기록용)/ 수리 요청 이렇게 나눠서 저장하는걸로 얘기했던거 같아서 엔티티를 분리했어요! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 확인했습니다! |
||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
유저 롤 타입도 이렇게 DType으로 일반 사용자랑 봉사자 구분해서 설정하는 걸로 생각하면 될까요?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
유저는 타입에 따라서 컬럼이 달라지지는 않는거 같아서 그냥 ENUM 타입으로 넣어도될거같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그럼 봉사자 신청할 때 개인 / 기관(단체) 나누지 않고 그냥 롤만 바뀌는 건가요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 저는 그렇게 생각했는데, �롤에 따라 추가될 컬럼이 있을까요?