-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/#6 #43
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
Feat/#6 #43
Changes from all commits
c63158d
24993bb
f5af57a
1ee0253
d362b11
f9a11e9
40a81e2
ebe472f
dc565d3
6243f22
79d27e3
e74ac06
0aa96d8
0223e30
45526b2
8e92b66
7b03283
c6a20c4
c35fe2f
c537661
f5f7665
c52212a
a44dde9
00ae37d
73bd190
94e095d
2c942b8
3d089be
25dd720
6467264
d485e24
6f27830
913c04b
2a9e16c
ef1a5a1
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,41 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| package hello.cluebackend.domain.assignment.domain; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import hello.cluebackend.domain.assignment.presentation.dto.AssignmentAttachmentDto; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import hello.cluebackend.domain.classroom.domain.ClassRoom; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import hello.cluebackend.domain.user.domain.UserEntity; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import jakarta.persistence.*; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import lombok.*; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import java.time.LocalDateTime; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Table(name = "assignments") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Getter @Setter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @AllArgsConstructor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @NoArgsConstructor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Builder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public class Assignment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Column(name = "assignment_id") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private Long assignmentId; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @ManyToOne(fetch = FetchType.LAZY) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JoinColumn(name = "class_room_id") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private ClassRoom classRoom; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @ManyToOne(fetch = FetchType.LAZY) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JoinColumn(name = "creator_id") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private UserEntity user; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Column(name = "title") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String title; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Column(name = "content") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String content; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Column(name = "start_date") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private LocalDateTime startDate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Column(name = "due_date") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private LocalDateTime dueDate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+30
to
+40
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. 🛠️ Refactor suggestion 필수 필드에 대한 검증 어노테이션 추가 권장 제목이나 내용 같은 필수 필드에 대한 검증이 없어 데이터 무결성 문제가 발생할 수 있습니다. Bean Validation 어노테이션을 추가하세요: +import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
@Column(name = "title")
+ @NotBlank(message = "제목은 필수입니다")
private String title;
@Column(name = "content")
+ @NotBlank(message = "내용은 필수입니다")
private String content;
@Column(name = "start_date")
+ @NotNull(message = "시작일은 필수입니다")
private LocalDateTime startDate;
@Column(name = "due_date")
+ @NotNull(message = "마감일은 필수입니다")
private LocalDateTime dueDate;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents🛠️ Refactor suggestion 필드 검증 어노테이션 및 제약 조건 추가 권장 과제 데이터의 무결성을 위해 검증 어노테이션을 추가하는 것을 권장합니다. + import jakarta.validation.constraints.NotBlank;
+ import jakarta.validation.constraints.Size;
+ import jakarta.validation.constraints.Future;
@Column(name = "title")
+ @NotBlank(message = "과제 제목은 필수입니다")
+ @Size(max = 200, message = "제목은 200자를 초과할 수 없습니다")
private String title;
@Column(name = "content")
+ @Size(max = 5000, message = "내용은 5000자를 초과할 수 없습니다")
private String content;
@Column(name = "start_date")
private LocalDateTime startDate;
@Column(name = "due_date")
+ @Future(message = "마감일은 현재 시간 이후여야 합니다")
private LocalDateTime dueDate;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Comment on lines
+36
to
+40
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. 🛠️ Refactor suggestion 과제 날짜 검증 로직 추가 필요 시작일이 마감일보다 늦는 경우를 방지하는 검증이 필요합니다. 엔티티에 검증 메서드를 추가하거나 서비스 레이어에서 검증하세요: @PrePersist
@PreUpdate
private void validateDates() {
if (startDate != null && dueDate != null && startDate.isAfter(dueDate)) {
throw new IllegalArgumentException("시작일은 마감일보다 늦을 수 없습니다");
}
}🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,60 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| package hello.cluebackend.domain.assignment.domain; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import hello.cluebackend.domain.assignment.presentation.dto.AssignmentAttachmentDto; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import hello.cluebackend.domain.user.domain.UserEntity; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import jakarta.persistence.*; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import lombok.*; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import java.time.LocalDateTime; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Table(name = "assignment_attachment") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Getter @Setter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @AllArgsConstructor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @NoArgsConstructor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Builder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public class AssignmentAttachment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private Long assignmentAttachmentId; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @ManyToOne(fetch = FetchType.LAZY) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JoinColumn(name="assignment_id") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private Assignment assignment; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @ManyToOne(fetch = FetchType.LAZY) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JoinColumn(name = "user_id") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private UserEntity user; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Column(name = "original_file_name") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String originalFileName; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Column(name = "stored_file_name") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String storedFileName; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Column(name = "file_path") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String filePath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Column(name = "file_size") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private Integer fileSize; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+37
to
+38
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. 🛠️ Refactor suggestion 파일 크기 데이터 타입을 Long으로 변경하는 것을 권장합니다.
@Column(name = "file_size")
- private Integer fileSize;
+ private Long fileSize;해당 DTO 클래스에서도 동일하게 수정이 필요합니다. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Enumerated(EnumType.STRING) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Column(name = "submit_type") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private SubmitType submitType; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Column(name = "update_date") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private LocalDateTime updateDate; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public AssignmentAttachmentDto toDto() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return AssignmentAttachmentDto.builder() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .assignmentAttachmentId(assignmentAttachmentId) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .assignment(assignment) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .user(user) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .originalFileName(originalFileName) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .storedFileName(storedFileName) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .filePath(filePath) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .fileSize(fileSize) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .submitType(submitType) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .updateDate(updateDate) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .build(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+47
to
+59
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. toDto() 메서드에서 지연 로딩 엔티티 직접 노출
DTO에서는 필요한 ID만 포함하도록 수정하세요: public AssignmentAttachmentDto toDto() {
return AssignmentAttachmentDto.builder()
.assignmentAttachmentId(assignmentAttachmentId)
- .assignment(assignment)
- .user(user)
+ .assignmentId(assignment != null ? assignment.getAssignmentId() : null)
+ .userId(user != null ? user.getUserId() : null)
.originalFileName(originalFileName)
.storedFileName(storedFileName)
.filePath(filePath)
.fileSize(fileSize)
.submitType(submitType)
.updateDate(updateDate)
.build();
}
🤖 Prompt for AI AgentstoDto 메서드에서 엔티티 객체 직접 노출 문제 DTO에 엔티티 객체( 엔티티 대신 ID나 필요한 필드만 전달하도록 수정해주세요: public AssignmentAttachmentDto toDto() {
return AssignmentAttachmentDto.builder()
.assignmentAttachmentId(assignmentAttachmentId)
- .assignment(assignment)
- .user(user)
+ .assignmentId(assignment != null ? assignment.getAssignmentId() : null)
+ .userId(user != null ? user.getUserId() : null)
.originalFileName(originalFileName)
.storedFileName(storedFileName)
.filePath(filePath)
.fileSize(fileSize)
.submitType(submitType)
.updateDate(updateDate)
.build();
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,32 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| package hello.cluebackend.domain.assignment.domain; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| import hello.cluebackend.domain.user.domain.UserEntity; | ||||||||||||||||||||||||||||||||||||||||||||||
| import jakarta.persistence.*; | ||||||||||||||||||||||||||||||||||||||||||||||
| import lombok.*; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| import java.time.LocalDateTime; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Entity | ||||||||||||||||||||||||||||||||||||||||||||||
| @Table(name="assignment_check") | ||||||||||||||||||||||||||||||||||||||||||||||
| @Getter @Setter | ||||||||||||||||||||||||||||||||||||||||||||||
| @AllArgsConstructor | ||||||||||||||||||||||||||||||||||||||||||||||
| @NoArgsConstructor | ||||||||||||||||||||||||||||||||||||||||||||||
| @Builder | ||||||||||||||||||||||||||||||||||||||||||||||
| public class AssignmentCheck { | ||||||||||||||||||||||||||||||||||||||||||||||
| @Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||||||||||||||||||||||||||||||||||||||||||||
| private Long assignmentCheckId; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @ManyToOne(fetch = FetchType.LAZY) | ||||||||||||||||||||||||||||||||||||||||||||||
| @JoinColumn(name = "user_id") | ||||||||||||||||||||||||||||||||||||||||||||||
| private UserEntity user; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @ManyToOne(fetch = FetchType.LAZY) | ||||||||||||||||||||||||||||||||||||||||||||||
| @JoinColumn(name = "assignment_id") | ||||||||||||||||||||||||||||||||||||||||||||||
| private Assignment assignment; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+19
to
+25
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. 🛠️ Refactor suggestion 중복 제출 체크 방지를 위한 유니크 제약조건 추가 권장 동일한 사용자가 같은 과제에 대해 여러 개의 체크 레코드를 생성할 수 있어 데이터 무결성 문제가 발생할 수 있습니다. 테이블 레벨에서 유니크 제약조건을 추가하세요: @Entity
- @Table(name="assignment_check")
+ @Table(name="assignment_check",
+ uniqueConstraints = @UniqueConstraint(
+ columnNames = {"user_id", "assignment_id"}))
@Getter @Setter🤖 Prompt for AI Agents🛠️ Refactor suggestion 유니크 제약 조건 추가 권장 같은 사용자가 같은 과제에 대해 중복된 체크 레코드를 가질 수 없도록 유니크 제약 조건을 추가해야 합니다. @Entity
@Table(name="assignment_check",
+ uniqueConstraints = @UniqueConstraint(
+ name = "uk_assignment_check_user_assignment",
+ columnNames = {"user_id", "assignment_id"}
+ ))🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Column(name="is_submitted") | ||||||||||||||||||||||||||||||||||||||||||||||
| private Boolean isSubmitted; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+27
to
+28
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. 🛠️ Refactor suggestion Boolean 필드 기본값 설정
@Column(name="is_submitted")
+ @Builder.Default
- private Boolean isSubmitted;
+ private Boolean isSubmitted = false;또는 데이터베이스 레벨에서도 기본값을 설정할 수 있습니다: - @Column(name="is_submitted")
+ @Column(name="is_submitted", nullable = false, columnDefinition = "BOOLEAN DEFAULT FALSE")📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| @Column(name="submitted_at") | ||||||||||||||||||||||||||||||||||||||||||||||
| private LocalDateTime submittedAt; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+27
to
+31
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. 🛠️ Refactor suggestion 제출 상태 필드 개선 권장
다음과 같이 개선하세요: @Column(name="is_submitted")
+ @Builder.Default
private Boolean isSubmitted;
@Column(name="submitted_at")
private LocalDateTime submittedAt;
+
+ @PrePersist
+ @PreUpdate
+ private void validateSubmission() {
+ if (isSubmitted == null) {
+ isSubmitted = false;
+ }
+ if (Boolean.TRUE.equals(isSubmitted) && submittedAt == null) {
+ submittedAt = LocalDateTime.now();
+ }
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents🛠️ Refactor suggestion 제출 상태와 제출 시간 간의 일관성 보장 필요
비즈니스 로직 검증을 위한 메서드를 추가하세요: + import jakarta.persistence.PrePersist;
+ import jakarta.persistence.PreUpdate;
@Column(name="is_submitted")
+ @Builder.Default
private Boolean isSubmitted;
@Column(name="submitted_at")
private LocalDateTime submittedAt;
+ @PrePersist
+ @PreUpdate
+ private void validateSubmissionStatus() {
+ if (Boolean.TRUE.equals(isSubmitted) && submittedAt == null) {
+ submittedAt = LocalDateTime.now();
+ } else if (Boolean.FALSE.equals(isSubmitted)) {
+ submittedAt = null;
+ }
+ }
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,46 @@ | ||||||||||
| package hello.cluebackend.domain.assignment.domain; | ||||||||||
|
|
||||||||||
| import hello.cluebackend.domain.user.domain.UserEntity; | ||||||||||
| import jakarta.persistence.*; | ||||||||||
| import lombok.*; | ||||||||||
|
|
||||||||||
| import java.time.LocalDateTime; | ||||||||||
|
|
||||||||||
| @Entity | ||||||||||
| @Table(name = "assignment_content") | ||||||||||
| @Getter @Setter | ||||||||||
|
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. 🛠️ Refactor suggestion 엔티티에 @Setter 사용을 재고하세요. JPA 엔티티에 -@Getter @Setter
+@Getter📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| @AllArgsConstructor | ||||||||||
| @NoArgsConstructor | ||||||||||
| @Builder | ||||||||||
| public class AssignmentContent { | ||||||||||
| @Id @GeneratedValue(strategy = GenerationType.IDENTITY) | ||||||||||
| @Column(name="assignment_content_id") | ||||||||||
| private Long assignmentContentId; | ||||||||||
|
|
||||||||||
| @ManyToOne(fetch = FetchType.LAZY) | ||||||||||
| @JoinColumn(name="user_id") | ||||||||||
| private UserEntity user; | ||||||||||
|
|
||||||||||
| @ManyToOne(fetch = FetchType.LAZY) | ||||||||||
| @JoinColumn(name="assignment_id") | ||||||||||
| private Assignment assignment; | ||||||||||
|
|
||||||||||
| @JoinColumn(name="original_file_name") | ||||||||||
| private String originalFileName; | ||||||||||
|
Comment on lines
+28
to
+29
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. 잘못된 어노테이션 사용을 수정하세요.
- @JoinColumn(name="original_file_name")
+ @Column(name="original_file_name")
private String originalFileName;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
|
|
||||||||||
| @Column(name="stored_file_name") | ||||||||||
| private String storedFileName; | ||||||||||
|
|
||||||||||
| @Column(name="file_path") | ||||||||||
| private String filePath; | ||||||||||
|
|
||||||||||
| @Column(name="file_size") | ||||||||||
| private int fileSize; | ||||||||||
|
|
||||||||||
| @Enumerated(EnumType.STRING) | ||||||||||
| @Column(name = "submit_type") | ||||||||||
| private SubmitType submitType; // 1. 랑크 , 2. 파일 | ||||||||||
|
|
||||||||||
| @Column(name="update_date") | ||||||||||
| private LocalDateTime updateDate; | ||||||||||
| } | ||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package hello.cluebackend.domain.assignment.domain; | ||
|
|
||
| public enum SubmitType { | ||
| FILE, | ||
| LINK, | ||
| IMAGE | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package hello.cluebackend.domain.assignment.domain.repository; | ||
|
|
||
| import hello.cluebackend.domain.assignment.domain.Assignment; | ||
| import hello.cluebackend.domain.assignment.domain.AssignmentAttachment; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import org.springframework.stereotype.Repository; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Repository | ||
| public interface AssignmentAttachmentRepository extends JpaRepository<AssignmentAttachment,Long> { | ||
| List<AssignmentAttachment> findAllByAssignment(Assignment assignment); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package hello.cluebackend.domain.assignment.domain.repository; | ||
|
|
||
| import hello.cluebackend.domain.assignment.domain.Assignment; | ||
| import hello.cluebackend.domain.assignment.domain.AssignmentCheck; | ||
| import io.lettuce.core.dynamic.annotation.Param; | ||
|
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. 잘못된 @param 어노테이션 import Lettuce Redis 클라이언트의 다음과 같이 수정하세요: -import io.lettuce.core.dynamic.annotation.Param;
+import org.springframework.data.repository.query.Param;🤖 Prompt for AI Agents잘못된 @param 어노테이션 import Lettuce Redis 클라이언트의 - import io.lettuce.core.dynamic.annotation.Param;
+ import org.springframework.data.repository.query.Param;🤖 Prompt for AI Agents |
||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
| import org.springframework.data.jpa.repository.Query; | ||
| import org.springframework.stereotype.Repository; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Repository | ||
| public interface AssignmentCheckRepository extends JpaRepository<AssignmentCheck,Long> { | ||
| @Query(""" | ||
| SELECT ac.assignment | ||
| FROM AssignmentCheck ac | ||
| JOIN ac.assignment a | ||
| JOIN a.classRoom cr | ||
| JOIN cr.classRoomUserList cru | ||
| WHERE ac.user.userId = :userId | ||
| AND ac.isSubmitted = false | ||
| """) | ||
| List<Assignment> findUnsubmittedAssignmentsByUserId(@Param("userId") Long userId); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package hello.cluebackend.domain.assignment.domain.repository; | ||
|
|
||
| import hello.cluebackend.domain.assignment.domain.AssignmentContent; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| public interface AssignmentContentRepository extends JpaRepository<AssignmentContent, Long> { | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package hello.cluebackend.domain.assignment.domain.repository; | ||
|
|
||
| import hello.cluebackend.domain.assignment.domain.Assignment; | ||
| import org.springframework.data.jpa.repository.JpaRepository; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface AssignmentRepository extends JpaRepository<Assignment, Long> { | ||
| List<Assignment> findAllByClassRoom_ClassRoomId(Long classId); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package hello.cluebackend.domain.assignment.exception; | ||
|
|
||
| import org.springframework.http.HttpStatus; | ||
| import org.springframework.web.bind.annotation.ResponseStatus; | ||
|
|
||
| @ResponseStatus(HttpStatus.NOT_FOUND) // 404 Not Found 응답 | ||
| public class AssignmentNotFoundException extends RuntimeException { | ||
| public AssignmentNotFoundException() { | ||
| super("해당 과제를 찾을 수 없습니다."); | ||
| } | ||
|
|
||
| public AssignmentNotFoundException(String message) { | ||
| super(message); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package hello.cluebackend.domain.assignment.exception; | ||
|
|
||
| import org.springframework.http.HttpStatus; | ||
| import org.springframework.web.bind.annotation.ResponseStatus; | ||
|
|
||
| @ResponseStatus(HttpStatus.FORBIDDEN) // 403 Forbidden 응답 | ||
| public class UnauthorizedException extends RuntimeException { | ||
| public UnauthorizedException() { | ||
| super("접근 권한이 없습니다."); | ||
| } | ||
|
|
||
| public UnauthorizedException(String message) { | ||
| super(message); | ||
| } | ||
| } |
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.
💡 Verification agent
🧩 Analysis chain
Spring Cloud AWS 버전을 업데이트해야 합니다.
AWS S3 SDK는 최신 버전(2.32.1)을 사용하고 있지만, Spring Cloud AWS 버전(2.2.6.RELEASE)이 너무 오래되었습니다. 이는 Spring Boot 3.x와 호환성 문제를 일으킬 수 있습니다.
다음과 같이 최신 버전으로 업데이트하는 것을 권장합니다:
Spring Cloud AWS의 최신 버전 확인을 위해 다음을 검색해주세요:
🌐 Web query:
💡 Result:
The latest version of Spring Cloud AWS compatible with Spring Boot 3.x is 3.4.0, which works with Spring Boot 3.5.x, while 3.3.x supports Spring Boot 3.4.x, 3.2.x supports 3.2.x–3.3.x, and 3.0.x supports 3.0.x–3.1.x[1][4][6][7].
Compatibility Table
Additional Details
Reference Links (For Internal Team)
If you are targeting a specific 3.x release of Spring Boot, match the Spring Cloud AWS version accordingly using the table above to ensure full compatibility[1][4][7].
Citations:
Spring Cloud AWS 버전을 Spring Boot 3.x 호환 최신(3.4.0)으로 업그레이드하세요
다음 위치를 수정해 주세요:
Spring Boot 3.5.x 사용 시 Spring Cloud AWS 3.4.0이 호환되므로 해당 버전으로 변경이 필요합니다.
📝 Committable suggestion
🤖 Prompt for AI Agents