Skip to content

Commit

Permalink
feat #103: add controller
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-yhc committed Oct 5, 2023
1 parent cabe59f commit 7915f1e
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import swm.hkcc.LGTM.app.modules.mission.dto.CreateMissionRequest;
import swm.hkcc.LGTM.app.modules.mission.dto.CreateMissionResponse;
import swm.hkcc.LGTM.app.modules.mission.dto.MissionDetailViewResponse;
import swm.hkcc.LGTM.app.modules.mission.dto.UpdateMissionRequest;
import swm.hkcc.LGTM.app.modules.mission.service.CreateMissionService;
import swm.hkcc.LGTM.app.modules.mission.service.DeleteMissionService;
import swm.hkcc.LGTM.app.modules.mission.service.MissionService;
Expand Down Expand Up @@ -38,6 +39,22 @@ public ApiDataResponse<CreateMissionResponse> createMissinon(
.build());
}

@PatchMapping("/{missionId}")
public ApiDataResponse<CreateMissionResponse> updateMissinon(
@AuthenticationPrincipal CustomUserDetails customUserDetails,
@PathVariable Long missionId,
@Valid @RequestBody UpdateMissionRequest requestBody
) {
Member member = customUserDetails.getMember();

Mission mission = createMissionService.updateMission(member, missionId, requestBody);

return ApiDataResponse.of(CreateMissionResponse.builder()
.missionId(mission.getMissionId())
.writerId(member.getMemberId())
.build());
}

@DeleteMapping("/{missionId}")
public ApiDataResponse<CreateMissionResponse> deleteMissinon(
@AuthenticationPrincipal CustomUserDetails customUserDetails,
Expand Down

0 comments on commit 7915f1e

Please sign in to comment.