Skip to content

Commit

Permalink
Merge pull request #25 from CodingWasabi/refactoring-24/dateParsing
Browse files Browse the repository at this point in the history
🌪️[REF]-#24-Party 생성일, 종료일 타입 변경
  • Loading branch information
daehwan2yo authored Dec 28, 2021
2 parents a069173 + 4dc4dea commit f31ac5d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
import java.util.Optional;

public interface CityRepository extends JpaRepository<City, Long> {
Optional<City> findByCity(Location city2);
Optional<City> findByLocation(Location location);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class PartyServiceImpl implements PartyService {
private final PartyRepository partyRepository;
private final MemberInPartyRepository memberInPartyRepository;
private final MemberRepository memberRepository;
private final CityRepository locationRepository;
private final CityRepository cityRepository;

@Override
@Transactional
Expand All @@ -45,8 +45,8 @@ private void setPartyCaptain(Member member, Party party) {

private void setPartyCity(RequestCreatePartyDto requestDto, Party party) {
Location.parseName(requestDto.getLocation());
party.setLocation(locationRepository
.findByCity(Location.parseName(requestDto.getLocation()))
party.setLocation(cityRepository
.findByLocation(Location.parseName(requestDto.getLocation()))
.orElseThrow(() -> new IllegalArgumentException("[ERROR] 도시의 정보가 존재하지 않습니다.")));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.time.LocalDate;

@Entity
@Getter
@Builder
Expand All @@ -25,9 +23,9 @@ public class Party extends Period {

private String imageLink;

private LocalDate startDate;
private String startDate;

private LocalDate endDate;
private String endDate;

private boolean isAgreed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.time.LocalDate;
import java.util.List;

@Getter
Expand All @@ -20,8 +19,8 @@ public Party getEntityFrom() {
return Party.builder()
.title(title)
.imageLink(imageUrl)
.startDate(LocalDate.parse(period[0]))
.endDate(LocalDate.parse(period[1]))
.startDate(period[0])
.endDate(period[1])
.build();
}
}

0 comments on commit f31ac5d

Please sign in to comment.