|
1 | 1 | package com.sponus.sponusbe.domain.announcement.entity;
|
2 | 2 |
|
| 3 | +import java.util.ArrayList; |
| 4 | +import java.util.List; |
| 5 | + |
3 | 6 | import com.sponus.sponusbe.domain.announcement.entity.enums.AnnouncementCategory;
|
4 | 7 | import com.sponus.sponusbe.domain.announcement.entity.enums.AnnouncementStatus;
|
5 | 8 | import com.sponus.sponusbe.domain.announcement.entity.enums.AnnouncementType;
|
|
18 | 21 | import jakarta.persistence.Id;
|
19 | 22 | import jakarta.persistence.JoinColumn;
|
20 | 23 | import jakarta.persistence.ManyToOne;
|
| 24 | +import jakarta.persistence.OneToMany; |
21 | 25 | import jakarta.persistence.Table;
|
22 | 26 | import lombok.AccessLevel;
|
23 | 27 | import lombok.AllArgsConstructor;
|
@@ -63,11 +67,16 @@ public class Announcement extends BaseEntity {
|
63 | 67 | @JoinColumn(name = "organization_id", foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
|
64 | 68 | private Organization writer;
|
65 | 69 |
|
| 70 | + @Builder.Default |
| 71 | + @OneToMany(mappedBy = "announcement") |
| 72 | + private List<AnnouncementAttachment> announcementAttachments = new ArrayList<>(); |
| 73 | + |
66 | 74 | public void increaseViewCount() {
|
67 | 75 | this.viewCount++;
|
68 | 76 | }
|
69 | 77 |
|
70 |
| - public void update(String title, AnnouncementType type, AnnouncementCategory category, String content, AnnouncementStatus status) { |
| 78 | + public void update(String title, AnnouncementType type, AnnouncementCategory category, String content, |
| 79 | + AnnouncementStatus status) { |
71 | 80 | this.title = title == null ? this.title : title;
|
72 | 81 | this.type = type == null ? this.type : type;
|
73 | 82 | this.category = category == null ? this.category : category;
|
|
0 commit comments