Skip to content

Commit

Permalink
Merge pull request #21 from MEOGO-DSM/20-user-myPage
Browse files Browse the repository at this point in the history
🏄 :: (Meogo-20) user my page
  • Loading branch information
meltapplee authored Sep 6, 2024
2 parents 4e98401 + 904434d commit e0f82de
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.meogo.domain.review.repository

import org.meogo.domain.review.domain.Review
import org.springframework.data.repository.Repository
import java.util.UUID

interface ReviewRepository : Repository<Review, Long> {
fun save(review: Review): Review
Expand All @@ -10,5 +11,7 @@ interface ReviewRepository : Repository<Review, Long> {

fun findById(id: Long): Review?

fun findByUserId(userId: UUID): List<Review>?

fun deleteById(id: Long)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import lombok.RequiredArgsConstructor
import org.meogo.domain.user.presentation.dto.request.UserCheckRequest
import org.meogo.domain.user.presentation.dto.request.UserSignInRequest
import org.meogo.domain.user.presentation.dto.request.UserSignUpRequest
import org.meogo.domain.user.presentation.dto.response.MyPageResponse
import org.meogo.domain.user.service.CheckAccountIdService
import org.meogo.domain.user.service.MyPageService
import org.meogo.domain.user.service.UserSignInService
import org.meogo.domain.user.service.UserSignUpService
import org.meogo.global.jwt.dto.TokenResponse
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
Expand All @@ -20,7 +23,8 @@ import javax.validation.Valid
class UserController(
private val userSignUpService: UserSignUpService,
private val userSignInService: UserSignInService,
private val userCheckAccountIdService: CheckAccountIdService
private val userCheckAccountIdService: CheckAccountIdService,
private val myPageService: MyPageService
) {
@PostMapping("/signup")
fun signUp(
Expand All @@ -36,4 +40,8 @@ class UserController(
@PostMapping("/check")
fun checkAccountId(@RequestBody request: UserCheckRequest): Boolean =
userCheckAccountIdService.execute(request)

@GetMapping("/myPage")
fun myPage(): MyPageResponse =
myPageService.execute()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.meogo.domain.user.presentation.dto.response

data class MyPageResponse(
val name: String,
val accountId: String,
val profile: String
)
23 changes: 23 additions & 0 deletions src/main/kotlin/org/meogo/domain/user/service/MyPageService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.meogo.domain.user.service

import org.meogo.domain.user.exception.UserNotFoundException
import org.meogo.domain.user.facade.UserFacade
import org.meogo.domain.user.presentation.dto.response.MyPageResponse
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional

@Service
class MyPageService(
private val userFacade: UserFacade
) {
@Transactional
fun execute(): MyPageResponse {
val user = userFacade.currentUser() ?: throw UserNotFoundException

return MyPageResponse(
user.name,
user.accountId,
user.profile!!
)
}
}

0 comments on commit e0f82de

Please sign in to comment.