Skip to content

Commit

Permalink
πŸš€ :: 1.2.17
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyoil2 committed Nov 15, 2024
2 parents cf5e7dc + 9ed9009 commit 5db630a
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public CompanyCountResponse countCompanies(
.limit(1000)
.build();


return new CompanyCountResponse(
queryCompanyPort.getByConditions(filter).stream().toList().size()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> validExtensions;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -17,12 +19,15 @@ public class CreateNoticeUseCase {
private final PublishEventPort publishEventPort;

public void execute(CreateNoticeRequest request) {
List<NoticeAttachment> 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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ApplicationAttachmentEntity> applicationAttachments = new ArrayList<>();

@LastModifiedDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
public class NoticeMapper {

public NoticeEntity toEntity(Notice domain) {
List<NoticeAttachmentEntity> attachments = domain.getAttachments().stream()
.map(attachment -> new NoticeAttachmentEntity(attachment.getUrl(), attachment.getType()))
.toList();
List<NoticeAttachmentEntity> 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())
Expand All @@ -27,9 +31,13 @@ public NoticeEntity toEntity(Notice domain) {
}

public Notice toDomain(NoticeEntity entity) {
List<NoticeAttachment> attachments = entity.getAttachments().stream()
.map(attachment -> new NoticeAttachment(attachment.getAttachmentUrl(), attachment.getType()))
.toList();
List<NoticeAttachment> 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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ public CreateNoticeRequest toDomainRequest() {
@Getter
public static class AttachmentWebRequest {

@NotBlank
private String url;

@NotNull
private AttachmentType type;
}
}

0 comments on commit 5db630a

Please sign in to comment.