Skip to content

Commit

Permalink
refactor Domain Module 세분화
Browse files Browse the repository at this point in the history
  • Loading branch information
eshc123 committed Sep 21, 2024
1 parent f0d7056 commit 7e3e4ec
Show file tree
Hide file tree
Showing 128 changed files with 652 additions and 432 deletions.
3 changes: 2 additions & 1 deletion core/data/auth/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ dependencies {
implementation(libs.hilt.android)

implementation(project(":core:data:common"))
implementation(project(":core:domain"))
implementation(project(":core:domain:common"))
implementation(project(":core:domain:auth"))
implementation(project(":core:network"))
implementation(project(":core:datastore"))
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.goalpanzi.mission_mate.core.data.auth.di

import com.goalpanzi.mission_mate.core.data.auth.repository.AuthRepositoryImpl
import com.goalpanzi.mission_mate.core.domain.repository.AuthRepository
import com.goalpanzi.mission_mate.core.domain.auth.repository.AuthRepository
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.goalpanzi.mission_mate.core.data.auth.mapper

import com.goalpanzi.mission_mate.core.data.common.mapper.toModel
import com.goalpanzi.mission_mate.core.domain.model.CharacterType
import com.goalpanzi.mission_mate.core.domain.model.GoogleLogin
import com.goalpanzi.mission_mate.core.domain.auth.model.GoogleLogin
import com.goalpanzi.mission_mate.core.domain.common.model.user.CharacterType
import com.goalpanzi.mission_mate.core.network.model.response.GoogleLoginResponse

fun GoogleLoginResponse.toModel() : GoogleLogin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package com.goalpanzi.mission_mate.core.data.auth.repository
import com.goalpanzi.mission_mate.core.data.auth.mapper.toModel
import com.goalpanzi.mission_mate.core.data.common.handleResult
import com.goalpanzi.mission_mate.core.datastore.datasource.AuthDataSource
import com.goalpanzi.mission_mate.core.domain.model.base.DomainResult
import com.goalpanzi.mission_mate.core.domain.model.base.convert
import com.goalpanzi.mission_mate.core.domain.repository.AuthRepository
import com.goalpanzi.mission_mate.core.domain.auth.repository.AuthRepository
import com.goalpanzi.mission_mate.core.domain.common.DomainResult
import com.goalpanzi.mission_mate.core.domain.common.convert
import com.goalpanzi.mission_mate.core.network.model.request.GoogleLoginRequest
import com.goalpanzi.mission_mate.core.network.service.LoginService
import kotlinx.coroutines.flow.Flow
Expand Down
2 changes: 1 addition & 1 deletion core/data/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ dependencies {

ksp(libs.hilt.compiler)
implementation(libs.hilt.android)
implementation(project(":core:domain:common"))

implementation(project(":core:domain"))
implementation(project(":core:network"))
implementation(project(":core:datastore"))
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.goalpanzi.mission_mate.core.data.common

import com.goalpanzi.mission_mate.core.domain.model.base.DomainResult
import com.goalpanzi.mission_mate.core.domain.common.DomainResult
import retrofit2.HttpException
import retrofit2.Response

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
package com.goalpanzi.mission_mate.core.data.common.mapper

import com.goalpanzi.mission_mate.core.domain.model.CharacterType
import com.goalpanzi.mission_mate.core.domain.model.UserProfile
import com.goalpanzi.mission_mate.core.domain.model.mission.CreateMissionBody
import com.goalpanzi.mission_mate.core.domain.model.mission.Mission
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionDetail
import com.goalpanzi.mission_mate.core.domain.model.mission.Missions
import com.goalpanzi.mission_mate.core.network.model.request.CreateMissionRequest
import com.goalpanzi.mission_mate.core.domain.common.model.user.CharacterType
import com.goalpanzi.mission_mate.core.domain.common.model.user.UserProfile
import com.goalpanzi.mission_mate.core.network.model.response.CharacterTypeResponse
import com.goalpanzi.mission_mate.core.network.model.response.MissionDetailResponse
import com.goalpanzi.mission_mate.core.network.model.response.MissionResponse
import com.goalpanzi.mission_mate.core.network.model.response.MissionsResponse
import com.goalpanzi.mission_mate.core.network.model.response.ProfileResponse
import java.time.DayOfWeek

fun ProfileResponse.toModel() : UserProfile {
return UserProfile(
Expand All @@ -37,48 +28,3 @@ fun CharacterType.toResponse() : CharacterTypeResponse {
}
}


fun CreateMissionBody.toRequest() : CreateMissionRequest {
return CreateMissionRequest(
description = description,
missionStartDate = missionStartDate,
missionEndDate = missionEndDate,
timeOfDay = timeOfDay,
missionDays = missionDays,
boardCount = boardCount
)
}

fun MissionDetailResponse.toModel() : MissionDetail {
return MissionDetail(
missionId = missionId,
hostMemberId = hostMemberId,
description = description,
missionStartDate = missionStartDate,
missionEndDate = missionEndDate,
boardCount = boardCount,
invitationCode = invitationCode,
missionDays = missionDays.map {
DayOfWeek.valueOf(it)
},
timeOfDay = timeOfDay
)
}


fun MissionResponse.toModel() : Mission {
return Mission(
missionId = missionId,
description = description
)
}


fun MissionsResponse.toModel() : Missions {
return Missions(
profile = profile.toModel(),
missions = missions.map {
it.toModel()
}
)
}
3 changes: 2 additions & 1 deletion core/data/mission/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ dependencies {
implementation(libs.hilt.android)

implementation(project(":core:data:common"))
implementation(project(":core:domain"))
implementation(project(":core:domain:common"))
implementation(project(":core:domain:mission"))
implementation(project(":core:network"))
implementation(project(":core:datastore"))
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.goalpanzi.mission_mate.core.board.di

import com.goalpanzi.mission_mate.core.board.repository.MissionRepositoryImpl
import com.goalpanzi.mission_mate.core.domain.repository.MissionRepository
import com.goalpanzi.mission_mate.core.domain.mission.repository.MissionRepository
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
package com.goalpanzi.mission_mate.core.board.mapper

import com.goalpanzi.mission_mate.core.data.common.mapper.toModel
import com.goalpanzi.mission_mate.core.domain.model.mission.BoardReward
import com.goalpanzi.mission_mate.core.domain.model.mission.CreateMissionBody
import com.goalpanzi.mission_mate.core.domain.model.mission.Mission
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionBoard
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionBoardMembers
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionBoards
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionDetail
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionRank
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionVerification
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionVerifications
import com.goalpanzi.mission_mate.core.domain.model.mission.Missions
import com.goalpanzi.mission_mate.core.network.model.request.CreateMissionRequest
import com.goalpanzi.mission_mate.core.domain.mission.model.BoardReward
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionBoard
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionBoardMembers
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionBoards
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionDetail
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionRank
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionVerification
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionVerifications
import com.goalpanzi.mission_mate.core.network.model.response.BoardRewardResponse
import com.goalpanzi.mission_mate.core.network.model.response.MissionBoardMembersResponse
import com.goalpanzi.mission_mate.core.network.model.response.MissionBoardResponse
import com.goalpanzi.mission_mate.core.network.model.response.MissionBoardsResponse
import com.goalpanzi.mission_mate.core.network.model.response.MissionDetailResponse
import com.goalpanzi.mission_mate.core.network.model.response.MissionRankResponse
import com.goalpanzi.mission_mate.core.network.model.response.MissionResponse
import com.goalpanzi.mission_mate.core.network.model.response.MissionVerificationResponse
import com.goalpanzi.mission_mate.core.network.model.response.MissionVerificationsResponse
import com.goalpanzi.mission_mate.core.network.model.response.MissionsResponse
import java.time.DayOfWeek



fun MissionBoardsResponse.toModel() : MissionBoards {
return MissionBoards(
missionBoards = missionBoards.map {
Expand Down Expand Up @@ -85,3 +78,19 @@ fun MissionRankResponse.toModel() : MissionRank {
rank = rank
)
}

fun MissionDetailResponse.toModel() : MissionDetail {
return MissionDetail(
missionId = missionId,
hostMemberId = hostMemberId,
description = description,
missionStartDate = missionStartDate,
missionEndDate = missionEndDate,
boardCount = boardCount,
invitationCode = invitationCode,
missionDays = missionDays.map {
DayOfWeek.valueOf(it)
},
timeOfDay = timeOfDay
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import com.goalpanzi.mission_mate.core.board.mapper.toModel
import com.goalpanzi.mission_mate.core.data.common.handleResult
import com.goalpanzi.mission_mate.core.data.common.mapper.toModel
import com.goalpanzi.mission_mate.core.datastore.datasource.MissionDataSource
import com.goalpanzi.mission_mate.core.domain.model.base.DomainResult
import com.goalpanzi.mission_mate.core.domain.model.base.convert
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionBoards
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionDetail
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionRank
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionVerification
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionVerifications
import com.goalpanzi.mission_mate.core.domain.repository.MissionRepository
import com.goalpanzi.mission_mate.core.domain.common.DomainResult
import com.goalpanzi.mission_mate.core.domain.common.convert
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionBoards
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionDetail
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionRank
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionVerification
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionVerifications
import com.goalpanzi.mission_mate.core.domain.mission.repository.MissionRepository
import com.goalpanzi.mission_mate.core.network.service.MissionService
import kotlinx.coroutines.flow.Flow
import okhttp3.MediaType.Companion.toMediaTypeOrNull
Expand Down
5 changes: 4 additions & 1 deletion core/data/onboarding/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ dependencies {
implementation(libs.hilt.android)

implementation(project(":core:data:common"))
implementation(project(":core:domain"))
implementation(project(":core:data:mission"))
implementation(project(":core:domain:common"))
implementation(project(":core:domain:onboarding"))
implementation(project(":core:domain:mission"))
implementation(project(":core:network"))
implementation(project(":core:datastore"))
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.goalpanzi.mission_mate.core.data.onboarding.di

import com.goalpanzi.mission_mate.core.data.onboarding.repository.OnboardingRepositoryImpl
import com.goalpanzi.mission_mate.core.domain.repository.OnboardingRepository
import com.goalpanzi.mission_mate.core.domain.onboarding.repository.OnboardingRepository
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.goalpanzi.mission_mate.core.data.onboarding.mapper

import com.goalpanzi.mission_mate.core.data.common.mapper.toModel
import com.goalpanzi.mission_mate.core.domain.onboarding.model.CreateMissionBody
import com.goalpanzi.mission_mate.core.domain.onboarding.model.Mission
import com.goalpanzi.mission_mate.core.domain.onboarding.model.Missions
import com.goalpanzi.mission_mate.core.network.model.request.CreateMissionRequest
import com.goalpanzi.mission_mate.core.network.model.response.MissionResponse
import com.goalpanzi.mission_mate.core.network.model.response.MissionsResponse

fun CreateMissionBody.toRequest() : CreateMissionRequest {
return CreateMissionRequest(
description = description,
missionStartDate = missionStartDate,
missionEndDate = missionEndDate,
timeOfDay = timeOfDay,
missionDays = missionDays,
boardCount = boardCount
)
}

fun MissionResponse.toModel() : Mission {
return Mission(
missionId = missionId,
description = description
)
}


fun MissionsResponse.toModel() : Missions {
return Missions(
profile = profile.toModel(),
missions = missions.map {
it.toModel()
}
)
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.goalpanzi.mission_mate.core.data.onboarding.repository

import com.goalpanzi.mission_mate.core.board.mapper.toModel
import com.goalpanzi.mission_mate.core.data.common.handleResult
import com.goalpanzi.mission_mate.core.data.common.mapper.toModel
import com.goalpanzi.mission_mate.core.data.common.mapper.toRequest
import com.goalpanzi.mission_mate.core.domain.model.base.DomainResult
import com.goalpanzi.mission_mate.core.domain.model.base.convert
import com.goalpanzi.mission_mate.core.domain.model.mission.CreateMissionBody
import com.goalpanzi.mission_mate.core.domain.model.mission.MissionDetail
import com.goalpanzi.mission_mate.core.domain.model.mission.Missions
import com.goalpanzi.mission_mate.core.domain.repository.OnboardingRepository
import com.goalpanzi.mission_mate.core.data.onboarding.mapper.toModel
import com.goalpanzi.mission_mate.core.data.onboarding.mapper.toRequest
import com.goalpanzi.mission_mate.core.domain.common.DomainResult
import com.goalpanzi.mission_mate.core.domain.common.convert
import com.goalpanzi.mission_mate.core.domain.mission.model.MissionDetail
import com.goalpanzi.mission_mate.core.domain.onboarding.model.CreateMissionBody
import com.goalpanzi.mission_mate.core.domain.onboarding.model.Missions
import com.goalpanzi.mission_mate.core.domain.onboarding.repository.OnboardingRepository
import com.goalpanzi.mission_mate.core.network.model.request.JoinMissionRequest
import com.goalpanzi.mission_mate.core.network.service.OnboardingService
import javax.inject.Inject
Expand Down
4 changes: 3 additions & 1 deletion core/data/setting/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ dependencies {
implementation(libs.hilt.android)

implementation(project(":core:data:common"))
implementation(project(":core:domain"))
implementation(project(":core:domain:common"))
implementation(project(":core:domain:setting"))
implementation(project(":core:domain:setting"))
implementation(project(":core:network"))
implementation(project(":core:datastore"))
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.goalpanzi.mission_mate.core.data.setting.di

import com.goalpanzi.mission_mate.core.data.setting.repository.SettingRepositoryImpl
import com.goalpanzi.mission_mate.core.domain.repository.SettingRepository
import com.goalpanzi.mission_mate.core.domain.setting.repository.SettingRepository
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.goalpanzi.mission_mate.core.data.setting.repository

import com.goalpanzi.mission_mate.core.datastore.datasource.DefaultDataSource
import com.goalpanzi.mission_mate.core.domain.repository.SettingRepository
import com.goalpanzi.mission_mate.core.domain.setting.repository.SettingRepository
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

Expand Down
3 changes: 2 additions & 1 deletion core/data/user/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ dependencies {
implementation(libs.hilt.android)

implementation(project(":core:data:common"))
implementation(project(":core:domain"))
implementation(project(":core:domain:common"))
implementation(project(":core:domain:user"))
implementation(project(":core:network"))
implementation(project(":core:datastore"))
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.goalpanzi.mission_mate.core.data.user.di

import com.goalpanzi.mission_mate.core.data.user.repository.UserRepositoryImpl
import com.goalpanzi.mission_mate.core.domain.repository.UserRepository
import com.goalpanzi.mission_mate.core.domain.user.repository.UserRepository
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.goalpanzi.mission_mate.core.data.user.mapper

import com.goalpanzi.mission_mate.core.datastore.model.UserProfileDto
import com.goalpanzi.mission_mate.core.domain.model.CharacterType
import com.goalpanzi.mission_mate.core.domain.model.UserProfile
import com.goalpanzi.mission_mate.core.domain.common.model.user.CharacterType
import com.goalpanzi.mission_mate.core.domain.common.model.user.UserProfile

fun UserProfile.toDto() : UserProfileDto {
return UserProfileDto(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import com.goalpanzi.mission_mate.core.data.common.mapper.toResponse
import com.goalpanzi.mission_mate.core.data.user.mapper.toDto
import com.goalpanzi.mission_mate.core.data.user.mapper.toModel
import com.goalpanzi.mission_mate.core.datastore.datasource.DefaultDataSource
import com.goalpanzi.mission_mate.core.domain.model.CharacterType
import com.goalpanzi.mission_mate.core.domain.model.UserProfile
import com.goalpanzi.mission_mate.core.domain.model.base.DomainResult
import com.goalpanzi.mission_mate.core.domain.repository.UserRepository
import com.goalpanzi.mission_mate.core.domain.common.DomainResult
import com.goalpanzi.mission_mate.core.domain.common.model.user.CharacterType
import com.goalpanzi.mission_mate.core.domain.common.model.user.UserProfile
import com.goalpanzi.mission_mate.core.domain.user.repository.UserRepository
import com.goalpanzi.mission_mate.core.network.model.request.SaveProfileRequest
import com.goalpanzi.mission_mate.core.network.service.ProfileService
import kotlinx.coroutines.flow.Flow
Expand Down
File renamed without changes.
Loading

0 comments on commit 7e3e4ec

Please sign in to comment.