Skip to content

Commit

Permalink
Merge pull request #227 from swm-nodriversomabus/BUS-225-MVP2-API-test
Browse files Browse the repository at this point in the history
hotfix(BE): 숙소 매칭 등록 안됨 BUS-225-MVP2-API-test
  • Loading branch information
Lemonade255 authored Nov 22, 2023
2 parents fc7df82 + 41f392d commit 0f2b242
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class MatchingController {
*/
@Operation(summary = "Create matching", description = "새로운 매칭을 생성한다.")
@PostMapping("/matching")
public FindMatchingDto createMatching(@Valid @RequestBody SaveMatchingDto saveMatchingDto, @Valid @RequestBody(required = false) AccommodationDto accommodationDto) {
public FindMatchingDto createMatching(@Valid @RequestBody SaveMatchingDto saveMatchingDto) {
SecurityUser securityUser = AuthenticationUtils.getCurrentUserAuthentication();
if (securityUser == null) {
log.error("MatchingController::createMatching: Login is needed");
Expand Down Expand Up @@ -86,10 +86,12 @@ public FindMatchingDto createMatching(@Valid @RequestBody SaveMatchingDto saveMa
matchingApplicationUsecase.createMatchingApplicationData(securityUser.getUserId(), saveMatchingApplicationDto);

if (saveMatchingDto.getType().equals(MatchingTypeEnum.Accommodation)) {
if (accommodationDto == null) {
log.error("MatchingController::createMatching: Accommodation data not found");
throw new CustomException(ErrorCodeEnum.ACCOMMODATION_NOT_FOUND);
}
AccommodationDto accommodationDto = AccommodationDto.builder()
.matchingId(findMatchingDto.getMatchingId())
.price(saveMatchingDto.getPrice())
.pricePerOne(saveMatchingDto.getPricePerOne())
.room(saveMatchingDto.getRoom())
.build();
accommodationUsecase.createAccommodation(findMatchingDto.getMatchingId(), accommodationDto);
}
return findMatchingDto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ public class SaveMatchingDto {
@Min(0)
private Integer plusAge;

// @Min(0)
private Integer price;

// @Min(0)
private Integer pricePerOne;

private String room;

@NotNull
@Min(0)
private Integer readCount;
Expand Down

0 comments on commit 0f2b242

Please sign in to comment.