Skip to content

Commit

Permalink
#220 [refactor] git conflict 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
hellozo0 committed Feb 4, 2024
2 parents 15f2a88 + f2a85ac commit 1973100
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.moddy.server.controller.model;

import com.moddy.server.common.dto.ErrorResponse;
import com.moddy.server.common.dto.SuccessNonDataResponse;
import com.moddy.server.common.dto.SuccessResponse;
import com.moddy.server.common.exception.enums.SuccessCode;
import com.moddy.server.config.resolver.user.UserId;
Expand All @@ -27,7 +26,6 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
Expand Down Expand Up @@ -83,23 +81,6 @@ public SuccessResponse<OpenChatResponse> getOpenChat(
return SuccessResponse.success(SuccessCode.OPEN_CHAT_GET_SUCCESS, hairServiceOfferRetrieveService.getOpenChatInfo(userId, offerId));
}

@Tag(name = "ModelController")
@Operation(summary = "[JWT] 디자이너 제안서 승낙하기", description = "디자이너 제안서 승낙하기 API입니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "디자이너 제안서 승낙하기"),
@ApiResponse(responseCode = "401", description = "인증 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "404", description = "제안서 아이디가 존재하지 않습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
})
@PutMapping("/model/offer/{offerId}")
@SecurityRequirement(name = "JWT Auth")
public SuccessNonDataResponse acceptOffer(
@Parameter(hidden = true) @UserId Long userId,
@Parameter(name = "offerId", description = "제안서아이디") @PathVariable(value = "offerId") Long offerId) {
modelService.updateOfferAgreeStatus(offerId);
return SuccessNonDataResponse.success(SuccessCode.OFFER_ACCEPT_SUCCESS);
}

@Tag(name = "ModelController")
@Operation(summary = "[JWT] 모델 지원서 최종 확인 시 유저 정보 조회 API", description = "[모델 뷰] 모델 지원서 최종 확인 시 유저 정보 조회 API 입니다.")
@ApiResponses({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.moddy.server.controller.offer;

import com.moddy.server.common.dto.ErrorResponse;
import com.moddy.server.common.dto.SuccessNonDataResponse;
import com.moddy.server.common.dto.SuccessResponse;
import com.moddy.server.common.exception.enums.SuccessCode;
import com.moddy.server.config.resolver.user.UserId;
import com.moddy.server.controller.offer.dto.response.ModelMainOfferResponse;
import com.moddy.server.controller.offer.response.DetailOfferResponse;
import com.moddy.server.service.offer.HairServiceOfferRegisterService;
import com.moddy.server.service.offer.HairServiceOfferRetrieveService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
Expand All @@ -18,6 +20,7 @@
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

Expand All @@ -26,6 +29,24 @@
public class OfferController {

private final HairServiceOfferRetrieveService hairServiceOfferRetrieveService;
private final HairServiceOfferRegisterService hairServiceOfferRegisterService;

@Tag(name = "ModelController")
@Operation(summary = "[JWT] 디자이너 제안서 승낙하기", description = "디자이너 제안서 승낙하기 API입니다.")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "디자이너 제안서 승낙하기"),
@ApiResponse(responseCode = "401", description = "인증 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "404", description = "제안서 아이디가 존재하지 않습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "500", description = "서버 내부 오류 입니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
})
@PutMapping("/model/offer/{offerId}")
@SecurityRequirement(name = "JWT Auth")
public SuccessNonDataResponse acceptOffer(
@Parameter(hidden = true) @UserId Long userId,
@Parameter(name = "offerId", description = "제안서아이디") @PathVariable(value = "offerId") Long offerId) {
hairServiceOfferRegisterService.updateOfferAgreeStatus(offerId);
return SuccessNonDataResponse.success(SuccessCode.OFFER_ACCEPT_SUCCESS);
}

@Tag(name = "ModelController")
@Operation(summary = "[JWT] 모델 메인 뷰 조회", description = "모델 메인 뷰 조회 API입니다.")
Expand Down Expand Up @@ -58,5 +79,4 @@ public SuccessResponse<DetailOfferResponse> getModelDetailOfferInfo(
@Parameter(name = "offerId", description = "제안서아이디") @PathVariable(value = "offerId") Long offerId) {
return SuccessResponse.success(SuccessCode.FIND_MODEL_DETAIL_OFFER_SUCCESS, hairServiceOfferRetrieveService.getOfferDetail(modelId, offerId));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public class HairServiceOffer extends BaseTimeEntity {
@NotNull
private Boolean isClicked;

public void setIsModelAgree(final Boolean isModelAgree){
this.isModelAgree = isModelAgree;
public void agreeOfferToModel(){
this.isModelAgree = true;
}

public void updateClickStatus() { this.isClicked = true; }
Expand Down
10 changes: 0 additions & 10 deletions src/main/java/com/moddy/server/service/model/ModelService.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import com.moddy.server.common.exception.enums.ErrorCode;
import com.moddy.server.common.exception.model.NotFoundException;
import com.moddy.server.controller.model.dto.response.ApplicationUserDetailResponse;
import com.moddy.server.domain.hair_service_offer.HairServiceOffer;
import com.moddy.server.domain.hair_service_offer.repository.HairServiceOfferJpaRepository;
import com.moddy.server.domain.model.Model;
import com.moddy.server.domain.model.repository.ModelJpaRepository;
import com.moddy.server.domain.prefer_region.repository.PreferRegionJpaRepository;
Expand All @@ -20,16 +18,8 @@
public class ModelService {

private final ModelJpaRepository modelJpaRepository;
private final HairServiceOfferJpaRepository hairServiceOfferJpaRepository;
private final PreferRegionJpaRepository preferRegionJpaRepository;

@Transactional
public void updateOfferAgreeStatus(Long offerId) {
HairServiceOffer hairServiceOffer = hairServiceOfferJpaRepository.findById(offerId).orElseThrow(() -> new NotFoundException(ErrorCode.NOT_FOUND_OFFER_EXCEPTION));

hairServiceOffer.setIsModelAgree(true);
}

public ApplicationUserDetailResponse getUserDetailInApplication(final Long userId) {
Model model = modelJpaRepository.findById(userId).orElseThrow(() -> new NotFoundException(ErrorCode.NOT_FOUND_MODEL_INFO));
List<String> preferRegions = preferRegionJpaRepository.findAllByModelId(model.getId())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.moddy.server.service.offer;

import com.moddy.server.common.exception.enums.ErrorCode;
import com.moddy.server.common.exception.model.NotFoundException;
import com.moddy.server.domain.hair_service_offer.HairServiceOffer;
import com.moddy.server.domain.hair_service_offer.repository.HairServiceOfferJpaRepository;
import com.moddy.server.domain.prefer_offer_condition.repository.PreferOfferConditionJpaRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

Expand All @@ -29,4 +32,11 @@ public void deleteDesignerHairServiceOfferInfos(final Long designerId) {
hairServiceOfferJpaRepository.deleteById(hairServiceOffer.getId());
});
}

@Transactional
public void updateOfferAgreeStatus(final Long offerId) {
HairServiceOffer hairServiceOffer = hairServiceOfferJpaRepository.findById(offerId).orElseThrow(() -> new NotFoundException(ErrorCode.NOT_FOUND_OFFER_EXCEPTION));

hairServiceOffer.agreeOfferToModel();
}
}

0 comments on commit 1973100

Please sign in to comment.