feat: 인기 게시물 필드 추가 (데이터 레이어)

- HotDeal 도메인 모델에 isPopular 필드 추가
- HotDealEntity에 isPopular 컬럼 추가
- Migration 4->5 추가 (isPopular 컬럼)
- DatabaseModule에 Migration 4_5 등록

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
sanjeok77
2026-03-11 21:35:16 +09:00
parent bb480a0d32
commit 674b696421
4 changed files with 70 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ import com.hotdeal.alarm.data.local.db.entity.SiteConfigEntity
SiteConfigEntity::class,
KeywordEntity::class
],
version = 4,
version = 5,
exportSchema = false
)
@TypeConverters(Converters::class)
@@ -61,5 +61,14 @@ abstract class AppDatabase : RoomDatabase() {
db.execSQL("ALTER TABLE hot_deals ADD COLUMN isFavorite INTEGER NOT NULL DEFAULT 0")
}
}
/**
* Migration 4 -> 5: 인기 게시물 필드 추가
*/
val MIGRATION_4_5 = object : Migration(4, 5) {
override fun migrate(db: SupportSQLiteDatabase) {
db.execSQL("ALTER TABLE hot_deals ADD COLUMN isPopular INTEGER NOT NULL DEFAULT 0")
}
}
}
}

View File

@@ -26,6 +26,19 @@ data class HotDealEntity(
val createdAt: Long,
val isNotified: Boolean = false,
val isKeywordMatch: Boolean = false,
val isFavorite: Boolean = false, // 즐겨찾기 여부
val isPopular: Boolean = false // 인기/핫 게시물 여부
) {
@PrimaryKey
val id: String,
val siteName: String,
val boardName: String,
val title: String,
val url: String,
val mallUrl: String?,
val createdAt: Long,
val isNotified: Boolean = false,
val isKeywordMatch: Boolean = false,
val isFavorite: Boolean = false // 즐겨찾기 여부
) {
/**
@@ -42,6 +55,20 @@ data class HotDealEntity(
createdAt = createdAt,
isNotified = isNotified,
isKeywordMatch = isKeywordMatch,
isFavorite = isFavorite,
isPopular = isPopular
)
}
return HotDeal(
id = id,
siteName = siteName,
boardName = boardName,
title = title,
url = url,
mallUrl = mallUrl,
createdAt = createdAt,
isNotified = isNotified,
isKeywordMatch = isKeywordMatch,
isFavorite = isFavorite
)
}
@@ -61,6 +88,20 @@ data class HotDealEntity(
createdAt = domain.createdAt,
isNotified = domain.isNotified,
isKeywordMatch = domain.isKeywordMatch,
isFavorite = domain.isFavorite,
isPopular = domain.isPopular
)
}
return HotDealEntity(
id = domain.id,
siteName = domain.siteName,
boardName = domain.boardName,
title = domain.title,
url = domain.url,
mallUrl = domain.mallUrl,
createdAt = domain.createdAt,
isNotified = domain.isNotified,
isKeywordMatch = domain.isKeywordMatch,
isFavorite = domain.isFavorite
)
}

View File

@@ -34,6 +34,11 @@ object DatabaseModule {
.addMigrations(
AppDatabase.MIGRATION_1_2,
AppDatabase.MIGRATION_2_3,
AppDatabase.MIGRATION_3_4,
AppDatabase.MIGRATION_4_5
)
AppDatabase.MIGRATION_1_2,
AppDatabase.MIGRATION_2_3,
AppDatabase.MIGRATION_3_4
)
.fallbackToDestructiveMigration()

View File

@@ -13,6 +13,18 @@ data class HotDeal(
val createdAt: Long, // 수집 시간 (timestamp)
val isNotified: Boolean = false,
val isKeywordMatch: Boolean = false,
val isFavorite: Boolean = false, // 즐겨찾기 여부
val isPopular: Boolean = false // 인기/핫 게시물 여부
) {
val id: String, // siteName + "_" + postId
val siteName: String, // ppomppu, clien, ruriweb, coolenjoy, quasarzone
val boardName: String, // ppomppu, ppomppu4, allsell, jirum, etc.
val title: String, // 게시글 제목
val url: String, // 게시글 URL
val mallUrl: String? = null, // 쇼핑몰 URL (추출된 경우)
val createdAt: Long, // 수집 시간 (timestamp)
val isNotified: Boolean = false,
val isKeywordMatch: Boolean = false,
val isFavorite: Boolean = false // 즐겨찾기 여부
) {
/**