-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issues #287 feat: Gifticon, Brand Repository di 적용
- Loading branch information
Showing
13 changed files
with
351 additions
and
96 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.lighthouse.di | ||
|
||
import com.lighthouse.domain.repository.BrandRepository | ||
import com.lighthouse.domain.repository.GifticonEditRepository | ||
import com.lighthouse.domain.repository.GifticonSearchRepository | ||
import com.lighthouse.domain.repository.GifticonUsageHistoryRepository | ||
import com.lighthouse.repository.brand.BrandRepositoryImpl | ||
import com.lighthouse.repository.gifticon.GifticonEditRepositoryImpl | ||
import com.lighthouse.repository.gifticon.GifticonSearchRepositoryImpl | ||
import com.lighthouse.repository.gifticon.GifticonUsageHistoryRepositoryImpl | ||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
|
||
@Suppress("unused") | ||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
internal abstract class DataModule { | ||
|
||
@Binds | ||
abstract fun bindsBrandRepository( | ||
repository: BrandRepositoryImpl | ||
): BrandRepository | ||
|
||
@Binds | ||
abstract fun bindsGifticonEditRepository( | ||
repository: GifticonEditRepositoryImpl | ||
): GifticonEditRepository | ||
|
||
@Binds | ||
abstract fun bindsGifticonSearchRepository( | ||
repository: GifticonSearchRepositoryImpl | ||
): GifticonSearchRepository | ||
|
||
@Binds | ||
abstract fun bindsGifticonUsageHistoryRepository( | ||
repository: GifticonUsageHistoryRepositoryImpl | ||
): GifticonUsageHistoryRepository | ||
} |
50 changes: 0 additions & 50 deletions
50
data/data/src/main/java/com/lighthouse/repository/BrandRepositoryImpl.kt
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
data/data/src/main/java/com/lighthouse/repository/brand/BrandRepositoryImpl.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,33 @@ | ||
package com.lighthouse.repository.brand | ||
|
||
import com.lighthouse.beep.model.brand.BrandPlaceInfo | ||
import com.lighthouse.beep.model.location.Dms | ||
import com.lighthouse.domain.repository.BrandRepository | ||
import javax.inject.Inject | ||
|
||
internal class BrandRepositoryImpl @Inject constructor( | ||
private val brandRemoteRepository: BrandRemoteRepository, | ||
private val brandDatabaseRepository: BrandDatabaseRepository | ||
) : BrandRepository { | ||
|
||
override suspend fun getBrandPlaceInfo( | ||
brandName: String, | ||
x: Dms, | ||
y: Dms, | ||
size: Int | ||
): Result<List<BrandPlaceInfo>> { | ||
var result = brandDatabaseRepository.getBrands(x, y, brandName) | ||
if (result.isFailure) { | ||
result = brandRemoteRepository.getBrandPlaceInfo(brandName, x, y, size) | ||
val list = result.getOrNull() | ||
if (list != null) { | ||
brandDatabaseRepository.insertBrands(list, x, y, brandName) | ||
} | ||
} | ||
return result | ||
} | ||
|
||
override suspend fun removeExpirationBrands(): Result<Unit> { | ||
return brandDatabaseRepository.removeExpirationBrands() | ||
} | ||
} |
31 changes: 30 additions & 1 deletion
31
data/data/src/main/java/com/lighthouse/repository/gifticon/GifticonEditRepositoryImpl.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,3 +1,32 @@ | ||
package com.lighthouse.repository.gifticon | ||
|
||
class GifticonEditRepositoryImpl | ||
import com.lighthouse.beep.model.gifticon.GifticonWithCrop | ||
import com.lighthouse.domain.repository.GifticonEditRepository | ||
import javax.inject.Inject | ||
|
||
internal class GifticonEditRepositoryImpl @Inject constructor( | ||
private val gifticonEditDatabaseRepository: GifticonEditDatabaseRepository | ||
) : GifticonEditRepository { | ||
|
||
override suspend fun insertGifticons(gifticonWithCropList: List<GifticonWithCrop>): Result<Unit> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override suspend fun updateGifticon(gifticonWithCrop: GifticonWithCrop): Result<Unit> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override suspend fun deleteGifticon( | ||
userId: String, | ||
gifticonId: String | ||
): Result<Unit> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override suspend fun moveUserIdGifticon( | ||
oldUserId: String, | ||
newUserId: String | ||
): Result<Unit> { | ||
TODO("Not yet implemented") | ||
} | ||
} |
78 changes: 77 additions & 1 deletion
78
data/data/src/main/java/com/lighthouse/repository/gifticon/GifticonSearchRepositoryImpl.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,3 +1,79 @@ | ||
package com.lighthouse.repository.gifticon | ||
|
||
class GifticonSearchRepositoryImpl | ||
import com.lighthouse.beep.model.brand.BrandWithGifticonCount | ||
import com.lighthouse.beep.model.etc.SortBy | ||
import com.lighthouse.beep.model.gifticon.Gifticon | ||
import com.lighthouse.beep.model.gifticon.GifticonWithCrop | ||
import com.lighthouse.domain.repository.GifticonSearchRepository | ||
import kotlinx.coroutines.flow.Flow | ||
import javax.inject.Inject | ||
|
||
internal class GifticonSearchRepositoryImpl @Inject constructor( | ||
private val gifticonSearchDatabaseRepository: GifticonSearchDatabaseRepository | ||
) : GifticonSearchRepository { | ||
|
||
override fun getGifticon( | ||
userId: String, | ||
gifticonId: String | ||
): Result<Flow<Gifticon>> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun getAllGifticons( | ||
userId: String, | ||
isUsed: Boolean, | ||
filterExpired: Boolean, | ||
sortBy: SortBy | ||
): Result<Flow<List<Gifticon>>> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun getFilteredGifticons( | ||
userId: String, | ||
isUsed: Boolean, | ||
filterBrand: Set<String>, | ||
filterExpired: Boolean, | ||
sortBy: SortBy | ||
): Result<Flow<List<Gifticon>>> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun getGifticonByBrand( | ||
userId: String, | ||
isUsed: Boolean, | ||
brand: String, | ||
filterExpired: Boolean | ||
): Result<Flow<List<Gifticon>>> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun getAllBrands( | ||
userId: String, | ||
isUsed: Boolean, | ||
filterExpired: Boolean | ||
): Result<Flow<List<BrandWithGifticonCount>>> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override suspend fun getGifticonCrop( | ||
userId: String, | ||
gifticonId: String | ||
): Result<GifticonWithCrop> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun hasGifticon( | ||
userId: String, | ||
isUsed: Boolean, | ||
filterExpired: Boolean | ||
): Result<Flow<Boolean>> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override suspend fun hasGifticonBrand( | ||
userId: String, | ||
brand: String | ||
): Result<Boolean> { | ||
TODO("Not yet implemented") | ||
} | ||
} |
48 changes: 47 additions & 1 deletion
48
...ta/src/main/java/com/lighthouse/repository/gifticon/GifticonUsageHistoryRepositoryImpl.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,3 +1,49 @@ | ||
package com.lighthouse.repository.gifticon | ||
|
||
class GifticonUsageHistoryRepositoryImpl | ||
import com.lighthouse.beep.model.user.UsageHistory | ||
import com.lighthouse.domain.repository.GifticonUsageHistoryRepository | ||
import kotlinx.coroutines.flow.Flow | ||
import javax.inject.Inject | ||
|
||
internal class GifticonUsageHistoryRepositoryImpl @Inject constructor( | ||
private val gifticonUsageHistoryDatabaseRepository: GifticonUsageHistoryDatabaseRepository | ||
) : GifticonUsageHistoryRepository { | ||
|
||
override suspend fun useGifticon( | ||
userId: String, | ||
gifticonId: String, | ||
usageHistory: UsageHistory | ||
): Result<Unit> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override suspend fun useCashCardGifticon( | ||
userId: String, | ||
gifticonId: String, | ||
amount: Int, | ||
usageHistory: UsageHistory | ||
): Result<Unit> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override suspend fun revertUsedGifticon( | ||
userId: String, | ||
gifticonId: String | ||
): Result<Unit> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override fun getUsageHistory( | ||
userId: String, | ||
gifticonId: String | ||
): Result<Flow<List<UsageHistory>>> { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override suspend fun insertUsageHistory( | ||
gifticonId: String, | ||
usageHistory: UsageHistory | ||
): Result<Unit> { | ||
TODO("Not yet implemented") | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
domain/src/main/java/com/lighthouse/domain/repository/GifticonEditRepository.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,24 @@ | ||
package com.lighthouse.domain.repository | ||
|
||
import com.lighthouse.beep.model.gifticon.GifticonWithCrop | ||
|
||
interface GifticonEditRepository { | ||
|
||
suspend fun insertGifticons( | ||
gifticonWithCropList: List<GifticonWithCrop> | ||
): Result<Unit> | ||
|
||
suspend fun updateGifticon( | ||
gifticonWithCrop: GifticonWithCrop | ||
): Result<Unit> | ||
|
||
suspend fun deleteGifticon( | ||
userId: String, | ||
gifticonId: String | ||
): Result<Unit> | ||
|
||
suspend fun moveUserIdGifticon( | ||
oldUserId: String, | ||
newUserId: String | ||
): Result<Unit> | ||
} |
39 changes: 0 additions & 39 deletions
39
domain/src/main/java/com/lighthouse/domain/repository/GifticonRepository.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.