Skip to content

Commit

Permalink
Merge pull request #152 from survey-mate/develop
Browse files Browse the repository at this point in the history
도메인 변경 반영
  • Loading branch information
JinhyeokFang authored Feb 17, 2024
2 parents 640afd2 + 0f993cd commit 2749404
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

@RestController
@RequiredArgsConstructor
@RequestMapping("/auth")
@RequestMapping("/api/auth")
public class AuthController {

private final AuthService authService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import uk.jinhy.survey_mate_api.auth.application.service.AuthService;
import uk.jinhy.survey_mate_api.auth.domain.entity.Member;
import uk.jinhy.survey_mate_api.common.response.ApiResponse;
import uk.jinhy.survey_mate_api.common.response.Status;
import uk.jinhy.survey_mate_api.common.response.exception.GeneralException;
import uk.jinhy.survey_mate_api.data.application.dto.DataServiceDTO;
import uk.jinhy.survey_mate_api.data.application.service.DataService;
import uk.jinhy.survey_mate_api.data.application.service.DataServiceFacade;
Expand All @@ -19,7 +25,7 @@
import uk.jinhy.survey_mate_api.data.presentation.dto.DataControllerDTO;

@RequiredArgsConstructor
@RequestMapping("/data")
@RequestMapping("/api/data")
@RestController
public class DataController {

Expand All @@ -30,9 +36,10 @@ public class DataController {
private final DataConverter converter;

@ResponseStatus(HttpStatus.CREATED)
@PostMapping(value = "", consumes = { "multipart/form-data" })
@PostMapping(value = "", consumes = {"multipart/form-data"})
@Operation(summary = "설문장터 등록")
public ApiResponse<Object> createDataList(@ModelAttribute DataControllerDTO.CreateDataRequestDTO requestDTO) {
public ApiResponse<Object> createDataList(
@ModelAttribute DataControllerDTO.CreateDataRequestDTO requestDTO) {
DataServiceDTO.CreateDataDTO serviceDTO = converter.toServiceCreateDataDto(requestDTO);
Member member = authService.getCurrentMember();

Expand All @@ -44,17 +51,18 @@ public ApiResponse<Object> createDataList(@ModelAttribute DataControllerDTO.Crea
@GetMapping(value = "/{dataId}")
@Operation(summary = "설문장터 상세 조회")
public ApiResponse<DataControllerDTO.DataDetailDTO> getData(
@PathVariable("dataId") Long dataId
@PathVariable("dataId") Long dataId
) {
Data data = dataService.getData(dataId);
Member member = authService.getCurrentMember();

DataControllerDTO.DataDetailDTO responseDTO = converter.toControllerDataDetailDto(data, data.isPurchased(member));
DataControllerDTO.DataDetailDTO responseDTO = converter.toControllerDataDetailDto(data,
data.isPurchased(member));

return ApiResponse.onSuccess(Status.OK.getCode(), Status.OK.getMessage(), responseDTO);
}

@PatchMapping(value = "/{dataId}", consumes = { "multipart/form-data" })
@PatchMapping(value = "/{dataId}", consumes = {"multipart/form-data"})
@Operation(summary = "설문장터 수정")
public ApiResponse<Object> editData(
@ModelAttribute DataControllerDTO.EditDataRequestDTO requestDTO,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import uk.jinhy.survey_mate_api.auth.application.service.AuthService;
import uk.jinhy.survey_mate_api.auth.domain.entity.Member;
import uk.jinhy.survey_mate_api.common.response.ApiResponse;
import uk.jinhy.survey_mate_api.common.response.Status;
import uk.jinhy.survey_mate_api.common.response.exception.GeneralException;
import uk.jinhy.survey_mate_api.statement.application.service.StatementService;
import uk.jinhy.survey_mate_api.statement.domain.entity.Statement;
import uk.jinhy.survey_mate_api.statement.presentation.converter.StatementConverter;
import uk.jinhy.survey_mate_api.statement.presentation.dto.StatementControllerDTO;

@RequiredArgsConstructor
@RequestMapping("/statement")
@RequestMapping("/api/statement")
@RestController
public class StatementController {

Expand All @@ -33,7 +31,8 @@ public ApiResponse<StatementControllerDTO.StatementListDTO> getStatementList() {
Member member = authService.getCurrentMember();

List<Statement> statementList = statementService.getStatementList(member);
StatementControllerDTO.StatementListDTO responseDTO = converter.toControllerStatementListDto(statementList);
StatementControllerDTO.StatementListDTO responseDTO = converter.toControllerStatementListDto(
statementList);

return ApiResponse.onSuccess(Status.OK.getCode(), Status.OK.getMessage(), responseDTO);
}
Expand All @@ -44,7 +43,8 @@ public ApiResponse<StatementControllerDTO.StatementListDTO> getStatementListAsBu
Member member = authService.getCurrentMember();

List<Statement> statementList = statementService.getStatementListAsBuyer(member);
StatementControllerDTO.StatementListDTO responseDTO = converter.toControllerStatementListDto(statementList);
StatementControllerDTO.StatementListDTO responseDTO = converter.toControllerStatementListDto(
statementList);

return ApiResponse.onSuccess(Status.OK.getCode(), Status.OK.getMessage(), responseDTO);
}
Expand All @@ -55,7 +55,8 @@ public ApiResponse<StatementControllerDTO.StatementListDTO> getStatementListAsSe
Member member = authService.getCurrentMember();

List<Statement> statementList = statementService.getStatementListAsSeller(member);
StatementControllerDTO.StatementListDTO responseDTO = converter.toControllerStatementListDto(statementList);
StatementControllerDTO.StatementListDTO responseDTO = converter.toControllerStatementListDto(
statementList);

return ApiResponse.onSuccess(Status.OK.getCode(), Status.OK.getMessage(), responseDTO);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import uk.jinhy.survey_mate_api.survey.presentation.dto.SurveyControllerDTO;

@RequiredArgsConstructor
@RequestMapping("/survey")
@RequestMapping("/api/survey")
@RestController
@PreAuthorize("hasRole('USER')")
public class SurveyController {
Expand Down

0 comments on commit 2749404

Please sign in to comment.