feat: Actorに絵文字情報を含めることが可能に

This commit is contained in:
usbharu 2023-12-21 19:13:36 +09:00
parent 086539e2a6
commit b070b8c71d
2 changed files with 11 additions and 5 deletions

View File

@ -26,7 +26,8 @@ data class Actor private constructor(
val followersCount: Int = 0,
val followingCount: Int = 0,
val postsCount: Int = 0,
val lastPostDate: Instant? = null
val lastPostDate: Instant? = null,
val emojis: List<Long> = emptyList()
) {
@Component
@ -55,7 +56,8 @@ data class Actor private constructor(
followersCount: Int = 0,
followingCount: Int = 0,
postsCount: Int = 0,
lastPostDate: Instant? = null
lastPostDate: Instant? = null,
emojis: List<Long> = emptyList()
): Actor {
if (id == 0L) {
return Actor(
@ -78,7 +80,8 @@ data class Actor private constructor(
followersCount = followersCount,
followingCount = followingCount,
postsCount = postsCount,
lastPostDate = lastPostDate
lastPostDate = lastPostDate,
emojis = emojis
)
}
@ -188,7 +191,8 @@ data class Actor private constructor(
followersCount = followersCount,
followingCount = followingCount,
postsCount = postsCount,
lastPostDate = lastPostDate
lastPostDate = lastPostDate,
emojis = emojis
)
}
}

View File

@ -45,6 +45,7 @@ class ActorRepositoryImpl(
it[followingCount] = actor.followingCount
it[postsCount] = actor.postsCount
it[lastPostAt] = actor.lastPostDate
it[emojis] = actor.emojis.joinToString(",")
}
} else {
Actors.update({ Actors.id eq actor.id }) {
@ -67,6 +68,7 @@ class ActorRepositoryImpl(
it[followingCount] = actor.followingCount
it[postsCount] = actor.postsCount
it[lastPostAt] = actor.lastPostDate
it[emojis] = actor.emojis.joinToString(",")
}
}
return@query actor
@ -152,7 +154,7 @@ object Actors : Table("actors") {
val followersCount = integer("followers_count")
val postsCount = integer("posts_count")
val lastPostAt = timestamp("last_post_at").nullable()
val emojis = varchar("emojis", 3000)
override val primaryKey: PrimaryKey = PrimaryKey(id)
init {