Skip to content

Commit

Permalink
feat: controller Swagger 연결 (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
gardening-y committed Jan 15, 2024
1 parent 1a676bb commit 252d30b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,34 @@
@RequiredArgsConstructor
@RequestMapping("/api/trips")
@Controller
public class TripApiController {
public class TripApiController implements TripApi {
private final TripService tripService;
private final TripDetailService tripDetailService;

@Override
@PostMapping
public ResponseEntity<BaseResponse<?>> createTrip(@UserId final Long userId,
@RequestBody final TripCreateRequest request) {
final TripCreateResponse response = tripService.createTripAndParticipant(userId, request);
return ApiResponseUtil.success(SuccessMessage.CREATED, response);
}

@Override
@GetMapping
public ResponseEntity<BaseResponse<?>> getTrips(@UserId final Long userId,
@RequestParam final String progress) {
final TripGetResponse response = tripService.getTrips(userId, progress);
return ApiResponseUtil.success(SuccessMessage.OK, response);
}

@Override
@PostMapping("/verify")
public ResponseEntity<BaseResponse<?>> verifyCode(@RequestBody TripVerifyRequest request) {
final TripResponse response = tripService.verifyCode(request);
return ApiResponseUtil.success(SuccessMessage.OK, response);
}

@Override
@PostMapping("/{tripId}/entry")
public ResponseEntity<BaseResponse<?>> entryTrip(@PathVariable final Long tripId,
@UserId final Long userId,
Expand All @@ -50,20 +54,23 @@ public ResponseEntity<BaseResponse<?>> entryTrip(@PathVariable final Long tripId
return ApiResponseUtil.success(SuccessMessage.CREATED, response);
}

@Override
@GetMapping("/{tripId}/my")
public ResponseEntity<BaseResponse<?>> getMyTodoDetail(@UserId final Long userId,
@PathVariable final Long tripId) {
final MyTodoResponse response = tripDetailService.getMyTodoDetail(userId, tripId);
return ApiResponseUtil.success(SuccessMessage.OK, response);
}

@Override
@GetMapping("/{tripId}/our")
public ResponseEntity<BaseResponse<?>> getOurTodoDetail(@UserId final Long userId,
@PathVariable final Long tripId) {
final OurTodoResponse response = tripDetailService.getOurTodoDetail(userId, tripId);
return ApiResponseUtil.success(SuccessMessage.OK, response);
}

@Override
@GetMapping("/{tripId}/participants")
public ResponseEntity<BaseResponse<?>> getParticipants(@UserId final Long userId,
@PathVariable final Long tripId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,54 +22,65 @@
@RequiredArgsConstructor
@RequestMapping("/api/users")
@Controller
public class UserApiController {
public class UserApiController implements UserApi {
private final UserService userService;

@Override
@GetMapping("/splash")
public ResponseEntity<BaseResponse<?>> splash(@UserId final Long userId) {
userService.splash(userId);
return ApiResponseUtil.success(SuccessMessage.OK);
}

@Override

@PostMapping("/signin")
public ResponseEntity<BaseResponse<?>> signIn(@RequestHeader(AUTHORIZATION) final String token,
@RequestBody final UserSignInRequest request) {
final UserSignInResponse response = userService.signIn(token, request);
return ApiResponseUtil.success(SuccessMessage.OK, response);
}

@Override

@PostMapping("/signup")
public ResponseEntity<BaseResponse<?>> signUp(@RequestHeader(AUTHORIZATION) final String token,
@RequestBody final UserSignUpRequest request) {
final UserSignUpResponse response = userService.signUp(token, request);
return ApiResponseUtil.success(SuccessMessage.CREATED, response);
}

@Override
@PatchMapping("/signout")
public ResponseEntity<BaseResponse<?>> signOut(@UserId final Long userId) {
userService.signOut(userId);
return ApiResponseUtil.success(SuccessMessage.OK);
}

@Override

@DeleteMapping("/withdraw")
public ResponseEntity<BaseResponse<?>> withdraw(@UserId final Long userId) {
userService.withdraw(userId);
return ApiResponseUtil.success(SuccessMessage.OK);
}

@Override
@PostMapping("/reissue")
public ResponseEntity<BaseResponse<?>> reissue(@RequestHeader(AUTHORIZATION) final String refreshtoken,
@RequestBody final UserReissueRequest request) {
final UserSignUpResponse response = userService.reissue(refreshtoken, request);
return ApiResponseUtil.success(SuccessMessage.OK, response);
}

@Override
@GetMapping("/profile")
public ResponseEntity<BaseResponse<?>> getProfile(@UserId final Long userId) {
final ProfileGetResponse response = userService.getProfile(userId);
return ApiResponseUtil.success(SuccessMessage.OK, response);
}

@Override
@PatchMapping("/test")
public ResponseEntity<BaseResponse<?>> updateResult(@UserId final Long userId,
@RequestBody final ResultUpdateRequest request) {
Expand Down

0 comments on commit 252d30b

Please sign in to comment.