Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.2.0 #2

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build

on: [ push, pull_request ]
on: [ pull_request ]

jobs:
Linux-Build:
Expand All @@ -9,7 +9,6 @@ jobs:
matrix:
command: [
'./gradlew :app:platform:jvm:assemble',
'./gradlew :app:platform:wasm:assemble',
'./gradlew :app:platform:android:assembleRealRelease',
]
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_code_style.yml
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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency_guard.yml
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:
Expand Down
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@

All notable changes to this project will be documented in this file.

## [1.1.0] - 2024-11-17
## [1.2.0] - 2024-11-23

### 🚀 Features

- App - Tag
- Server - Tag

### 🐛 Bug Fixes

- App - Change the date update time in CalendarScreen(Background/Foreground -> Focus Change)

## [1.1.0] - 2024-11-18

### 🚀 Features

Expand Down
3 changes: 0 additions & 3 deletions app/core/account-preferences-memory/README.md

This file was deleted.

19 changes: 0 additions & 19 deletions app/core/account-preferences-memory/build.gradle.kts

This file was deleted.

This file was deleted.

This file was deleted.

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)
20 changes: 20 additions & 0 deletions app/core/backup-database-room/build.gradle.kts
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"
}
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')"
]
}
}
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
}
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()
}
}
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>>
}
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)
}
}
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>>
}
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)
}
}
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,
)
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,
)
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>
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)
Loading