Skip to content

Commit

Permalink
#143 [feat] Long 중복처리하는 부분을 이곳에만 써서 삭제후 PreferRegionsValidator에 합치기
Browse files Browse the repository at this point in the history
  • Loading branch information
hellozo0 committed Jan 16, 2024
1 parent c4546e3 commit 53847ea
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public void initialize(ValidPreferRegions constraintAnnotation) {
@Override
public boolean isValid(List<Long> preferRegions, ConstraintValidatorContext context) {

if (preferRegions == null || preferRegions.isEmpty()) return false;
if (preferRegions.size() != new HashSet<>(preferRegions).size()) return false;
if (preferRegions.stream().filter(p -> p == 0).count() <= 1 && preferRegions.stream().anyMatch(p -> p != 0)) return false;
if (!preferRegions.stream().allMatch(p -> p >= 0 && p <= 25)) return false;
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.moddy.server.controller.model.dto.request;

import com.moddy.server.common.validation.unique_long.UniqueLongElements;
import com.moddy.server.common.validation.year.ValidYear;
import com.moddy.server.common.validation.prefer_regions.ValidPreferRegions;
import com.moddy.server.domain.user.Gender;
Expand Down Expand Up @@ -35,7 +34,6 @@ public record ModelCreateRequest(
boolean isMarketingAgree,
@Schema(description = "모델 회원가입 선호 지역 예시입니다.", example ="[\"3\", \"15\"]")
@ValidPreferRegions
@UniqueLongElements
List<Long> preferRegions
) {
}

0 comments on commit 53847ea

Please sign in to comment.