-
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 #6 from soma-baekgu/feature/BG-130-get-workspaces
[BG-130]: 워크스페이스 조회 API 기능 구현 (실제소요시간3 / 스토리포인트2)
- Loading branch information
Showing
18 changed files
with
266 additions
and
54 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
7 changes: 7 additions & 0 deletions
7
api/src/main/kotlin/com/backgu/amaker/workspace/dto/WorkspaceDto.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,7 @@ | ||
package com.backgu.amaker.workspace.dto | ||
|
||
class WorkspaceDto( | ||
val id: Long, | ||
val name: String, | ||
val thumbnail: String, | ||
) |
8 changes: 8 additions & 0 deletions
8
api/src/main/kotlin/com/backgu/amaker/workspace/dto/WorkspacesDto.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.backgu.amaker.workspace.dto | ||
|
||
import java.util.UUID | ||
|
||
class WorkspacesDto( | ||
val userId: UUID, | ||
val workspaces: List<WorkspaceDto>, | ||
) |
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
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 |
---|---|---|
|
@@ -12,6 +12,7 @@ import org.assertj.core.api.Assertions.assertThatThrownBy | |
import org.junit.jupiter.api.DisplayName | ||
import org.junit.jupiter.api.Test | ||
|
||
@DisplayName("AuthService 테스트") | ||
class AuthServiceTest { | ||
private lateinit var authService: AuthService | ||
private lateinit var googleOAuthClient: GoogleOAuthClient | ||
|
@@ -42,8 +43,7 @@ class AuthServiceTest { | |
googleApiClient = SuccessfulStubGoogleApiClient(email) | ||
authService = AuthService(googleOAuthClient, googleApiClient, AuthFixture.createUserRequest()) | ||
|
||
// when | ||
// then | ||
// when & then | ||
assertThatThrownBy { authService.googleLogin("authCode") } | ||
.isInstanceOf(IllegalArgumentException::class.java) | ||
.hasMessage("Failed to get access token") | ||
|
@@ -53,13 +53,11 @@ class AuthServiceTest { | |
@DisplayName("구글 oauth 서버에서 토큰 획득 실패 테스트") | ||
fun failedToUserInfo() { | ||
// given | ||
val email = "[email protected]" | ||
googleOAuthClient = SuccessfulStubGoogleOAuthClient() | ||
googleApiClient = FailedFakeGoogleApiClient() | ||
authService = AuthService(googleOAuthClient, googleApiClient, AuthFixture.createUserRequest()) | ||
|
||
// when | ||
// then | ||
// when & then | ||
assertThatThrownBy { authService.googleLogin("authCode") } | ||
.isInstanceOf(IllegalArgumentException::class.java) | ||
.hasMessage("Failed to get user information") | ||
|
18 changes: 18 additions & 0 deletions
18
api/src/test/kotlin/com/backgu/amaker/fixture/ChatRoomFixture.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,18 @@ | ||
package com.backgu.amaker.fixture | ||
|
||
import com.backgu.amaker.chat.domain.ChatRoom | ||
import com.backgu.amaker.chat.domain.ChatRoomType | ||
import com.backgu.amaker.chat.repository.ChatRoomRepository | ||
|
||
class ChatRoomFixture( | ||
private val chatRoomRepository: ChatRoomRepository, | ||
) { | ||
fun testChatRoomSetUp() { | ||
chatRoomRepository.saveAll( | ||
listOf( | ||
ChatRoom(workspaceId = 1L, chatRoomType = ChatRoomType.GROUP), | ||
ChatRoom(workspaceId = 2L, chatRoomType = ChatRoomType.GROUP), | ||
), | ||
) | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
api/src/test/kotlin/com/backgu/amaker/fixture/ChatRoomUserFixture.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,40 @@ | ||
package com.backgu.amaker.fixture | ||
|
||
import com.backgu.amaker.chat.domain.ChatRoomUser | ||
import com.backgu.amaker.chat.repository.ChatRoomUserRepository | ||
import java.util.UUID | ||
|
||
class ChatRoomUserFixture( | ||
private val chatRoomUserRepository: ChatRoomUserRepository, | ||
) { | ||
fun testChatRoomUserSetUp() { | ||
chatRoomUserRepository.saveAll( | ||
listOf( | ||
ChatRoomUser( | ||
chatRoomId = 1L, | ||
userId = UUID.fromString("00000000-0000-0000-0000-000000000001"), | ||
), | ||
ChatRoomUser( | ||
chatRoomId = 1L, | ||
userId = UUID.fromString("00000000-0000-0000-0000-000000000002"), | ||
), | ||
ChatRoomUser( | ||
chatRoomId = 1L, | ||
userId = UUID.fromString("00000000-0000-0000-0000-000000000003"), | ||
), | ||
ChatRoomUser( | ||
chatRoomId = 2L, | ||
userId = UUID.fromString("00000000-0000-0000-0000-000000000002"), | ||
), | ||
ChatRoomUser( | ||
chatRoomId = 2L, | ||
userId = UUID.fromString("00000000-0000-0000-0000-000000000001"), | ||
), | ||
ChatRoomUser( | ||
chatRoomId = 2L, | ||
userId = UUID.fromString("00000000-0000-0000-0000-000000000003"), | ||
), | ||
), | ||
) | ||
} | ||
} |
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
23 changes: 22 additions & 1 deletion
23
api/src/test/kotlin/com/backgu/amaker/fixture/WorkspaceFixture.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,14 +1,35 @@ | ||
package com.backgu.amaker.fixture | ||
|
||
import com.backgu.amaker.workspace.domain.Workspace | ||
import com.backgu.amaker.workspace.dto.WorkspaceCreateDto | ||
import com.backgu.amaker.workspace.repository.WorkspaceRepository | ||
import java.util.UUID | ||
|
||
class WorkspaceFixture { | ||
class WorkspaceFixture( | ||
private val workspaceRepository: WorkspaceRepository, | ||
) { | ||
companion object { | ||
fun createWorkspaceRequest(userId: UUID) = | ||
WorkspaceCreateDto( | ||
userId = userId, | ||
name = "name", | ||
) | ||
} | ||
|
||
fun testWorkspaceSetUp() { | ||
workspaceRepository.saveAll( | ||
listOf( | ||
Workspace( | ||
id = 1L, | ||
name = "워크스페이습", | ||
thumbnail = "image/thumbnail1.png", | ||
), | ||
Workspace( | ||
id = 2L, | ||
name = "워크스페이습", | ||
thumbnail = "image/thumbnail2.png", | ||
), | ||
), | ||
) | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
api/src/test/kotlin/com/backgu/amaker/fixture/WorkspaceUserFixture.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,47 @@ | ||
package com.backgu.amaker.fixture | ||
|
||
import com.backgu.amaker.workspace.domain.WorkspaceRole | ||
import com.backgu.amaker.workspace.domain.WorkspaceUser | ||
import com.backgu.amaker.workspace.repository.WorkspaceUserRepository | ||
import java.util.UUID | ||
|
||
class WorkspaceUserFixture( | ||
private val workspaceUserRepository: WorkspaceUserRepository, | ||
) { | ||
fun testWorkspaceUserSetUp() { | ||
workspaceUserRepository.saveAll( | ||
listOf( | ||
WorkspaceUser( | ||
workspaceId = 1L, | ||
userId = UUID.fromString("00000000-0000-0000-0000-000000000001"), | ||
workspaceRole = WorkspaceRole.LEADER, | ||
), | ||
WorkspaceUser( | ||
workspaceId = 1L, | ||
userId = UUID.fromString("00000000-0000-0000-0000-000000000002"), | ||
workspaceRole = WorkspaceRole.MEMBER, | ||
), | ||
WorkspaceUser( | ||
workspaceId = 1L, | ||
userId = UUID.fromString("00000000-0000-0000-0000-000000000003"), | ||
workspaceRole = WorkspaceRole.MEMBER, | ||
), | ||
WorkspaceUser( | ||
workspaceId = 2L, | ||
userId = UUID.fromString("00000000-0000-0000-0000-000000000002"), | ||
workspaceRole = WorkspaceRole.LEADER, | ||
), | ||
WorkspaceUser( | ||
workspaceId = 2L, | ||
userId = UUID.fromString("00000000-0000-0000-0000-000000000001"), | ||
workspaceRole = WorkspaceRole.MEMBER, | ||
), | ||
WorkspaceUser( | ||
workspaceId = 2L, | ||
userId = UUID.fromString("00000000-0000-0000-0000-000000000003"), | ||
workspaceRole = WorkspaceRole.MEMBER, | ||
), | ||
), | ||
) | ||
} | ||
} |
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
Oops, something went wrong.