Skip to content

Commit da2eb01

Browse files
committed
CLAP-375 Fix: Comment에 Attachment 정보 추가
1 parent a44bc69 commit da2eb01

5 files changed

Lines changed: 19 additions & 9 deletions

File tree

src/main/java/clap/server/adapter/outbound/persistense/entity/task/AttachmentEntity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public class AttachmentEntity extends BaseTimeEntity {
3535
@JoinColumn(name = "task_id")
3636
private TaskEntity task;
3737

38-
@OneToOne(fetch = FetchType.LAZY)
39-
@JoinColumn(name = "comment_id")
40-
private CommentEntity comment;
38+
// @OneToOne(fetch = FetchType.LAZY)
39+
// @JoinColumn(name = "comment_id")
40+
// private CommentEntity comment;
4141

4242
@Column(name= "is_deleted", nullable = false)
4343
@Builder.Default

src/main/java/clap/server/adapter/outbound/persistense/entity/task/CommentEntity.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,18 @@ public class CommentEntity extends BaseTimeEntity {
3535
@Column(name = "content")
3636
private String content;
3737

38+
@Column
39+
private String originalName;
40+
41+
@Column
42+
private String fileUrl;
43+
44+
@Column
45+
private String fileSize;
46+
3847
@Column(name = "is_modified", nullable = false)
39-
private boolean isModified;
48+
@Builder.Default
49+
private boolean isModified = Boolean.FALSE;
4050

4151
@Column(name="is_deleted", nullable = false)
4252
@Builder.Default

src/main/java/clap/server/application/service/history/PostCommentService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public void saveCommentAttachment(Long memberId, Long taskId, MultipartFile file
9090

9191
private String saveAttachment(MultipartFile file, Task task, Comment comment) {
9292
String fileUrl = s3UploadPort.uploadSingleFile(FilePathConstants.TASK_COMMENT, file);
93-
Attachment attachment = Attachment.createCommentAttachment(task, comment, file.getOriginalFilename(), fileUrl, file.getSize());
93+
Attachment attachment = Attachment.createCommentAttachment(task, file.getOriginalFilename(), fileUrl, file.getSize());
9494
commandAttachmentPort.save(attachment);
9595
return file.getOriginalFilename();
9696
}

src/main/java/clap/server/domain/model/task/Attachment.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
public class Attachment extends BaseTime {
1313
private Long attachmentId;
1414
private Task task;
15-
private Comment comment;
1615
private String originalName;
1716
private String fileUrl;
1817
private String fileSize;
@@ -21,7 +20,6 @@ public class Attachment extends BaseTime {
2120
public static Attachment createAttachment(Task task, String originalName, String fileUrl, long fileSize) {
2221
return Attachment.builder()
2322
.task(task)
24-
.comment(null)
2523
.originalName(originalName)
2624
.fileUrl(fileUrl)
2725
.fileSize(formatFileSize(fileSize))
@@ -32,7 +30,6 @@ public static Attachment createAttachment(Task task, String originalName, String
3230
public static Attachment createCommentAttachment(Task task, Comment comment, String originalName, String fileUrl, long fileSize) {
3331
return Attachment.builder()
3432
.task(task)
35-
.comment(comment)
3633
.originalName(originalName)
3734
.fileUrl(fileUrl)
3835
.fileSize(formatFileSize(fileSize))

src/main/java/clap/server/domain/model/task/Comment.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import clap.server.domain.model.common.BaseTime;
44
import clap.server.domain.model.member.Member;
5+
import jakarta.persistence.Column;
56
import lombok.AccessLevel;
67
import lombok.Getter;
78
import lombok.NoArgsConstructor;
@@ -15,6 +16,9 @@ public class Comment extends BaseTime {
1516
private Member member;
1617
private Task task;
1718
private String content;
19+
private String originalName;
20+
private String fileUrl;
21+
private String fileSize;
1822
private boolean isModified;
1923
private boolean isDeleted;
2024

@@ -23,7 +27,6 @@ public static Comment createComment(Member member, Task task, String content) {
2327
.member(member)
2428
.task(task)
2529
.content(content)
26-
.isModified(false)
2730
.build();
2831
}
2932

0 commit comments

Comments
 (0)