File tree Expand file tree Collapse file tree
src/main/kotlin/com/ansimtouchserver/domain/user Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import com.ansimtouchserver.global.exception.CustomException
1212import io.swagger.v3.oas.annotations.Operation
1313import io.swagger.v3.oas.annotations.tags.Tag
1414import org.springframework.web.bind.annotation.GetMapping
15+ import org.springframework.web.bind.annotation.PathVariable
1516import org.springframework.web.bind.annotation.PostMapping
1617import org.springframework.web.bind.annotation.RequestBody
1718import org.springframework.web.bind.annotation.RequestMapping
@@ -32,6 +33,12 @@ class UserController(
3233 return userService.getMe(principal)
3334 }
3435
36+ @Operation(summary = " 마이페이지" )
37+ @GetMapping(" /{userId}" )
38+ fun getUser (@PathVariable userId : Long ): GetMeResponse {
39+ return userService.getUser(userId)
40+ }
41+
3542 @Operation(summary = " fcm 토큰 입력" )
3643 @PostMapping(" /fcm" )
3744 fun registerFcmToken (principal : Principal , @RequestBody fcmRequest : FcmRequest ): BaseResponse <Unit > {
Original file line number Diff line number Diff line change 11package com.ansimtouchserver.domain.user.dto.response
22
33import com.ansimtouchserver.domain.user.entity.UserType
4+ import java.time.LocalDateTime
45
56data class GetMeResponse (
67 val id : Long = 0 ,
@@ -12,4 +13,8 @@ data class GetMeResponse (
1213 val userType : UserType ? = null ,
1314
1415 val fcmToken : String? = null ,
16+
17+ var lastLocationLa : Double? = null ,
18+ var lastLocationLo : Double? = null ,
19+ var lastUpdatedAt : LocalDateTime ? = null ,
1520)
Original file line number Diff line number Diff line change @@ -31,6 +31,11 @@ class UserService (
3131 return formUser(user)
3232 }
3333
34+ fun getUser (userId : Long ): GetMeResponse {
35+ val user = userRepository.findById(userId).orElseThrow{CustomException (UserErrorCode .USER_NOT_FOUND )}
36+ return formUser(user)
37+ }
38+
3439 fun registerFcmToken (principal : Principal , fcmToken : String ): BaseResponse <Unit >{
3540 val user = userRepository.findByTel(principal.name).orElseThrow{CustomException (UserErrorCode .USER_NOT_FOUND )}
3641 user.fcmToken = fcmToken
You can’t perform that action at this time.
0 commit comments