-
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 #2 from taetae98coding/develop
1.2.0
- Loading branch information
Showing
381 changed files
with
10,551 additions
and
10,399 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: Check Code Style | ||
|
||
on: [ push, pull_request ] | ||
on: [ pull_request ] | ||
|
||
jobs: | ||
Spotless: | ||
|
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,6 +1,6 @@ | ||
name: Dependency Guard | ||
|
||
on: [ push, pull_request ] | ||
on: [ pull_request ] | ||
|
||
jobs: | ||
Dependency-Guard: | ||
|
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
...o/github/taetae98coding/diary/fore/account/preferences/memory/AccountMemoryPreferences.kt
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...ub/taetae98coding/diary/fore/account/preferences/memory/AccountPreferencesMemoryModule.kt
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
app/core/diary-database-memory/README.md → app/core/backup-database-room/README.md
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,3 @@ | ||
# :app:core:diary-database-memory module | ||
# :app:core:backup-database-room module | ||
## Dependency graph | ||
![Dependency graph](../../../docs/images/graphs/dep_graph_app_core_diary_database_memory.svg) | ||
![Dependency graph](../../../docs/images/graphs/dep_graph_app_core_backup_database_room.svg) |
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,20 @@ | ||
plugins { | ||
id("diary.room") | ||
id("diary.koin.room") | ||
} | ||
|
||
kotlin { | ||
sourceSets { | ||
commonMain { | ||
dependencies { | ||
implementation(project(":app:core:backup-database")) | ||
implementation(project(":library:coroutines")) | ||
implementation(project(":library:room")) | ||
} | ||
} | ||
} | ||
} | ||
|
||
android { | ||
namespace = "${Build.NAMESPACE}.core.backup.database.room" | ||
} |
61 changes: 61 additions & 0 deletions
61
...om/schemas/io.github.taetae98coding.diary.core.backup.database.room.BackupDatabase/1.json
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,61 @@ | ||
{ | ||
"formatVersion": 1, | ||
"database": { | ||
"version": 1, | ||
"identityHash": "5f647fc9749a8d467a0a3c1fe9ef80ff", | ||
"entities": [ | ||
{ | ||
"tableName": "MemoBackupEntity", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`memoId` TEXT NOT NULL, `uid` TEXT NOT NULL, PRIMARY KEY(`memoId`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "memoId", | ||
"columnName": "memoId", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "uid", | ||
"columnName": "uid", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"autoGenerate": false, | ||
"columnNames": [ | ||
"memoId" | ||
] | ||
} | ||
}, | ||
{ | ||
"tableName": "TagBackupEntity", | ||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`tagId` TEXT NOT NULL, `uid` TEXT NOT NULL, PRIMARY KEY(`tagId`))", | ||
"fields": [ | ||
{ | ||
"fieldPath": "tagId", | ||
"columnName": "tagId", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
}, | ||
{ | ||
"fieldPath": "uid", | ||
"columnName": "uid", | ||
"affinity": "TEXT", | ||
"notNull": true | ||
} | ||
], | ||
"primaryKey": { | ||
"autoGenerate": false, | ||
"columnNames": [ | ||
"tagId" | ||
] | ||
} | ||
} | ||
], | ||
"setupQueries": [ | ||
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", | ||
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '5f647fc9749a8d467a0a3c1fe9ef80ff')" | ||
] | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...monMain/kotlin/io/github/taetae98coding/diary/core/backup/database/room/BackupDatabase.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,29 @@ | ||
package io.github.taetae98coding.diary.core.backup.database.room | ||
|
||
import androidx.room.ConstructedBy | ||
import androidx.room.Database | ||
import androidx.room.RoomDatabase | ||
import androidx.room.TypeConverters | ||
import io.github.taetae98coding.diary.core.backup.database.room.dao.MemoBackupEntityDao | ||
import io.github.taetae98coding.diary.core.backup.database.room.dao.TagBackupEntityDao | ||
import io.github.taetae98coding.diary.core.backup.database.room.entity.MemoBackupEntity | ||
import io.github.taetae98coding.diary.core.backup.database.room.entity.TagBackupEntity | ||
import io.github.taetae98coding.diary.core.backup.database.room.internal.BackupDatabaseConstructor | ||
import io.github.taetae98coding.diary.library.room.InstantConverter | ||
|
||
|
||
@Database( | ||
entities = [ | ||
MemoBackupEntity::class, | ||
TagBackupEntity::class, | ||
], | ||
version = 1, | ||
) | ||
@ConstructedBy(BackupDatabaseConstructor::class) | ||
@TypeConverters( | ||
InstantConverter::class, | ||
) | ||
internal abstract class BackupDatabase : RoomDatabase() { | ||
abstract fun memo(): MemoBackupEntityDao | ||
abstract fun tag(): TagBackupEntityDao | ||
} |
17 changes: 17 additions & 0 deletions
17
...tlin/io/github/taetae98coding/diary/core/backup/database/room/BackupRoomDatabaseModule.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,17 @@ | ||
package io.github.taetae98coding.diary.core.backup.database.room | ||
|
||
import io.github.taetae98coding.diary.library.koin.room.getDatabaseBuilder | ||
import org.koin.core.annotation.ComponentScan | ||
import org.koin.core.annotation.Module | ||
import org.koin.core.annotation.Singleton | ||
import org.koin.core.component.KoinComponent | ||
|
||
@Module | ||
@ComponentScan | ||
public class BackupRoomDatabaseModule : KoinComponent { | ||
@Singleton | ||
internal fun providesDiaryDatabase(): BackupDatabase { | ||
return getDatabaseBuilder<BackupDatabase>("backup.db") | ||
.build() | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...otlin/io/github/taetae98coding/diary/core/backup/database/room/dao/MemoBackupEntityDao.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,16 @@ | ||
package io.github.taetae98coding.diary.core.backup.database.room.dao | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Query | ||
import io.github.taetae98coding.diary.core.backup.database.room.entity.MemoBackupEntity | ||
import io.github.taetae98coding.diary.library.room.dao.EntityDao | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
@Dao | ||
internal abstract class MemoBackupEntityDao : EntityDao<MemoBackupEntity>() { | ||
@Query("DELETE FROM MemoBackupEntity WHERE memoId IN (:memoIds)") | ||
abstract suspend fun delete(memoIds: Set<String>) | ||
|
||
@Query("SELECT memoId FROM MemoBackupEntity WHERE uid = :uid") | ||
abstract fun findMemoIdByUid(uid: String): Flow<List<String>> | ||
} |
24 changes: 24 additions & 0 deletions
24
.../kotlin/io/github/taetae98coding/diary/core/backup/database/room/dao/MemoBackupRoomDao.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 io.github.taetae98coding.diary.core.backup.database.room.dao | ||
|
||
import io.github.taetae98coding.diary.core.backup.database.MemoBackupDao | ||
import io.github.taetae98coding.diary.core.backup.database.room.BackupDatabase | ||
import io.github.taetae98coding.diary.core.backup.database.room.entity.MemoBackupEntity | ||
import kotlinx.coroutines.flow.Flow | ||
import org.koin.core.annotation.Factory | ||
|
||
@Factory | ||
internal class MemoBackupRoomDao( | ||
private val database: BackupDatabase, | ||
) : MemoBackupDao { | ||
override suspend fun upsert(uid: String, id: String) { | ||
database.memo().upsert(MemoBackupEntity(memoId = id, uid = uid)) | ||
} | ||
|
||
override suspend fun delete(ids: Set<String>) { | ||
database.memo().delete(ids) | ||
} | ||
|
||
override fun findMemoIdByUid(uid: String): Flow<List<String>> { | ||
return database.memo().findMemoIdByUid(uid) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...kotlin/io/github/taetae98coding/diary/core/backup/database/room/dao/TagBackupEntityDao.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,19 @@ | ||
package io.github.taetae98coding.diary.core.backup.database.room.dao | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Query | ||
import io.github.taetae98coding.diary.core.backup.database.room.entity.TagBackupEntity | ||
import io.github.taetae98coding.diary.library.room.dao.EntityDao | ||
import kotlinx.coroutines.flow.Flow | ||
|
||
@Dao | ||
internal abstract class TagBackupEntityDao : EntityDao<TagBackupEntity>() { | ||
@Query("DELETE FROM TagBackupEntity WHERE tagId IN (:tagIds)") | ||
abstract suspend fun delete(tagIds: Set<String>) | ||
|
||
@Query("SELECT COUNT(DISTINCT uid) FROM TagBackupEntity WHERE uid = :uid") | ||
abstract fun countByUid(uid: String): Flow<Int> | ||
|
||
@Query("SELECT DISTINCT tagId FROM TagBackupEntity WHERE uid = :uid LIMIT 50") | ||
abstract fun findByUid(uid: String): Flow<List<String>> | ||
} |
24 changes: 24 additions & 0 deletions
24
...n/kotlin/io/github/taetae98coding/diary/core/backup/database/room/dao/TagBackupRoomDao.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 io.github.taetae98coding.diary.core.backup.database.room.dao | ||
|
||
import io.github.taetae98coding.diary.core.backup.database.TagBackupDao | ||
import io.github.taetae98coding.diary.core.backup.database.room.BackupDatabase | ||
import io.github.taetae98coding.diary.core.backup.database.room.entity.TagBackupEntity | ||
import kotlinx.coroutines.flow.Flow | ||
import org.koin.core.annotation.Factory | ||
|
||
@Factory | ||
internal class TagBackupRoomDao( | ||
private val database: BackupDatabase, | ||
) : TagBackupDao { | ||
override suspend fun upsert(uid: String, id: String) { | ||
database.tag().upsert(TagBackupEntity(tagId = id, uid = uid)) | ||
} | ||
|
||
override suspend fun delete(ids: Set<String>) { | ||
database.tag().delete(ids) | ||
} | ||
|
||
override fun findByUid(uid: String): Flow<List<String>> { | ||
return database.tag().findByUid(uid) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...otlin/io/github/taetae98coding/diary/core/backup/database/room/entity/MemoBackupEntity.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 io.github.taetae98coding.diary.core.backup.database.room.entity | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity | ||
internal data class MemoBackupEntity( | ||
@PrimaryKey | ||
val memoId: String, | ||
val uid: String, | ||
) |
11 changes: 11 additions & 0 deletions
11
...kotlin/io/github/taetae98coding/diary/core/backup/database/room/entity/TagBackupEntity.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 io.github.taetae98coding.diary.core.backup.database.room.entity | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity | ||
internal data class TagBackupEntity( | ||
@PrimaryKey | ||
val tagId: String, | ||
val uid: String, | ||
) |
6 changes: 6 additions & 0 deletions
6
...thub/taetae98coding/diary/core/backup/database/room/internal/BackupDatabaseConstructor.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,6 @@ | ||
package io.github.taetae98coding.diary.core.backup.database.room.internal | ||
|
||
import androidx.room.RoomDatabaseConstructor | ||
import io.github.taetae98coding.diary.core.backup.database.room.BackupDatabase | ||
|
||
internal expect object BackupDatabaseConstructor : RoomDatabaseConstructor<BackupDatabase> |
4 changes: 2 additions & 2 deletions
4
app/core/holiday-database-memory/README.md → app/core/backup-database/README.md
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,3 @@ | ||
# :app:core:holiday-database-memory module | ||
# :app:core:backup-database module | ||
## Dependency graph | ||
![Dependency graph](../../../docs/images/graphs/dep_graph_app_core_holiday_database_memory.svg) | ||
![Dependency graph](../../../docs/images/graphs/dep_graph_app_core_backup_database.svg) |
Oops, something went wrong.