-
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.
Merge pull request #17 from team-xquare/16-return-user
🔀 :: (XQUARE-16)return user
- Loading branch information
Showing
11 changed files
with
99 additions
and
9 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
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
...tlin/com/xaquare/xquarebackoffice/infrastructure/excel/exception/UserNotFoundException.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.xaquare.xquarebackoffice.infrastructure.excel.exception | ||
|
||
import com.xaquare.xquarebackoffice.global.error.exception.ErrorCode | ||
import com.xaquare.xquarebackoffice.global.error.exception.XquareException | ||
|
||
object UserNotFoundException : XquareException( | ||
ErrorCode.USER_NOT_FOUND | ||
) |
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
11 changes: 11 additions & 0 deletions
11
...m/xaquare/xquarebackoffice/infrastructure/excel/presentation/dto/response/UserResponse.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,11 @@ | ||
package com.xaquare.xquarebackoffice.infrastructure.excel.presentation.dto.response | ||
|
||
data class UserResponse( | ||
val name: String, | ||
val accountId: String, | ||
val password: String, | ||
val grade: Int, | ||
val classNum: Int, | ||
val num: Int, | ||
val profile: String | ||
) |
27 changes: 27 additions & 0 deletions
27
...in/kotlin/com/xaquare/xquarebackoffice/infrastructure/excel/service/FindAllUserService.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,27 @@ | ||
package com.xaquare.xquarebackoffice.infrastructure.excel.service | ||
|
||
import com.xaquare.xquarebackoffice.domain.persistence.UserPersistenceAdapter | ||
import com.xaquare.xquarebackoffice.infrastructure.excel.presentation.dto.response.UserResponse | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class FindAllUserService( | ||
private val userPersistenceAdapter: UserPersistenceAdapter | ||
) { | ||
|
||
fun execute(): List<UserResponse> { | ||
val userData = userPersistenceAdapter.findAll() | ||
|
||
return userData.map { user -> | ||
UserResponse( | ||
name = user.name, | ||
accountId = user.accountId, | ||
password = user.password, | ||
grade = user.grade, | ||
classNum = user.classNum, | ||
num = user.num, | ||
profile = user.profile!! | ||
) | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...n/com/xaquare/xquarebackoffice/infrastructure/excel/service/FindUserByAccountIdService.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,26 @@ | ||
package com.xaquare.xquarebackoffice.infrastructure.excel.service | ||
|
||
import com.xaquare.xquarebackoffice.domain.persistence.UserPersistenceAdapter | ||
import com.xaquare.xquarebackoffice.infrastructure.excel.exception.UserNotFoundException | ||
import com.xaquare.xquarebackoffice.infrastructure.excel.presentation.dto.response.UserResponse | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class FindUserByAccountIdService( | ||
private val userPersistenceAdapter: UserPersistenceAdapter | ||
) { | ||
|
||
fun execute(accountId: String): UserResponse { | ||
val user = userPersistenceAdapter.findUserByAccountId(accountId) ?: throw UserNotFoundException | ||
|
||
return UserResponse( | ||
user.name, | ||
user.accountId, | ||
user.password, | ||
user.grade, | ||
user.classNum, | ||
user.num, | ||
user.profile!! | ||
) | ||
} | ||
} |
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
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