diff --git a/src/main/java/com/dduckddak/domain/member/controller/dto/ScrapRequest.java b/src/main/java/com/dduckddak/domain/member/controller/dto/ScrapRequest.java index 32545bd..4bc3b65 100644 --- a/src/main/java/com/dduckddak/domain/member/controller/dto/ScrapRequest.java +++ b/src/main/java/com/dduckddak/domain/member/controller/dto/ScrapRequest.java @@ -13,8 +13,6 @@ public class ScrapRequest { @JsonProperty("town-code") private Long townCode; - @JsonProperty("industry-name") - private String industryName; @JsonProperty("quarter") private Long quarter; private String email; diff --git a/src/main/java/com/dduckddak/domain/member/controller/dto/ScrapResponse.java b/src/main/java/com/dduckddak/domain/member/controller/dto/ScrapResponse.java index f132784..ede2215 100644 --- a/src/main/java/com/dduckddak/domain/member/controller/dto/ScrapResponse.java +++ b/src/main/java/com/dduckddak/domain/member/controller/dto/ScrapResponse.java @@ -10,13 +10,11 @@ public class ScrapResponse { private Long townCode; private String townName; - private String industryName; private Long quarter; - public ScrapResponse(Long townCode, String townName, String industryName, Long quarter) { + public ScrapResponse(Long townCode, String townName, Long quarter) { this.townCode = townCode; this.townName = townName; - this.industryName = industryName; this.quarter = quarter; } } diff --git a/src/main/java/com/dduckddak/domain/member/model/Scrap.java b/src/main/java/com/dduckddak/domain/member/model/Scrap.java index b72002c..c7783b2 100644 --- a/src/main/java/com/dduckddak/domain/member/model/Scrap.java +++ b/src/main/java/com/dduckddak/domain/member/model/Scrap.java @@ -15,7 +15,6 @@ public class Scrap { private Long id; private Long townCode; - private String industryName; private Long quarter; @ManyToOne(fetch = FetchType.LAZY) @@ -24,7 +23,6 @@ public class Scrap { public Scrap(ScrapRequest scrapRequest, Member member) { this.townCode = scrapRequest.getTownCode(); - this.industryName = scrapRequest.getIndustryName(); this.quarter = scrapRequest.getQuarter(); this.member = member; } diff --git a/src/main/java/com/dduckddak/domain/member/repository/ScrapRepository.java b/src/main/java/com/dduckddak/domain/member/repository/ScrapRepository.java index 1b1e568..b08ec56 100644 --- a/src/main/java/com/dduckddak/domain/member/repository/ScrapRepository.java +++ b/src/main/java/com/dduckddak/domain/member/repository/ScrapRepository.java @@ -7,5 +7,5 @@ public interface ScrapRepository extends JpaRepository { Optional findByTownCode(Long code); - boolean existsByTownCodeAndIndustryNameAndQuarter(Long townCode, String industryName, Long quarter); + boolean existsByTownCodeAndQuarter(Long townCode, Long quarter); } diff --git a/src/main/java/com/dduckddak/domain/member/service/ScrapService.java b/src/main/java/com/dduckddak/domain/member/service/ScrapService.java index 3688c30..35f4ecd 100644 --- a/src/main/java/com/dduckddak/domain/member/service/ScrapService.java +++ b/src/main/java/com/dduckddak/domain/member/service/ScrapService.java @@ -31,7 +31,7 @@ public void saveScrap(ScrapRequest scrapRequest) { log.info("ScrapRequest: {}", scrapRequest); Scrap scrap = new Scrap(scrapRequest, member); - if (scrapRepository.existsByTownCodeAndIndustryNameAndQuarter(scrap.getTownCode(), scrap.getIndustryName(), scrap.getQuarter())) { + if (scrapRepository.existsByTownCodeAndQuarter(scrap.getTownCode(), scrap.getQuarter())) { throw new RuntimeException("이미 스크랩한 지역입니다."); } @@ -55,7 +55,7 @@ public List getScrapList(String email) { .map(scrap -> { Town town = townRepository.findByCodeAndQuarter(String.valueOf(scrap.getTownCode()), scrap.getQuarter()) .orElseThrow(() -> new RuntimeException("해당 지역이 존재하지 않습니다.")); - return new ScrapResponse(Long.parseLong(town.getCode()), town.getName(), scrap.getIndustryName(), scrap.getQuarter()); + return new ScrapResponse(Long.parseLong(town.getCode()), town.getName(), scrap.getQuarter()); }) .toList(); }