diff --git a/src/main/kotlin/com/psr/psr/cs/controller/CsController.kt b/src/main/kotlin/com/psr/psr/cs/controller/CsController.kt index 0b7ea6b..83d4562 100644 --- a/src/main/kotlin/com/psr/psr/cs/controller/CsController.kt +++ b/src/main/kotlin/com/psr/psr/cs/controller/CsController.kt @@ -7,6 +7,9 @@ import com.psr.psr.cs.dto.response.NoticeRes import com.psr.psr.cs.service.CsService import com.psr.psr.global.dto.BaseResponse import io.swagger.v3.oas.annotations.Operation +import io.swagger.v3.oas.annotations.Parameter +import io.swagger.v3.oas.annotations.media.Content +import io.swagger.v3.oas.annotations.media.Schema import io.swagger.v3.oas.annotations.responses.ApiResponse import io.swagger.v3.oas.annotations.responses.ApiResponses import io.swagger.v3.oas.annotations.security.SecurityRequirement @@ -23,6 +26,11 @@ class CsController( /** * 공지사항 메인 */ + @Operation(summary = "공지사항 메인(장채은)", description = "공지사항 리스트를 확인한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다.")] + ) @GetMapping("/notices") fun getNotices(): BaseResponse{ return BaseResponse(csService.getNotices()) @@ -31,24 +39,59 @@ class CsController( /** * 공지사항 상세 */ + @Operation(summary = "공지사항 상세(장채은)", description = "공지사항 상세를 확인한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "404", + description = "해당 공지사항를 찾을 수 없습니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + ) ] + ) @GetMapping("/notices/{noticeId}") - fun getNotice(@PathVariable(name = "noticeId") noticeId: Long): BaseResponse{ + fun getNotice( + @Parameter(description = "(Long) 공지사항 Id", example = "1") @PathVariable(name = "noticeId") noticeId: Long): BaseResponse{ return BaseResponse(csService.getNotice(noticeId)) } /** * 자주 묻는 질문 메인 */ + @Operation(summary = "자주 묻는 질문 메인(장채은)", description = "자주 묻는 질문 리스트를 확인한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "올바르지 않은 FAQ 카테고리입니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + ) + ] + ) @GetMapping("/faqs") - fun getFaqs(@RequestParam(value = "type", required = false) type: String?): BaseResponse{ + fun getFaqs( + @Parameter(description = "(String) 자주 묻는 질문 타입 (계정관리/컨설팅/상품)", example = "계정관리") @RequestParam(value = "type", required = false) type: String?): BaseResponse{ return BaseResponse(csService.getFaqs(type)) } /** * 자주 묻는 질문 상세 */ + @Operation(summary = "자주 묻는 질문 상세(장채은)", description = "자주 묻는 질문 상세를 확인한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "404", + description = "해당 FAQ를 찾을 수 없습니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + ) + ] + ) @GetMapping("/faqs/{faqId}") - fun getFaq(@PathVariable(name = "faqId") faqId: Long): BaseResponse{ + fun getFaq( + @Parameter(description = "(Long) 자주 묻는 질문 Id", example = "1") @PathVariable(name = "faqId") faqId: Long): BaseResponse{ return BaseResponse(csService.getFaq(faqId)) } diff --git a/src/main/kotlin/com/psr/psr/cs/dto/response/FaqListRes.kt b/src/main/kotlin/com/psr/psr/cs/dto/response/FaqListRes.kt index 67e921d..4c44859 100644 --- a/src/main/kotlin/com/psr/psr/cs/dto/response/FaqListRes.kt +++ b/src/main/kotlin/com/psr/psr/cs/dto/response/FaqListRes.kt @@ -1,9 +1,11 @@ package com.psr.psr.cs.dto.response import com.psr.psr.cs.entity.Faq +import io.swagger.v3.oas.annotations.media.Schema import java.util.stream.Collectors data class FaqListRes ( + @Schema(description = "자주 묻는 질문 리스트") val faqLists: List? ){ companion object{ diff --git a/src/main/kotlin/com/psr/psr/cs/dto/response/FaqRes.kt b/src/main/kotlin/com/psr/psr/cs/dto/response/FaqRes.kt index cf1fdda..40a15cb 100644 --- a/src/main/kotlin/com/psr/psr/cs/dto/response/FaqRes.kt +++ b/src/main/kotlin/com/psr/psr/cs/dto/response/FaqRes.kt @@ -2,12 +2,17 @@ package com.psr.psr.cs.dto.response import com.fasterxml.jackson.annotation.JsonInclude import com.psr.psr.cs.entity.Faq +import io.swagger.v3.oas.annotations.media.Schema data class FaqRes ( + @Schema(type = "Long", description = "자주 묻는 질문 id", example = "1") val faqId: Long, + @Schema(type = "String", description = "자주 묻는 질문 타입", example = "계정관리", allowableValues = ["계정관리", "컨설팅", "상품"]) val type: String, + @Schema(type = "String", description = "자주 묻는 질문 제목", example = "로그아웃이 안돼요.") val title: String, @JsonInclude(JsonInclude.Include.NON_NULL) + @Schema(type = "String", description = "자주 묻는 질문 내용", example = "설정에 들어가면 됩니다.") val content: String?= null, ){ companion object{ diff --git a/src/main/kotlin/com/psr/psr/global/exception/BaseResponseCode.kt b/src/main/kotlin/com/psr/psr/global/exception/BaseResponseCode.kt index 1bf2408..b31cdda 100644 --- a/src/main/kotlin/com/psr/psr/global/exception/BaseResponseCode.kt +++ b/src/main/kotlin/com/psr/psr/global/exception/BaseResponseCode.kt @@ -19,10 +19,10 @@ enum class BaseResponseCode(status: HttpStatus, message: String) { BLACKLIST_TOKEN(HttpStatus.FORBIDDEN, "로그아웃 혹은 회원 탈퇴된 유저의 토큰 값입니다."), // user - EXISTS_PHONE(HttpStatus.BAD_REQUEST, "이미 가입되어 있는 휴대폰 번호입니다."), - EXISTS_EMAIL(HttpStatus.BAD_REQUEST, "이미 가입되어 있는 이메일입니다."), + EXISTS_PHONE(HttpStatus.CONFLICT, "이미 가입되어 있는 휴대폰 번호입니다."), + EXISTS_EMAIL(HttpStatus.CONFLICT, "이미 가입되어 있는 이메일입니다."), EXISTS_MANAGER(HttpStatus.BAD_REQUEST, "관리자는 한 명만 가능합니다."), - EXISTS_NICKNAME(HttpStatus.BAD_REQUEST, "이미 가입되어 있는 닉네임입니다."), + EXISTS_NICKNAME(HttpStatus.CONFLICT, "이미 가입되어 있는 닉네임입니다."), NOT_EXIST_EMAIL(HttpStatus.BAD_REQUEST, "해당 이메일로 가입한 사용자를 찾을 수 없습니다."), INVALID_PASSWORD(HttpStatus.BAD_REQUEST, "사용자의 비밀번호가 일치하지 않습니다."), NOT_FOUND_USER(HttpStatus.NOT_FOUND, "사용자를 찾을 수 없습니다."), @@ -34,8 +34,8 @@ enum class BaseResponseCode(status: HttpStatus, message: String) { INVALID_EID(HttpStatus.BAD_REQUEST, "정상 사업자가 아닙니다. (휴업자 or 폐업자)"), DUPLICATE_PASSWORD(HttpStatus.BAD_REQUEST, "사용자의 비밀번호와 변경하려는 비밀번호가 동일합니다."), PHONE_ERROR(HttpStatus.BAD_REQUEST, "naver SMS API 관련 에러입니다."), - BLACKLIST_PHONE(HttpStatus.BAD_REQUEST, "SMS 인증코드 유효 시간이 만료되었습니다."), - INVALID_SMS_KEY(HttpStatus.BAD_REQUEST, "SMS 인증코드가 알맞지 않습니다. "), + BLACKLIST_PHONE(HttpStatus.FORBIDDEN, "SMS 인증코드 유효 시간이 만료되었습니다."), + INVALID_SMS_KEY(HttpStatus.BAD_REQUEST, "SMS 인증코드가 알맞지 않습니다."), // User - type INVALID_USER_TYPE_NAME(HttpStatus.BAD_REQUEST, "올바르지 않은 사용자 역할입니다."), @@ -43,13 +43,13 @@ enum class BaseResponseCode(status: HttpStatus, message: String) { INVALID_USER_CATEGORY(HttpStatus.BAD_REQUEST, "올바르지 않은 사용자 카테고리입니다."), // User - category - INVALID_USER_INTEREST_COUNT(HttpStatus.BAD_REQUEST, "사용자 관심 주제는 1개이상, 3개 이하여야하며, 중복된 값이 포함되어 있지 않아야 합니다"), + INVALID_USER_INTEREST_COUNT(HttpStatus.BAD_REQUEST, "사용자 관심 주제는 1개이상, 3개 이하여야하며, 중복된 값이 포함되어 있지 않아야 합니다."), // CS - notices NOT_FOUND_NOTICE(HttpStatus.NOT_FOUND, "해당 공지사항를 찾을 수 없습니다."), // CS - faqs - INVALID_FAQ_TYPE_NAME(HttpStatus.NOT_FOUND, "올바르지 않은 FAQ 카테고리입니다. "), + INVALID_FAQ_TYPE_NAME(HttpStatus.BAD_REQUEST, "올바르지 않은 FAQ 카테고리입니다."), NOT_FOUND_FAQ(HttpStatus.NOT_FOUND, "해당 FAQ를 찾을 수 없습니다."), // report diff --git a/src/main/kotlin/com/psr/psr/global/jwt/dto/TokenDto.kt b/src/main/kotlin/com/psr/psr/global/jwt/dto/TokenDto.kt index a3f2d4a..653d9e5 100644 --- a/src/main/kotlin/com/psr/psr/global/jwt/dto/TokenDto.kt +++ b/src/main/kotlin/com/psr/psr/global/jwt/dto/TokenDto.kt @@ -1,13 +1,17 @@ package com.psr.psr.global.jwt.dto import com.psr.psr.global.Constant +import io.swagger.v3.oas.annotations.media.Schema import org.jetbrains.annotations.NotNull data class TokenDto( @field:NotNull + @Schema(type = "String", description = "AccessToken", required = true, example = "bearer eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2OTY3NTg2OTcsInVzZXJJZHgiOjEsInN1YiI6IjEifQ.DSBuBlStkjhT05vuzjWd-cg7naG5KikUxII734u3nUw") var accessToken: String, @field:NotNull + @Schema(type = "String", description = "AccessToken", required = true, example = "bearer eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2OTY3NTg2OTcsInVzZXJJZHgiOjEsInN1YiI6IjEifQ.DSBuBlStkjhT05vuzjWd-cg7naG5KikUxII734u3nUw") var refreshToken: String, + @Schema(type = "String", description = "역할", example = "일반", allowableValues = ["일반", "사업자", "쇼호스트", "관리자"]) val type: String ?= null ){ companion object{ diff --git a/src/main/kotlin/com/psr/psr/user/controller/UserController.kt b/src/main/kotlin/com/psr/psr/user/controller/UserController.kt index ca38a3c..5a09c95 100644 --- a/src/main/kotlin/com/psr/psr/user/controller/UserController.kt +++ b/src/main/kotlin/com/psr/psr/user/controller/UserController.kt @@ -13,6 +13,11 @@ import com.psr.psr.user.dto.response.EmailRes import com.psr.psr.user.dto.response.MyPageInfoRes import com.psr.psr.user.dto.response.ProfileRes import com.psr.psr.user.service.UserService +import io.swagger.v3.oas.annotations.Operation +import io.swagger.v3.oas.annotations.media.Content +import io.swagger.v3.oas.annotations.media.Schema +import io.swagger.v3.oas.annotations.responses.ApiResponse +import io.swagger.v3.oas.annotations.responses.ApiResponses import io.swagger.v3.oas.annotations.security.SecurityRequirement import io.swagger.v3.oas.annotations.tags.Tag import jakarta.servlet.http.HttpServletRequest @@ -31,6 +36,32 @@ class UserController( /** * 회원가입 */ + @Operation(summary = "[토큰 X] 회원가입(장채은)", description = "회원가입을 한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "올바르지 않은 이메일 형식입니다.
" + + "비밀번호를 숫자, 문자, 특수문자 포함 8~15자리 이내로 입력해주세요.
" + + "올바르지 않은 휴대폰 형식입니다.
" + + "사용자 관심 주제는 1개이상, 3개 이하여야하며, 중복된 값이 포함되어 있지 않아야 합니다
" + + "닉네임은 한글, 영어, 숫자만 입력해주세요. (10글자)
" + + "사업자 정보를 입력해주세요.
" + + "관리자는 한 명만 가능합니다.
" + + "올바르지 않은 사용자 역할니다.
" + + "올바르지 않은 상품 카테고리입니다.
" + + "variable + 을(를) 입력해주세요.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + ), + ApiResponse( + responseCode = "409", + description = "이미 가입되어 있는 닉네임입니다.
" + + "이미 가입되어 있는 이메일입니다.
" + + "이미 가입되어 있는 휴대폰 번호입니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PostMapping("/signup") fun signUp (@RequestBody @Validated signUpReq: SignUpReq) : BaseResponse{ return BaseResponse(userService.signUp(signUpReq)) @@ -39,6 +70,21 @@ class UserController( /** * 로그인 */ + @Operation(summary = "[토큰 X] 로그인(장채은)", description = "로그인을 한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "올바르지 않은 이메일 형식입니다.
" + + "비밀번호를 숫자, 문자, 특수문자 포함 8~15자리 이내로 입력해주세요.
" + + "올바르지 않은 휴대폰 형식입니다.
" + + "해당 이메일로 가입한 사용자를 찾을 수 없습니다.
" + + "사용자의 비밀번호가 일치하지 않습니다.
" + + "variable + 을(를) 입력해주세요.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PostMapping("/login") fun login (@RequestBody @Validated loginReq: LoginReq) : BaseResponse{ return BaseResponse(userService.login(loginReq)) @@ -47,6 +93,17 @@ class UserController( /** * 닉네임 중복 */ + @Operation(summary = "[토큰 X] 닉네임 중복 확인 (장채은)", description = "닉네임 중복을 확인 한다. 사용 가능 : True, 사용 불가 : False") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "닉네임은 한글, 영어, 숫자만 입력해주세요. (10글자)
" + + "variable + 을(를) 입력해주세요.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PostMapping("/nickname") fun checkDuplicateNickname (@RequestBody @Validated nicknameReq: CheckNicknameReq) : BaseResponse{ // 사용 가능 : True, 사용 불가 : False @@ -54,8 +111,13 @@ class UserController( } /** - * 사용자 프로필 불러오기 + * 사용자 프로필 조회 */ + @Operation(summary = "사용자 프로필 조회 (장채은)", description = "사용자 프로필을 불러온다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다.")] + ) @GetMapping("/profile") fun getProfile(@AuthenticationPrincipal userAccount: UserAccount) : BaseResponse{ return BaseResponse(userService.getProfile(userAccount.getUser())) @@ -64,6 +126,17 @@ class UserController( /** * 사용자 프로필 변경하기 */ + @Operation(summary = "사용자 프로필 변경 (장채은)", description = "사용자 프로필을 변경한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "409", + description = "이미 가입되어 있는 닉네임입니다.
" + + "variable + 을(를) 입력해주세요.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PatchMapping("/profile") fun patchProfile(@AuthenticationPrincipal userAccount: UserAccount, @RequestBody @Validated profileReq: ProfileReq) : BaseResponse { userService.patchProfile(userAccount.getUser(), profileReq) @@ -73,6 +146,11 @@ class UserController( /** * 로그아웃 */ + @Operation(summary = "로그아웃 (장채은)", description = "로그아웃을 한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다.")] + ) @PatchMapping("/logout") fun logout(@AuthenticationPrincipal userAccount: UserAccount, request: HttpServletRequest) : BaseResponse { userService.blackListToken(userAccount.getUser(), request, LOGOUT) @@ -82,6 +160,11 @@ class UserController( /** * 회원 탈퇴 */ + @Operation(summary = "회원탈퇴 (장채은)", description = "회원 탈퇴를 한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다.")] + ) @DeleteMapping("/signout") fun signOut(@AuthenticationPrincipal userAccount: UserAccount, request: HttpServletRequest) : BaseResponse { userService.blackListToken(userAccount.getUser(), request, INACTIVE_STATUS) @@ -92,8 +175,25 @@ class UserController( /** * 사업자 등록 번호 인증 */ + @Operation(summary = "[토큰 X] 사업자 등록 번호 인증 (장채은)", description = "사업자 등록 번호를 인증한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "variable + 을(를) 입력해주세요.
" + + "정상 사업자가 아닙니다. (휴업자 or 폐업자)", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + ), + ApiResponse( + responseCode = "404", + description = "사업자를 찾을 수 없습니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PostMapping("/eid") fun validateEid(@RequestBody @Validated userEidReq: UserEidReq) : BaseResponse { + // todo: 이미 가입되어 있는 사업자인지 질문 필요 userService.validateEid(userEidReq) return BaseResponse(true) } @@ -101,6 +201,11 @@ class UserController( /** * 마이페이지 내 정보 화면 */ + @Operation(summary = "마이페이지 정보 확인 (장채은)", description = "마이페이지 내 정보를 확인한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다.")] + ) @GetMapping("/mypage") fun getMyPageInfo(@AuthenticationPrincipal userAccount: UserAccount) : BaseResponse{ return BaseResponse(userService.getMyPageInfo(userAccount.getUser())) @@ -109,6 +214,21 @@ class UserController( /** * 토큰 재발급 */ + @Operation(summary = "[토큰 X] 토큰 재발급 (장채은)", description = "토큰을 재발급한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "401", + description = "유효하지 않은 토큰 값입니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + ), + ApiResponse( + responseCode = "404", + description = "사용자를 찾을 수 없습니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PostMapping("/reissue") fun reissueToken(@RequestBody @Validated tokenDto: TokenDto) : BaseResponse{ return BaseResponse(userService.reissueToken(tokenDto)) @@ -117,6 +237,19 @@ class UserController( /** * 비밀번호 변경화면 with Token */ + @Operation(summary = "비밀번호 변경 - Token (장채은)", description = "토큰을 헤더에 넣어 비밀번호를 변경한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "사용자의 비밀번호가 일치하지 않습니다.
" + + "사용자의 비밀번호와 변경하려는 비밀번호가 동일합니다.
" + + "비밀번호를 숫자, 문자, 특수문자 포함 8~15자리 이내로 입력해주세요.
" + + "variable + 을(를) 입력해주세요.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PatchMapping("/password-change") fun changePassword(@AuthenticationPrincipal userAccount: UserAccount, @RequestBody @Validated passwordReq: ChangePasswordReq) : BaseResponse{ userService.changePassword(userAccount.getUser(), passwordReq) @@ -126,6 +259,18 @@ class UserController( /** * 비밀번호 재설정 except Token */ + @Operation(summary = "[토큰 X] 비밀번호 재설정 (장채은)", description = "비밀번호를 재설정한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "해당 이메일로 가입한 사용자를 찾을 수 없습니다.
" + + "사용자의 휴대폰 번호와 일치하지 않습니다.
" + + "사용자의 비밀번호와 변경하려는 비밀번호가 동일합니다.
", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PatchMapping("/password-reset") fun resetPassword(@RequestBody @Validated resetPasswordReq: ResetPasswordReq) : BaseResponse{ userService.resetPassword(resetPasswordReq) @@ -135,6 +280,17 @@ class UserController( /** * 관심 목록 변경 */ + @Operation(summary = "관심 목록 변경 (장채은)", description = "관심 목록을 변경한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "사용자 관심 주제는 1개이상, 3개 이하여야하며, 중복된 값이 포함되어 있지 않아야 합니다
" + + "올바르지 않은 상품 카테고리입니다.
", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PatchMapping("/watchlist") fun patchWatchLists(@AuthenticationPrincipal userAccount: UserAccount, @RequestBody @Validated userInterestListReq: UserInterestListDto) : BaseResponse{ userService.patchWatchLists(userAccount.getUser(), userInterestListReq) @@ -144,6 +300,11 @@ class UserController( /** * 관심 목록 조회 */ + @Operation(summary = "관심 목록 조회 (장채은)", description = "관심 목록을 조회한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다.")] + ) @GetMapping("/watchlist") fun getWatchList(@AuthenticationPrincipal userAccount: UserAccount) : BaseResponse{ return BaseResponse(userService.getWatchList(userAccount.getUser())) @@ -152,55 +313,129 @@ class UserController( /** * 휴대폰번호 전송 */ + @Operation(summary = "[토큰 X] 휴대폰 번호 전송 (장채은)", description = "휴대폰 번호를 전송하여 인증 코드를 확인한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "naver SMS API 관련 에러입니다.
", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PostMapping("/phone/check") - fun checkValidPhone(@RequestBody @Validated validPhoneReq: ValidPhoneReq) : BaseResponse{ - userService.checkValidPhone(validPhoneReq) + fun checkValidPhone(@RequestBody @Validated sendSmsReq: SendSmsReq) : BaseResponse{ + userService.checkValidPhone(sendSmsReq) return BaseResponse(BaseResponseCode.SUCCESS) } /** * 회원가입을 위한 휴대폰번호 전송 */ + @Operation(summary = "[토큰 X] 회원가입 휴대폰 번호 전송 (장채은)", description = "회원가입을 위해 휴대폰 번호를 전송하여 인증 코드를 확인한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "naver SMS API 관련 에러입니다.
" + + "이미 가입되어 있는 휴대폰 번호입니다.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PostMapping("/phone/check/signup") - fun checkValidPhoneForSignUp(@RequestBody @Validated validPhoneReq: ValidPhoneReq) : BaseResponse{ + fun checkValidPhoneForSignUp(@RequestBody @Validated sendSmsReq: SendSmsReq) : BaseResponse{ // 이미 있는 휴대폰 번호인지 확인 - if(userService.checkDuplicatePhone(validPhoneReq.phone)) throw BaseException(BaseResponseCode.EXISTS_PHONE) + if(userService.checkDuplicatePhone(sendSmsReq.phone)) throw BaseException(BaseResponseCode.EXISTS_PHONE) // 휴대폰 번호 전송 - userService.checkValidPhone(validPhoneReq) + userService.checkValidPhone(sendSmsReq) return BaseResponse(BaseResponseCode.SUCCESS) } /** * 휴대폰 인증번호 조회 */ + @Operation(summary = "[토큰 X] 휴대폰 번호 인증번호 조회 (장채은)", description = "인증코드를 확인하여 일치하는지 확인한다. 유효기간은 5분이다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "SMS 인증코드가 알맞지 않습니다.
", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + ),ApiResponse( + responseCode = "403", + description = "SMS 인증코드 유효 시간이 만료되었습니다.
", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PostMapping("/phone/validation") fun checkValidSmsKey(@RequestBody @Validated validPhoneReq: ValidPhoneReq) : BaseResponse{ - userService.checkValidSmsKey(validPhoneReq.phone, validPhoneReq.smsKey!!) + userService.checkValidSmsKey(validPhoneReq.phone, validPhoneReq.smsKey) return BaseResponse(BaseResponseCode.SUCCESS) } /** * 아이디 + 인증번호 조회 */ + @Operation(summary = "[토큰 X] 아이디 찾기를 위한 인증번호 조회 (장채은)", description = "휴대폰 번호로 휴대폰 인증번호 일치를 조회한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "SMS 인증코드가 알맞지 않습니다.
" + + "사용자를 찾을 수 없습니다.
" + + "올바르지 않은 휴대폰 형식입니다.
" + + "variable + 을(를) 입력해주세요.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + ),ApiResponse( + responseCode = "403", + description = "SMS 인증코드 유효 시간이 만료되었습니다.
", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PostMapping("/email/search") - fun findEmailSearch(@RequestBody @Validated findIdPwReq: FindIdPwReq): BaseResponse{ - if(!StringUtils.hasText(findIdPwReq.name)) throw BaseException(BaseResponseCode.NOT_EMPTY_NAME) - return BaseResponse(userService.findEmailSearch(findIdPwReq)) + fun findEmailSearch(@RequestBody @Validated findIdReq: FindIdReq): BaseResponse{ + return BaseResponse(userService.findEmailSearch(findIdReq)) } /** * 비밀번호 변경 + 인증번호 조회 */ + @Operation(summary = "[토큰 X] 비밀번호 재설정을 위한 인증번호 조회 (장채은)", description = "이메일 + 휴대폰 번호로 휴대폰 인증번호 일치를 조회한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다."), + ApiResponse( + responseCode = "400", + description = "SMS 인증코드가 알맞지 않습니다.
" + + "사용자를 찾을 수 없습니다.
" + + "올바르지 않은 휴대폰 형식입니다.
" + + "올바르지 않은 이메일 형식입니다.
" + + "variable + 을(를) 입력해주세요.", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + ),ApiResponse( + responseCode = "403", + description = "SMS 인증코드 유효 시간이 만료되었습니다.
", + content = arrayOf(Content(schema = Schema(implementation = BaseResponse::class))) + )] + ) @PostMapping("/password") - fun findPWSearch(@RequestBody @Validated findIdPwReq: FindIdPwReq): BaseResponse{ - if(!StringUtils.hasText(findIdPwReq.email)) throw BaseException(BaseResponseCode.NOT_EMPTY_EMAIL) - userService.findPWSearch(findIdPwReq) + fun findPWSearch(@RequestBody @Validated findPwReq: FindPwReq): BaseResponse{ + userService.findPWSearch(findPwReq) return BaseResponse(BaseResponseCode.SUCCESS) } /** * 마이페이지 알림 수신 여부 */ + @Operation(summary = "마이페이지 알림 수신 여부 (장채은)", description = "알림 수신 여부를 변경한다.") + @ApiResponses( + value = [ + ApiResponse(responseCode = "200", description = "요청에 성공했습니다.") + ] + ) @PostMapping("/notification") fun postNotiStatus(@AuthenticationPrincipal userAccount: UserAccount): BaseResponse{ return BaseResponse(userService.postNotiStatus(userAccount.getUser())) diff --git a/src/main/kotlin/com/psr/psr/user/dto/UserInterestDto.kt b/src/main/kotlin/com/psr/psr/user/dto/UserInterestDto.kt index a49b03e..8305535 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/UserInterestDto.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/UserInterestDto.kt @@ -2,8 +2,11 @@ package com.psr.psr.user.dto import com.psr.psr.global.resolver.EnumValid import com.psr.psr.user.entity.Category +import io.swagger.v3.oas.annotations.media.Schema data class UserInterestDto ( @EnumValid(enumClass = Category::class, message = "올바르지 않은 상품 카테고리입니다.") + @Schema(type = "String", description = "관심 카테고리", example = "방송가능 상품소싱", required = true, + allowableValues = ["방송가능 상품소싱", "쇼호스트 구인", "라이브커머스 대행", "라이브커머스 교육", "스마트스토어 런칭", "영상편집", "강사매칭", "SNS 마케팅", "홍보물 디자인"]) val category: String ) \ No newline at end of file diff --git a/src/main/kotlin/com/psr/psr/user/dto/UserInterestListDto.kt b/src/main/kotlin/com/psr/psr/user/dto/UserInterestListDto.kt index bfe311d..cb48273 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/UserInterestListDto.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/UserInterestListDto.kt @@ -1,8 +1,10 @@ package com.psr.psr.user.dto import com.psr.psr.user.entity.UserInterest +import io.swagger.v3.oas.annotations.media.Schema data class UserInterestListDto ( + @Schema(type = "List", description = "관심 목록") val interestList: List? ){ companion object{ diff --git a/src/main/kotlin/com/psr/psr/user/dto/phoneReq/SMSReq.kt b/src/main/kotlin/com/psr/psr/user/dto/phoneReq/SMSReq.kt index 5d1c697..f3824a3 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/phoneReq/SMSReq.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/phoneReq/SMSReq.kt @@ -1,7 +1,5 @@ package com.psr.psr.user.dto.phoneReq -import com.psr.psr.user.dto.request.ValidPhoneReq - data class SMSReq ( val type: String?= "SMS", val contentType: String?="COMM", @@ -11,8 +9,8 @@ data class SMSReq ( val messages: List ){ companion object{ - fun toSMSReqDto(validPhoneReq: ValidPhoneReq, key: String, sendPhone: String) : SMSReq{ - val message = MessageReq(to = validPhoneReq.phone) + fun toSMSReqDto(phone: String, key: String, sendPhone: String) : SMSReq{ + val message = MessageReq(to = phone) return SMSReq( from = sendPhone, content = "[PSR] 인증번호는 [ $key ] 을 입력해주세요", diff --git a/src/main/kotlin/com/psr/psr/user/dto/request/ChangePasswordReq.kt b/src/main/kotlin/com/psr/psr/user/dto/request/ChangePasswordReq.kt index 7b80271..42a46ba 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/request/ChangePasswordReq.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/request/ChangePasswordReq.kt @@ -1,5 +1,6 @@ package com.psr.psr.user.dto.request +import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.Pattern @@ -9,11 +10,13 @@ data class ChangePasswordReq ( regexp = "^.*(?=^.{8,15}\$)(?=.*\\d)(?=.*[a-zA-Z])(?=.*[!@#\$%^&+=]).*\$", message = "비밀번호를 숫자, 문자, 특수문자 포함 8~15자리 이내로 입력해주세요" ) + @Schema(type = "String", description = "기존 비밀번호", example = "asdf1234!", required = true) val currentPassword: String, @field:NotBlank @field:Pattern( regexp = "^.*(?=^.{8,15}\$)(?=.*\\d)(?=.*[a-zA-Z])(?=.*[!@#\$%^&+=]).*\$", message = "비밀번호를 숫자, 문자, 특수문자 포함 8~15자리 이내로 입력해주세요" ) + @Schema(type = "String", description = "변경할 비밀번호", example = "asdf1234!", required = true) val password: String ) \ No newline at end of file diff --git a/src/main/kotlin/com/psr/psr/user/dto/request/CheckNicknameReq.kt b/src/main/kotlin/com/psr/psr/user/dto/request/CheckNicknameReq.kt index a4b18d6..89278a1 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/request/CheckNicknameReq.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/request/CheckNicknameReq.kt @@ -1,9 +1,16 @@ package com.psr.psr.user.dto.request +import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.NotBlank +import jakarta.validation.constraints.Pattern data class CheckNicknameReq ( @field:NotBlank + @field:Pattern( + regexp = "^([a-zA-Z0-9ㄱ-ㅎ|ㅏ-ㅣ|가-힣]).{0,10}\$", + message = "닉네임은 한글, 영어, 숫자만 입력해주세요. (10글자)" + ) + @Schema(type = "String", description = "닉네임", example = "길동이", required = true) val nickname: String ) \ No newline at end of file diff --git a/src/main/kotlin/com/psr/psr/user/dto/request/FindIdReq.kt b/src/main/kotlin/com/psr/psr/user/dto/request/FindIdReq.kt new file mode 100644 index 0000000..4c7f262 --- /dev/null +++ b/src/main/kotlin/com/psr/psr/user/dto/request/FindIdReq.kt @@ -0,0 +1,25 @@ +package com.psr.psr.user.dto.request + +import io.swagger.v3.oas.annotations.media.Schema +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.NotBlank +import jakarta.validation.constraints.NotEmpty +import jakarta.validation.constraints.NotNull +import jakarta.validation.constraints.Pattern + + +data class FindIdReq ( + @field:Pattern( + regexp = "^01([0|1|6|7|8|9])-?([0-9]{3,4})-?([0-9]{4})\$", + message = "올바르지 않은 휴대폰 형식입니다." + ) + @NotBlank + @Schema(type = "String", description = "휴대폰", example = "010-0000-0000", required = true) + val phone: String, + @NotBlank + @Schema(type = "String", description = "인증코드", example = "12454", required = true) + val smsKey: String, + @NotBlank + @Schema(type = "String", description = "이름", example = "홍길동", required = true) + val name: String +) \ No newline at end of file diff --git a/src/main/kotlin/com/psr/psr/user/dto/request/FindPwReq.kt b/src/main/kotlin/com/psr/psr/user/dto/request/FindPwReq.kt new file mode 100644 index 0000000..a86edbd --- /dev/null +++ b/src/main/kotlin/com/psr/psr/user/dto/request/FindPwReq.kt @@ -0,0 +1,24 @@ +package com.psr.psr.user.dto.request + +import io.swagger.v3.oas.annotations.media.Schema +import jakarta.validation.constraints.Email +import jakarta.validation.constraints.NotBlank +import jakarta.validation.constraints.Pattern + + +data class FindPwReq ( + @field:Pattern( + regexp = "^01([0|1|6|7|8|9])-?([0-9]{3,4})-?([0-9]{4})\$", + message = "올바르지 않은 휴대폰 형식입니다." + ) + @NotBlank + @Schema(type = "String", description = "휴대폰", example = "010-0000-0000", required = true) + val phone: String, + @NotBlank + @Schema(type = "String", description = "인증코드", example = "12454", required = true) + val smsKey: String, + @NotBlank + @field:Email(message = "올바르지 않은 이메일 형식입니다.") + @Schema(type = "String", description = "이메일", example = "asdf@email.com", required = true) + val email: String +) \ No newline at end of file diff --git a/src/main/kotlin/com/psr/psr/user/dto/request/ProfileReq.kt b/src/main/kotlin/com/psr/psr/user/dto/request/ProfileReq.kt index 4a308b6..8800264 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/request/ProfileReq.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/request/ProfileReq.kt @@ -1,5 +1,6 @@ package com.psr.psr.user.dto.request +import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.Pattern @@ -9,6 +10,8 @@ data class ProfileReq( regexp = "^([a-zA-Z0-9ㄱ-ㅎ|ㅏ-ㅣ|가-힣]).{0,10}\$", message = "한글, 영어, 숫자만 입력해주세요. (10글자)" ) + @Schema(type = "String", description = "닉네임", required = true, example = "길동이") val nickname: String, + @Schema(type = "String", description = "프로필 이미지", example = "htt://asdf.jpg") val imgUrl: String ) \ No newline at end of file diff --git a/src/main/kotlin/com/psr/psr/user/dto/request/ResetPasswordReq.kt b/src/main/kotlin/com/psr/psr/user/dto/request/ResetPasswordReq.kt index c76e876..5cda227 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/request/ResetPasswordReq.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/request/ResetPasswordReq.kt @@ -1,5 +1,6 @@ package com.psr.psr.user.dto.request +import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.Email import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.Pattern @@ -7,17 +8,20 @@ import jakarta.validation.constraints.Pattern data class ResetPasswordReq ( @field:NotBlank(message = "이메일을 입력해주세요.") @field:Email(message = "올바르지 않은 이메일 형식입니다.") + @Schema(type = "String", description = "이메일", example = "asdf@email.com", required = true) val email: String, @field:NotBlank(message = "휴대폰을 입력해주세요.") @field:Pattern( regexp = "^01([0|1|6|7|8|9])-?([0-9]{3,4})-?([0-9]{4})\$", message = "올바르지 않은 휴대폰 형식입니다." ) + @Schema(type = "String", description = "휴대폰", example = "010-0000-0000", required = true) val phone: String, @field:NotBlank(message = "비밀번호를 입력해주세요.") @field:Pattern( regexp = "^.*(?=^.{8,15}\$)(?=.*\\d)(?=.*[a-zA-Z])(?=.*[!@#\$%^&+=]).*\$", message = "비밀번호를 숫자, 문자, 특수문자 포함 8~15자리 이내로 입력해주세요" ) + @Schema(type = "String", description = "비밀번호", example = "asdf1234!", required = true) val password: String ) \ No newline at end of file diff --git a/src/main/kotlin/com/psr/psr/user/dto/request/FindIdPwReq.kt b/src/main/kotlin/com/psr/psr/user/dto/request/SendSmsReq.kt similarity index 52% rename from src/main/kotlin/com/psr/psr/user/dto/request/FindIdPwReq.kt rename to src/main/kotlin/com/psr/psr/user/dto/request/SendSmsReq.kt index 5d66058..edbf265 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/request/FindIdPwReq.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/request/SendSmsReq.kt @@ -1,19 +1,17 @@ package com.psr.psr.user.dto.request -import jakarta.validation.constraints.Email +import io.swagger.v3.oas.annotations.media.Schema +import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.NotNull import jakarta.validation.constraints.Pattern -data class FindIdPwReq ( +data class SendSmsReq ( @field:Pattern( regexp = "^01([0|1|6|7|8|9])-?([0-9]{3,4})-?([0-9]{4})\$", message = "올바르지 않은 휴대폰 형식입니다." ) - @NotNull - val phone: String, - val smsKey: String, - val name: String ?= null, - @field:Email(message = "올바르지 않은 이메일 형식입니다.") - val email: String ?= null + @field:NotBlank + @Schema(type = "String", description = "휴대폰", example = "010-0000-0000", required = true) + val phone: String ) \ No newline at end of file diff --git a/src/main/kotlin/com/psr/psr/user/dto/request/SignUpReq.kt b/src/main/kotlin/com/psr/psr/user/dto/request/SignUpReq.kt index b787c8b..336de26 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/request/SignUpReq.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/request/SignUpReq.kt @@ -4,6 +4,7 @@ import com.psr.psr.global.resolver.EnumValid import com.psr.psr.user.dto.UserInterestDto import com.psr.psr.user.entity.Category import com.psr.psr.user.entity.Type +import io.swagger.v3.oas.annotations.media.Schema import jakarta.annotation.Nullable import jakarta.validation.constraints.Email import jakarta.validation.constraints.NotBlank @@ -15,36 +16,48 @@ import org.jetbrains.annotations.NotNull data class SignUpReq ( @field:NotBlank @field:Email(message = "올바르지 않은 이메일 형식입니다.") + @Schema(type = "String", description = "이메일", example = "asdf@email.com", required = true) val email: String, @field:NotBlank @field:Pattern( regexp = "^.*(?=^.{8,15}\$)(?=.*\\d)(?=.*[a-zA-Z])(?=.*[!@#\$%^&+=]).*\$", message = "비밀번호를 숫자, 문자, 특수문자 포함 8~15자리 이내로 입력해주세요" ) + @Schema(type = "String", description = "비밀번호", example = "asdf1234!", required = true) var password: String, @field:NotBlank @EnumValid(enumClass = Type::class, message = "올바르지 않은 사용자 역할니다.") + @Schema(type = "String", description = "역할", example = "일반", required = true, allowableValues = ["일반", "사업자", "쇼호스트", "관리자"]) val type: String, @field:Pattern( regexp = "^01([0|1|6|7|8|9])-?([0-9]{3,4})-?([0-9]{4})\$", message = "올바르지 않은 휴대폰 형식입니다." ) + @Schema(type = "String", description = "휴대폰", example = "010-0000-0000", required = true) val phone: String, @field:Nullable + @Schema(type = "String", description = "프로필 이미지", example = "htt://asdf.jpg") val imgUrl: String? = null, @field:NotBlank @field:Pattern( regexp = "^([a-zA-Z0-9ㄱ-ㅎ|ㅏ-ㅣ|가-힣]).{0,10}\$", - message = "한글, 영어, 숫자만 입력해주세요. (10글자)" + message = "닉네임은 한글, 영어, 숫자만 입력해주세요. (10글자)" ) + @Schema(type = "String", description = "닉네임", example = "길동이", required = true) val nickname: String, @field:NotNull + @Schema(type = "String", description = "이름", example = "홍길동", required = true) val name: String, + @Schema(type = "Boolean", description = "마켓팅 동의", example = "true", required = true, allowableValues = ["true"]) val marketing: Boolean, @field:NotNull + @Schema(type = "Boolean", description = "알림 동의", example = "true", required = true, allowableValues = ["true", "false"]) val notification: Boolean, + @Schema(type = "String", description = "알림 토큰", example = "fcmtoken", required = true) val deviceToken: String? = null, @field:NotEmpty + @Schema(type = "List", description = "관심 목록", required = true) val interestList: List, + @Schema(type = "List", description = "사업자 등록 정보", required = false) val entreInfo: UserEidReq?= null ) \ No newline at end of file diff --git a/src/main/kotlin/com/psr/psr/user/dto/request/UserEidReq.kt b/src/main/kotlin/com/psr/psr/user/dto/request/UserEidReq.kt index 1087084..884c1d5 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/request/UserEidReq.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/request/UserEidReq.kt @@ -2,17 +2,22 @@ package com.psr.psr.user.dto.request import com.psr.psr.user.dto.eidReq.BusinessListReq import com.psr.psr.user.dto.eidReq.Business +import io.swagger.v3.oas.annotations.media.Schema import jakarta.validation.constraints.NotBlank import java.util.* data class UserEidReq ( @field:NotBlank + @Schema(type = "String", description = "사업자 등록번호", example = "123455667", required = true) val number: String, @field:NotBlank + @Schema(type = "String", description = "사업자 개업 날짜 (yyyyMMdd)", example = "길동이반찬가게", required = true) val companyDate: String, @field:NotBlank + @Schema(type = "String", description = "상호명", example = "길동이반찬가게", required = true) val companyName: String, @field:NotBlank + @Schema(type = "String", description = "대표자명", example = "홍길동", required = true) val ownerName: String, ) \ No newline at end of file diff --git a/src/main/kotlin/com/psr/psr/user/dto/request/ValidPhoneReq.kt b/src/main/kotlin/com/psr/psr/user/dto/request/ValidPhoneReq.kt index 8527437..b834483 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/request/ValidPhoneReq.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/request/ValidPhoneReq.kt @@ -1,5 +1,7 @@ package com.psr.psr.user.dto.request +import io.swagger.v3.oas.annotations.media.Schema +import jakarta.validation.constraints.NotBlank import jakarta.validation.constraints.NotNull import jakarta.validation.constraints.Pattern @@ -9,7 +11,10 @@ data class ValidPhoneReq ( regexp = "^01([0|1|6|7|8|9])-?([0-9]{3,4})-?([0-9]{4})\$", message = "올바르지 않은 휴대폰 형식입니다." ) - @NotNull + @field:NotBlank + @Schema(type = "String", description = "휴대폰", example = "010-0000-0000", required = true) val phone: String, - val smsKey: String ?= null + @field:NotBlank + @Schema(type = "String", description = "인증코드", example = "12454", required = true) + val smsKey: String ) \ No newline at end of file diff --git a/src/main/kotlin/com/psr/psr/user/dto/response/EmailRes.kt b/src/main/kotlin/com/psr/psr/user/dto/response/EmailRes.kt index 682a334..0a7d40f 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/response/EmailRes.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/response/EmailRes.kt @@ -1,9 +1,11 @@ package com.psr.psr.user.dto.response import com.psr.psr.user.entity.User +import io.swagger.v3.oas.annotations.media.Schema data class EmailRes( + @Schema(type = "String", description = "이메일", example = "asdf@email.com", required = true) val email: String, ){ companion object{ diff --git a/src/main/kotlin/com/psr/psr/user/dto/response/MyPageInfoRes.kt b/src/main/kotlin/com/psr/psr/user/dto/response/MyPageInfoRes.kt index 35cc25a..8d5bdd1 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/response/MyPageInfoRes.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/response/MyPageInfoRes.kt @@ -1,13 +1,19 @@ package com.psr.psr.user.dto.response import com.psr.psr.user.entity.User +import io.swagger.v3.oas.annotations.media.Schema data class MyPageInfoRes( + @Schema(type = "String", description = "이메일", example = "asdf@email.com", required = true) val email: String, + @Schema(type = "String", description = "프로필 이미지", example = "htt://asdf.jpg") val imgUrl: String ?= null, + @Schema(type = "String", description = "역할", example = "일반", allowableValues = ["일반", "사업자", "쇼호스트", "관리자"]) val type: String, + @Schema(type = "String", description = "휴대폰", example = "010-0000-0000") val phone: String, + @Schema(type = "String", description = "닉네임", example = "길동이") val nickname: String, ){ companion object{ diff --git a/src/main/kotlin/com/psr/psr/user/dto/response/ProfileRes.kt b/src/main/kotlin/com/psr/psr/user/dto/response/ProfileRes.kt index e3c6186..6472710 100644 --- a/src/main/kotlin/com/psr/psr/user/dto/response/ProfileRes.kt +++ b/src/main/kotlin/com/psr/psr/user/dto/response/ProfileRes.kt @@ -1,10 +1,13 @@ package com.psr.psr.user.dto.response import com.psr.psr.user.entity.User +import io.swagger.v3.oas.annotations.media.Schema data class ProfileRes( + @Schema(type = "String", description = "닉네임", example = "길동이") val nickname: String, + @Schema(type = "String", description = "프로필 이미지", example = "htt://asdf.jpg") val imgUrl: String? = null ){ companion object{ diff --git a/src/main/kotlin/com/psr/psr/user/service/UserService.kt b/src/main/kotlin/com/psr/psr/user/service/UserService.kt index 4a01517..12c692d 100644 --- a/src/main/kotlin/com/psr/psr/user/service/UserService.kt +++ b/src/main/kotlin/com/psr/psr/user/service/UserService.kt @@ -297,7 +297,7 @@ class UserService( // 유효 휴대폰 검증 @Transactional - fun checkValidPhone(validPhoneReq: ValidPhoneReq) { + fun checkValidPhone(smsReq: SendSmsReq) { val time = System.currentTimeMillis() val url = FIRST_URL + MIDDLE_URL + serviceId + FINAL_URL // -> 이미 인코딩이 되어 있는 serviceKey이 재인코딩이 되지 않기 위해 @@ -314,7 +314,7 @@ class UserService( .defaultHeader(ACCESS_KEY_HEADER, accessKey) // accessKey .defaultHeader(SIGNATURE_HEADER, makeSignature(time)) .build().post() - .bodyValue(SMSReq.toSMSReqDto(validPhoneReq, smsKey, sendPhone)) + .bodyValue(SMSReq.toSMSReqDto(smsReq.phone, smsKey, sendPhone)) .retrieve() .onStatus({ it.isError }) { response -> throw BaseException(PHONE_ERROR) @@ -322,7 +322,7 @@ class UserService( .bodyToMono(String::class.java) .block() // 휴대폰 smsKey 만료시간 - smsUtils.createSmsKey(validPhoneReq.phone, smsKey) + smsUtils.createSmsKey(smsReq.phone, smsKey) } // 휴대폰 인증번호 조회 @@ -334,19 +334,19 @@ class UserService( } // 이메일 찾기를 위한 인증 - fun findEmailSearch(findIdPwReq: FindIdPwReq): EmailRes { + fun findEmailSearch(findIdReq: FindIdReq): EmailRes { // 인증번호 확인 - checkValidSmsKey(findIdPwReq.phone, findIdPwReq.smsKey) - val user: User = userRepository.findByNameAndPhoneAndStatus(findIdPwReq.name!!, findIdPwReq.phone, ACTIVE_STATUS) ?: throw BaseException(NOT_FOUND_USER) + checkValidSmsKey(findIdReq.phone, findIdReq.smsKey) + val user: User = userRepository.findByNameAndPhoneAndStatus(findIdReq.name, findIdReq.phone, ACTIVE_STATUS) ?: throw BaseException(NOT_FOUND_USER) // 사용자 이메일 전달 return EmailRes.toEmailResDto(user) } // 비밀번호 변경을 위한 인증 - fun findPWSearch(findIdPwReq: FindIdPwReq) { + fun findPWSearch(findIdPwReq: FindPwReq) { // 인증번호 확인 checkValidSmsKey(findIdPwReq.phone, findIdPwReq.smsKey) - userRepository.findByEmailAndPhoneAndStatus(findIdPwReq.email!!, findIdPwReq.phone, ACTIVE_STATUS) ?: throw BaseException(NOT_FOUND_USER) + userRepository.findByEmailAndPhoneAndStatus(findIdPwReq.email, findIdPwReq.phone, ACTIVE_STATUS) ?: throw BaseException(NOT_FOUND_USER) } // 마이페이지 알림 수신 여부