Skip to content

Commit

Permalink
refactor: 기획 의도에 맞게 welcomeMessageTypes를 null로 request 및 저장할 수 있도록 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
hoonyworld committed Jan 17, 2025
1 parent 0179747 commit 32e39dd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ public class Tag extends BaseTimeEntity {
private Integer lightningId;

@Column(name = "welcomeMessageTypes", columnDefinition = "jsonb")
@NotNull
@Convert(converter = WelcomeTypeConverter.class)
@Type(JsonBinaryType.class)
private List<WelcomeMessageType> welcomeMessageTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import java.util.List;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;

@Schema(name = "LightningV2CreateLightningBodyDto", description = "번쩍 모임 생성 및 수정 request body dto")
public record LightningV2CreateLightningBodyDto(
@Schema(description = "번쩍 모임 생성 및 수정 request body")
@NotNull LightningV2CreateLightningBodyWithoutWelcomeMessageDto lightningBody,
@NotNull
LightningV2CreateLightningBodyWithoutWelcomeMessageDto lightningBody,

@Schema(example = "[\"YB 환영\", \"OB 환영\"]", description = "환영 메시지 타입 리스트")
@NotEmpty List<String> welcomeMessageTypes
List<String> welcomeMessageTypes
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ public TagV2CreateTagResponseDto createLightningTag(List<String> welcomeMessageT
throw new BadRequestException(VALIDATION_EXCEPTION.getErrorCode());
}

List<WelcomeMessageType> welcomeMessageTypeEnums = welcomeMessageTypes.stream()
.map(WelcomeMessageType::ofValue)
.toList();
List<WelcomeMessageType> welcomeMessageTypeEnums = null;

if (welcomeMessageTypes != null) {
welcomeMessageTypeEnums = welcomeMessageTypes.stream()
.map(WelcomeMessageType::ofValue)
.toList();
}

Tag tag = Tag.createLightningMeetingTag(TagType.LIGHTNING, lightningId, welcomeMessageTypeEnums);
tagRepository.save(tag);
Expand Down

0 comments on commit 32e39dd

Please sign in to comment.