Skip to content

Commit

Permalink
fix :: missed controller edition
Browse files Browse the repository at this point in the history
  • Loading branch information
jombidev committed Sep 10, 2024
1 parent a4810f1 commit 9578068
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/main/kotlin/com/teamapi/palette/controller/InfoController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ 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.http.ResponseEntity
import org.springframework.web.bind.annotation.*

@RestController
Expand All @@ -14,12 +16,16 @@ 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("유저 수정 성공")
}
}

0 comments on commit 9578068

Please sign in to comment.