diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/company/usecase/TeacherQueryCompaniesUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/company/usecase/TeacherQueryCompaniesUseCase.java index 403d55354..c92935ddd 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/company/usecase/TeacherQueryCompaniesUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/company/usecase/TeacherQueryCompaniesUseCase.java @@ -77,7 +77,6 @@ public CompanyCountResponse countCompanies( .limit(1000) .build(); - return new CompanyCountResponse( queryCompanyPort.getByConditions(filter).stream().toList().size() ); diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/file/model/FileType.java b/jobis-application/src/main/java/team/retum/jobis/domain/file/model/FileType.java index 705c9f7a3..b49a66479 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/file/model/FileType.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/file/model/FileType.java @@ -10,7 +10,7 @@ public enum FileType { LOGO_IMAGE(List.of(".jpg", ".png", ".svg")), - EXTENSION_FILE(List.of(".pdf", ".ppt", ".pptx", ".hwp", ".jpg", ".png", ".zip", ".txt", ".mp4")); + EXTENSION_FILE(List.of(".pdf", ".ppt", ".pptx", ".hwp", ".jpg", ".png", ".zip", ".txt", ".mp4", ".opt", ".doc", ".docx", ".hwpx")); public final List validExtensions; } diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/notice/dto/response/QueryNoticeDetailResponse.java b/jobis-application/src/main/java/team/retum/jobis/domain/notice/dto/response/QueryNoticeDetailResponse.java index 21272b3c8..fc12eb6ce 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/notice/dto/response/QueryNoticeDetailResponse.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/notice/dto/response/QueryNoticeDetailResponse.java @@ -6,6 +6,7 @@ import team.retum.jobis.domain.notice.model.NoticeAttachment; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; @Getter diff --git a/jobis-application/src/main/java/team/retum/jobis/domain/notice/usecase/CreateNoticeUseCase.java b/jobis-application/src/main/java/team/retum/jobis/domain/notice/usecase/CreateNoticeUseCase.java index 242c7040b..ef50e5135 100644 --- a/jobis-application/src/main/java/team/retum/jobis/domain/notice/usecase/CreateNoticeUseCase.java +++ b/jobis-application/src/main/java/team/retum/jobis/domain/notice/usecase/CreateNoticeUseCase.java @@ -9,6 +9,8 @@ import team.retum.jobis.domain.notice.model.NoticeAttachment; import team.retum.jobis.domain.notice.spi.CommandNoticePort; +import java.util.List; + @RequiredArgsConstructor @UseCase public class CreateNoticeUseCase { @@ -17,12 +19,15 @@ public class CreateNoticeUseCase { private final PublishEventPort publishEventPort; public void execute(CreateNoticeRequest request) { + List attachments = request.getAttachments().stream() + .filter(attachment -> attachment.getUrl() != null && attachment.getType() != null) // URL과 Type이 null이 아닌 경우만 필터링 + .map(attachment -> new NoticeAttachment(attachment.getUrl(), attachment.getType())) + .toList(); + Notice savedNotice = commandNoticePort.save(Notice.builder() .title(request.getTitle()) .content(request.getContent()) - .attachments(request.getAttachments().stream() - .map(attachment -> new NoticeAttachment(attachment.getUrl(), attachment.getType())) - .toList()) + .attachments(attachments) .build()); publishEventPort.publishEvent(new NoticePostedEvent(savedNotice)); diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/application/persistence/entity/ApplicationEntity.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/application/persistence/entity/ApplicationEntity.java index cdbcb9900..32a145ac2 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/application/persistence/entity/ApplicationEntity.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/application/persistence/entity/ApplicationEntity.java @@ -64,7 +64,7 @@ public class ApplicationEntity extends BaseTimeEntity { @JoinColumn(name = "recruitment_id", nullable = false) private RecruitmentEntity recruitment; - @OneToMany(mappedBy = "application", cascade = CascadeType.ALL) + @OneToMany(mappedBy = "application", cascade = CascadeType.ALL, orphanRemoval = true) private List applicationAttachments = new ArrayList<>(); @LastModifiedDate diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/persistence/mapper/NoticeMapper.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/persistence/mapper/NoticeMapper.java index 0624edfb8..2599e9797 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/persistence/mapper/NoticeMapper.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/persistence/mapper/NoticeMapper.java @@ -14,9 +14,13 @@ public class NoticeMapper { public NoticeEntity toEntity(Notice domain) { - List attachments = domain.getAttachments().stream() - .map(attachment -> new NoticeAttachmentEntity(attachment.getUrl(), attachment.getType())) - .toList(); + List attachments = null; + + if (domain.getAttachments() != null && !domain.getAttachments().isEmpty()) { + attachments = domain.getAttachments().stream() + .map(attachment -> new NoticeAttachmentEntity(attachment.getUrl(), attachment.getType())) + .toList(); + } return NoticeEntity.builder() .id(domain.getId()) @@ -27,9 +31,13 @@ public NoticeEntity toEntity(Notice domain) { } public Notice toDomain(NoticeEntity entity) { - List attachments = entity.getAttachments().stream() - .map(attachment -> new NoticeAttachment(attachment.getAttachmentUrl(), attachment.getType())) - .toList(); + List attachments = null; + + if (entity.getAttachments() != null && !entity.getAttachments().isEmpty()) { + attachments = entity.getAttachments().stream() + .map(attachment -> new NoticeAttachment(attachment.getAttachmentUrl(), attachment.getType())) + .toList(); + } return Notice.builder() .id(entity.getId()) diff --git a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/presentation/dto/CreateNoticeWebRequest.java b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/presentation/dto/CreateNoticeWebRequest.java index f379ace3e..1ae9405c5 100644 --- a/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/presentation/dto/CreateNoticeWebRequest.java +++ b/jobis-infrastructure/src/main/java/team/retum/jobis/domain/notice/presentation/dto/CreateNoticeWebRequest.java @@ -35,10 +35,8 @@ public CreateNoticeRequest toDomainRequest() { @Getter public static class AttachmentWebRequest { - @NotBlank private String url; - @NotNull private AttachmentType type; } }