-
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 #148 from Team-Notitime/feat/organization/147-memb…
…er-management Feat/organization/147 member management
- Loading branch information
Showing
26 changed files
with
217 additions
and
82 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
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
32 changes: 32 additions & 0 deletions
32
...c/main/java/com/easyhz/noffice/core/network/api/organization/OrganizationMemberService.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,32 @@ | ||
package com.easyhz.noffice.core.network.api.organization | ||
|
||
import com.easyhz.noffice.core.network.model.request.organization.RegisterMemberRequest | ||
import com.easyhz.noffice.core.network.model.response.announcement.MemberResponse | ||
import com.easyhz.noffice.core.network.util.NofficeResult | ||
import retrofit2.http.Body | ||
import retrofit2.http.GET | ||
import retrofit2.http.PATCH | ||
import retrofit2.http.Path | ||
|
||
interface OrganizationMemberService { | ||
|
||
/* 조직 가입 대기자 조회 */ | ||
@GET("/api/v1/organizations/{organizationId}/pending-members") | ||
suspend fun fetchOrganizationPendingMembers( | ||
@Path("organizationId") organizationId: Int | ||
): NofficeResult<List<MemberResponse>> | ||
|
||
/* 조직 가입 수락 */ | ||
@PATCH("/api/v1/organizations/{organizationId}/register") | ||
suspend fun acceptRegisterMember( | ||
@Path("organizationId") organizationId: Int, | ||
@Body body: RegisterMemberRequest | ||
): NofficeResult<Unit> | ||
|
||
/* 조직원 권한 변경 */ | ||
@PATCH("/api/v1/organizations/{organizationId}/roles") | ||
suspend fun changeMemberRole( | ||
@Path("organizationId") organizationId: Int, | ||
@Body body: RegisterMemberRequest | ||
): NofficeResult<Unit> | ||
} |
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
10 changes: 10 additions & 0 deletions
10
...va/com/easyhz/noffice/data/organization/repository/member/OrganizationMemberRepository.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,10 @@ | ||
package com.easyhz.noffice.data.organization.repository.member | ||
|
||
import com.easyhz.noffice.core.model.common.Member | ||
import com.easyhz.noffice.core.model.organization.param.RegisterMemberParam | ||
|
||
interface OrganizationMemberRepository { | ||
suspend fun fetchOrganizationPendingMembers(organizationId: Int): Result<List<Member>> | ||
suspend fun acceptRegisterMember(param: RegisterMemberParam): Result<Unit> | ||
suspend fun changeMemberRole(param: RegisterMemberParam): Result<Unit> | ||
} |
40 changes: 40 additions & 0 deletions
40
...om/easyhz/noffice/data/organization/repository/member/OrganizationMemberRepositoryImpl.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.easyhz.noffice.data.organization.repository.member | ||
|
||
import com.easyhz.noffice.core.common.di.Dispatcher | ||
import com.easyhz.noffice.core.common.di.NofficeDispatchers | ||
import com.easyhz.noffice.core.model.common.Member | ||
import com.easyhz.noffice.core.model.organization.param.RegisterMemberParam | ||
import com.easyhz.noffice.core.network.api.organization.OrganizationMemberService | ||
import com.easyhz.noffice.core.network.util.toResult | ||
import com.easyhz.noffice.data.announcement.mapper.announcement.toModel | ||
import com.easyhz.noffice.data.organization.mapper.toRequest | ||
import kotlinx.coroutines.CoroutineDispatcher | ||
import kotlinx.coroutines.withContext | ||
import javax.inject.Inject | ||
|
||
class OrganizationMemberRepositoryImpl @Inject constructor( | ||
@Dispatcher(NofficeDispatchers.IO) private val dispatcher: CoroutineDispatcher, | ||
private val organizationMemberService: OrganizationMemberService | ||
): OrganizationMemberRepository { | ||
override suspend fun fetchOrganizationPendingMembers(organizationId: Int): Result<List<Member>> = | ||
withContext(dispatcher) { | ||
return@withContext organizationMemberService.fetchOrganizationPendingMembers(organizationId) | ||
.toResult().map { it.map { item -> item.toModel() } } | ||
} | ||
|
||
override suspend fun acceptRegisterMember(param: RegisterMemberParam): Result<Unit> = | ||
withContext(dispatcher) { | ||
return@withContext organizationMemberService.acceptRegisterMember( | ||
organizationId = param.organizationId, | ||
body = param.toRequest() | ||
).toResult() | ||
} | ||
|
||
override suspend fun changeMemberRole(param: RegisterMemberParam): Result<Unit> = | ||
withContext(dispatcher) { | ||
return@withContext organizationMemberService.changeMemberRole( | ||
organizationId = param.organizationId, | ||
body = param.toRequest() | ||
).toResult() | ||
} | ||
} |
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: 4 additions & 4 deletions
8
...ganization/AcceptRegisterMemberUseCase.kt → ...ase/member/AcceptRegisterMemberUseCase.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,14 @@ | ||
package com.easyhz.noffice.domain.organization.usecase.organization | ||
package com.easyhz.noffice.domain.organization.usecase.member | ||
|
||
import com.easyhz.noffice.core.common.base.BaseUseCase | ||
import com.easyhz.noffice.core.model.organization.param.RegisterMemberParam | ||
import com.easyhz.noffice.data.organization.repository.organization.OrganizationRepository | ||
import com.easyhz.noffice.data.organization.repository.member.OrganizationMemberRepository | ||
import javax.inject.Inject | ||
|
||
class AcceptRegisterMemberUseCase @Inject constructor( | ||
private val organizationRepository: OrganizationRepository | ||
private val organizationMemberRepository: OrganizationMemberRepository | ||
): BaseUseCase<RegisterMemberParam, Unit>() { | ||
override suspend fun invoke(param: RegisterMemberParam): Result<Unit> { | ||
return organizationRepository.acceptRegisterMember(param) | ||
return organizationMemberRepository.acceptRegisterMember(param) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ain/java/com/easyhz/noffice/domain/organization/usecase/member/ChangeMemberRoleUseCase.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,14 @@ | ||
package com.easyhz.noffice.domain.organization.usecase.member | ||
|
||
import com.easyhz.noffice.core.common.base.BaseUseCase | ||
import com.easyhz.noffice.core.model.organization.param.RegisterMemberParam | ||
import com.easyhz.noffice.data.organization.repository.member.OrganizationMemberRepository | ||
import javax.inject.Inject | ||
|
||
class ChangeMemberRoleUseCase @Inject constructor( | ||
private val organizationMemberRepository: OrganizationMemberRepository | ||
): BaseUseCase<RegisterMemberParam, Unit>() { | ||
override suspend fun invoke(param: RegisterMemberParam): Result<Unit> { | ||
return organizationMemberRepository.changeMemberRole(param) | ||
} | ||
} |
8 changes: 4 additions & 4 deletions
8
...FetchOrganizationPendingMembersUseCase.kt → ...FetchOrganizationPendingMembersUseCase.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,14 @@ | ||
package com.easyhz.noffice.domain.organization.usecase.organization | ||
package com.easyhz.noffice.domain.organization.usecase.member | ||
|
||
import com.easyhz.noffice.core.common.base.BaseUseCase | ||
import com.easyhz.noffice.core.model.common.Member | ||
import com.easyhz.noffice.data.organization.repository.organization.OrganizationRepository | ||
import com.easyhz.noffice.data.organization.repository.member.OrganizationMemberRepository | ||
import javax.inject.Inject | ||
|
||
class FetchOrganizationPendingMembersUseCase @Inject constructor( | ||
private val organizationRepository: OrganizationRepository | ||
private val organizationMemberRepository: OrganizationMemberRepository | ||
): BaseUseCase<Int, List<Member>>() { | ||
override suspend fun invoke(param: Int): Result<List<Member>> { | ||
return organizationRepository.fetchOrganizationPendingMembers(param) | ||
return organizationMemberRepository.fetchOrganizationPendingMembers(param) | ||
} | ||
} |
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
Oops, something went wrong.