-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
495 additions
and
399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
FROM openjdk:17 | ||
FROM amazoncorretto:17 | ||
COPY build/libs/palette-0.0.1-SNAPSHOT.jar palette.jar | ||
ENTRYPOINT ["java", "-jar", "palette.jar"] | ||
ENTRYPOINT ["java", "-jar", "palette.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/com/teamapi/palette/annotations/SwaggerRequireAuthorize.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.teamapi.palette.annotations | ||
|
||
import io.swagger.v3.oas.annotations.security.SecurityRequirement | ||
|
||
@Retention(AnnotationRetention.RUNTIME) | ||
@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) | ||
@SecurityRequirement(name = "X-AUTH-Token") | ||
annotation class SwaggerRequireAuthorize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/com/teamapi/palette/config/SwaggerConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.teamapi.palette.config | ||
|
||
import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn | ||
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType | ||
import io.swagger.v3.oas.annotations.security.SecurityScheme | ||
import io.swagger.v3.oas.models.OpenAPI | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
|
||
|
||
@Configuration | ||
@SecurityScheme( | ||
name = "X-AUTH-Token", | ||
type = SecuritySchemeType.APIKEY, | ||
`in` = SecuritySchemeIn.HEADER, | ||
) | ||
class SwaggerConfig { | ||
@Bean | ||
fun customOpenAPI(): OpenAPI { | ||
return OpenAPI() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 27 additions & 10 deletions
37
src/main/kotlin/com/teamapi/palette/controller/ChatController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 14 additions & 10 deletions
24
src/main/kotlin/com/teamapi/palette/controller/InfoController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
package com.teamapi.palette.controller | ||
|
||
import com.teamapi.palette.annotations.SwaggerRequireAuthorize | ||
import com.teamapi.palette.dto.user.UpdateRequest | ||
import com.teamapi.palette.dto.user.UserResponse | ||
import com.teamapi.palette.response.Response | ||
import com.teamapi.palette.response.ResponseBody | ||
import com.teamapi.palette.service.UserService | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.PatchMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
import org.springframework.http.ResponseEntity | ||
import org.springframework.web.bind.annotation.* | ||
|
||
@RestController | ||
@RequestMapping("/info") | ||
@SwaggerRequireAuthorize | ||
class InfoController( | ||
private val userService: UserService | ||
) { | ||
@GetMapping("/me") | ||
fun myInfo() = userService.me() | ||
.map { ResponseBody.ok("유저 조회 성공", it) } | ||
suspend fun myInfo(): ResponseEntity<ResponseBody<UserResponse>> { | ||
val data = userService.me() | ||
return ResponseBody.ok("유저 조회 성공", data) | ||
} | ||
|
||
@PatchMapping("/me") | ||
fun updateInfo( | ||
suspend fun updateInfo( | ||
@RequestBody request: UpdateRequest | ||
) = userService.update(request) | ||
.thenReturn(Response.ok("유저 수정 성공")) | ||
): ResponseEntity<Response> { | ||
userService.update(request) | ||
return Response.ok("유저 수정 성공") | ||
} | ||
} |
Oops, something went wrong.