Skip to content
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

๐Ÿ”— :: (8452) ๊ณต์ง€ ์ฒจ๋ถ€๋ฌผ nullable #853

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"));
ilyoil2 marked this conversation as resolved.
Show resolved Hide resolved

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 @@ -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
Loading