@@ -450,35 +450,40 @@ class ChallengeController(
450450 return ResponseEntity .ok(response)
451451 }
452452
453- @PostMapping(" /{challengeId}/join/public" )
454- @Operation(summary = " 공개 챌린지 참여하기" , security = [SecurityRequirement (name = ACCESS_TOKEN_KEY )])
453+ @PostMapping(" /{challengeId}/join" )
454+ @Operation(
455+ summary = " 챌린지 참여하기" ,
456+ security = [SecurityRequirement (name = ACCESS_TOKEN_KEY )],
457+ description = " 건너뛰기 시 { \" goal\" : \"\" } 넣어주시면 됩니다." ,
458+ )
455459 @ApiResponse(responseCode = " 200" )
456460 @ApiErrorResponses([TOKEN_UNAUTHENTICATED , TOKEN_UNAUTHORIZED , USER_NOT_FOUND , CHALLENGE_NOT_FOUND , EXISTING_CHALLENGE_MEMBER , CHALLENGE_LIMIT_EXCEED ])
457- fun joinPublicChallenge (
461+ fun joinChallenge (
458462 principal : Principal ,
459463 @PathVariable @Parameter(description = " 챌린지 id" , example = " 1" ) challengeId : Long ,
464+ @RequestBody @Valid request : JoinChallengeRequest ,
460465 ): ResponseEntity <StringSuccessResponse > {
461- challengeService.joinPublicChallenge(UserUtility .getUserId(principal), challengeId)
466+ challengeService.joinChallenge(
467+ UserUtility .getUserId(principal),
468+ challengeId,
469+ request.toServiceDto(),
470+ )
462471
463- return ResponseEntity .ok(StringSuccessResponse (" 공개 챌린지 참여하기가 완료되었습니다." ))
472+ return ResponseEntity .ok(StringSuccessResponse (" 챌린지 참여하기가 완료되었습니다." ))
464473 }
465474
466- @PostMapping (" /{challengeId}/join/private " )
467- @Operation(summary = " 비공개 챌린지 참여하기 " , security = [ SecurityRequirement (name = ACCESS_TOKEN_KEY )] )
475+ @GetMapping (" /{challengeId}/invitation-code-match " )
476+ @Operation(summary = " 챌린지 초대코드 일치 여부 조회 " )
468477 @ApiResponse(responseCode = " 200" )
469- @ApiErrorResponses([TOKEN_UNAUTHENTICATED , TOKEN_UNAUTHORIZED , USER_NOT_FOUND , CHALLENGE_NOT_FOUND , EXISTING_CHALLENGE_MEMBER , CHALLENGE_INVITATION_CODE_INVALID , CHALLENGE_LIMIT_EXCEED ])
470- fun joinPrivateChallenge (
471- principal : Principal ,
478+ @ApiErrorResponses([CHALLENGE_NOT_FOUND ])
479+ fun findChallengeInvitationCodeIsMatch (
472480 @PathVariable @Parameter(description = " 챌린지 id" , example = " 1" ) challengeId : Long ,
473- @RequestBody @Valid request : JoinPrivateChallengeRequest ,
474- ): ResponseEntity <StringSuccessResponse > {
475- challengeService.joinPrivateChallenge(
476- UserUtility .getUserId(principal),
477- challengeId,
478- request.toServiceDto()
479- )
481+ @RequestBody @Valid request : FindChallengeInvitationCodeIsMatchRequest ,
482+ ): ResponseEntity <FindChallengeInvitationCodeIsMatchResponse > {
483+ val isMatch = challengeService.isMatchInvitationCode(challengeId, request.toServiceDto())
484+ val response = FindChallengeInvitationCodeIsMatchResponse .of(isMatch)
480485
481- return ResponseEntity .ok(StringSuccessResponse ( " 비공개 챌린지 참여하기가 완료되었습니다. " ) )
486+ return ResponseEntity .ok(response )
482487 }
483488
484489 @PostMapping(" /{challengeId}/feeds/{feedId}/like" )
0 commit comments