Skip to content
This repository was archived by the owner on Jul 7, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import org.springframework.web.bind.annotation.RequestMapping
@Tag(name = "Auth", description = "Auth API")
@RequestMapping("/api/v1/auth")
interface AuthApi {

@Operation(summary = "소셜 로그인")
@PostMapping("/login/{provider}")
@ApiResponses(
Expand All @@ -31,39 +30,38 @@ interface AuthApi {
content = [
Content(
mediaType = "application/json",
schema = Schema(implementation = SocialLoginResponse.Success::class)
)
]
schema = Schema(implementation = SocialLoginResponse.Success::class),
),
],
),
ApiResponse(
responseCode = "401",
description = "신규 회원 가입 필요",
content = [
Content(
mediaType = "application/json",
schema = Schema(implementation = SocialLoginResponse.NonRegistered::class)
)
]
schema = Schema(implementation = SocialLoginResponse.NonRegistered::class),
),
],
),
ApiResponse(
responseCode = "4XX",
description = "소셜 로그인 실패",
content = [
Content(
mediaType = "application/json",
schema = Schema(implementation = ExceptionResponse::class)
)
]
)
]
schema = Schema(implementation = ExceptionResponse::class),
),
],
),
],
)
fun socialLogin(
@Schema(description = "소셜 로그인 플랫폼, ex) KAKAO")
@Schema(description = "소셜 로그인 플랫폼, ex) KAKAO, GOOGLE, NAVER")
@PathVariable provider: String,
@RequestBody request: SocialLoginRequest
@RequestBody request: SocialLoginRequest,
): ResponseEntity<SocialLoginResponse>


@Operation(summary = "토큰 재발급")
@PostMapping("/reissue")
@ApiResponses(
Expand All @@ -74,23 +72,23 @@ interface AuthApi {
content = [
Content(
mediaType = "application/json",
schema = Schema(implementation = ReissueResponse::class)
)
]
schema = Schema(implementation = ReissueResponse::class),
),
],
),
ApiResponse(
responseCode = "4XX",
description = "토큰 재발급 실패, 다시 로그인해야함",
content = [
Content(
mediaType = "application/json",
schema = Schema(implementation = ExceptionResponse::class)
)
]
schema = Schema(implementation = ExceptionResponse::class),
),
],
),
]
],
)
fun reissueToken(
@RequestBody request: ReissueRequest
@RequestBody request: ReissueRequest,
): ReissueResponse
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,44 @@ import org.springframework.web.bind.annotation.RestController
@RestController
class AuthController(
private val socialLoginUsecase: SocialLoginUsecase,
private val reissueTokenUsecase: ReissueTokenUsecase
private val reissueTokenUsecase: ReissueTokenUsecase,
) : AuthApi {

override fun socialLogin(
provider: String,
request: SocialLoginRequest
request: SocialLoginRequest,
): ResponseEntity<SocialLoginResponse> {
val command = SocialLoginUsecase.Command(
provider = provider,
accessToken = request.accessToken
)
val command =
SocialLoginUsecase.Command(
provider = provider,
accessToken = request.accessToken,
)
return when (val response = socialLoginUsecase.login(command)) {
is SocialLoginUsecase.Success -> ResponseEntity.ok(
SocialLoginResponse.Success(
response.accessToken,
response.refreshToken,
response.isProcessedOnboarding
is SocialLoginUsecase.Success ->
ResponseEntity.ok(
SocialLoginResponse.Success(
response.accessToken,
response.refreshToken,
response.isProcessedOnboarding,
),
)
)

is SocialLoginUsecase.NonRegistered -> ResponseEntity.status(HttpStatus.UNAUTHORIZED)
.body(SocialLoginResponse.NonRegistered(response.registerToken))
is SocialLoginUsecase.NonRegistered ->
ResponseEntity
.status(HttpStatus.UNAUTHORIZED)
.body(SocialLoginResponse.NonRegistered(response.registerToken))
}
}

override fun reissueToken(request: ReissueRequest): ReissueResponse {
val response = reissueTokenUsecase.reissue(
ReissueTokenUsecase.Command(
refreshToken = request.refreshToken
val response =
reissueTokenUsecase.reissue(
ReissueTokenUsecase.Command(
refreshToken = request.refreshToken,
),
)
)
return ReissueResponse(
accessToken = response.accessToken,
refreshToken = response.refreshToken
refreshToken = response.refreshToken,
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import org.springframework.web.multipart.MultipartFile
@Tag(name = "Image", description = "Image API")
@RequestMapping("/api/v1/images")
interface ImageApi {

@Operation(
summary = "이미지 업로드",
description = "이미지를 업로드합니다.",
Expand All @@ -30,18 +29,18 @@ interface ImageApi {
Header(
name = "Authorization",
description = "액세스 토큰",
required = true
)
]
required = true,
),
],
),
ApiResponse(
responseCode = "4XX",
description = "이미지 업로드 실패"
)
]
description = "이미지 업로드 실패",
),
],
)
fun uploadImage(
@RequestPart image: MultipartFile,
@AccessUser userId: String
@AccessUser userId: String,
): UploadImageResponse
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import org.springframework.web.multipart.MultipartFile
@RestController
class ImageController(
private val uploadImageUsecase: UploadImageUsecase,
private val fileConverter: FileConverter
): ImageApi {

private val fileConverter: FileConverter,
) : ImageApi {
override fun uploadImage(
image: MultipartFile,
userId: String
userId: String,
): UploadImageResponse {
val response = uploadImageUsecase.upload(
UploadImageUsecase.Command(
image = fileConverter.convert(image),
userId = userId
val response =
uploadImageUsecase.upload(
UploadImageUsecase.Command(
image = fileConverter.convert(image),
userId = userId,
),
)
)
return UploadImageResponse(
imageUrl = response.imageUrl
imageUrl = response.imageUrl,
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class DraftLetterController(
override fun updatePhysicalDraft(
draftId: String,
userId: String,
request: UpdatePhysicalDraftLetterRequest
request: UpdatePhysicalDraftLetterRequest,
) {
updateDraftLetterUsecase.command(
UpdateDraftLetterUsecase.Command.Physical(
Expand Down Expand Up @@ -75,14 +75,15 @@ class DraftLetterController(
override fun getAllPhysicalDrafts(userId: String): GetAllPhysicalDraftLetterResponse {
val response = getPhysicalDraftLetterUsecase.getAll(GetPhysicalDraftLetterUsecase.Query.All(userId))
return GetAllPhysicalDraftLetterResponse(
drafts = response.drafts.map {
PhysicalDraftLetterInfo(
draftKey = it.draftKey,
senderName = it.senderName,
content = it.content,
lastUpdated = it.lastUpdated,
)
}
drafts =
response.drafts.map {
PhysicalDraftLetterInfo(
draftKey = it.draftKey,
senderName = it.senderName,
content = it.content,
lastUpdated = it.lastUpdated,
)
},
)
}

Expand All @@ -107,7 +108,7 @@ class DraftLetterController(

override fun getPhysicalDraftLetter(
draftKey: String,
userId: String
userId: String,
): GetPhysicalDraftLetterResponse {
val response = getPhysicalDraftLetterUsecase.getByKey(GetPhysicalDraftLetterUsecase.Query.ByKey(draftKey, userId))
return GetPhysicalDraftLetterResponse(
Expand Down Expand Up @@ -140,7 +141,10 @@ class DraftLetterController(
)
}

override fun deletePhysicalDraft(draftId: String, userId: String) {
override fun deletePhysicalDraft(
draftId: String,
userId: String,
) {
removeDraftLetterUsecase.deleteBy(
RemoveDraftLetterUsecase.Command.Physical(
draftId = draftId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ class SpaceController(
)
}

override fun updateSpaceMain(spaceId: String, userId: String) {
override fun updateSpaceMain(
spaceId: String,
userId: String,
) {
updateSpaceUsecase.update(
UpdateSpaceUsecase.Command.Main(
userId = userId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ class UserController(
)
}

override fun deleteUser(userId: String, request: UnregisterUserRequest?) {
override fun deleteUser(
userId: String,
request: UnregisterUserRequest?,
) {
deleteUserUsecase.delete(
DeleteUserUsecase.Command(
userId = userId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import java.time.LocalDateTime

@Entity
@Table(
name = "receive_draft_letters"
name = "receive_draft_letters",
)
class ReceiveDraftLetterEntity(
id: String,
Expand Down Expand Up @@ -59,5 +59,4 @@ class ReceiveDraftLetterEntity(
columnDefinition = "VARCHAR(20)",
)
var type: ReceiveDraftLetterType = type

}
}