Skip to content

Commit

Permalink
feat: modify user and image entity
Browse files Browse the repository at this point in the history
image: is_private, user: is_default_image_private
  • Loading branch information
ShiinaKin committed Sep 17, 2024
1 parent eef8975 commit ad198ec
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class ImageDaoImpl : ImageDao {
it[height] = insertDTO.height
it[md5] = insertDTO.md5
it[sha1] = insertDTO.sha1
it[isPrivate] = insertDTO.isPrivate
it[createTime] = insertDTO.createTime
}
return entityID.value
Expand All @@ -63,6 +64,7 @@ class ImageDaoImpl : ImageDao {
it[Images.height],
it[Images.md5],
it[Images.sha1],
it[Images.isPrivate],
it[Images.createTime]
)
}
1 change: 1 addition & 0 deletions app/src/main/kotlin/io/sakurasou/model/dao/image/Images.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ object Images : LongIdTable() {
val height = integer("height").check { it greater 0 }
val md5 = char("md5", 32)
val sha1 = char("sha1", 40)
val isPrivate = bool("is_private")
val createTime = datetime("create_time")

init {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class UserDaoImpl : UserDao {
row[Users.name],
row[Users.password],
row[Users.email],
row[Users.isDefaultImagePrivate],
row[Users.createTime],
row[Users.updateTime]
)
Expand All @@ -36,6 +37,7 @@ class UserDaoImpl : UserDao {
row[Users.name],
row[Users.password],
row[Users.email],
row[Users.isDefaultImagePrivate],
row[Users.createTime],
row[Users.updateTime]
)
Expand All @@ -48,6 +50,7 @@ class UserDaoImpl : UserDao {
it[name] = user.username
it[password] = user.password
it[email] = user.email
it[isDefaultImagePrivate] = user.isDefaultImagePrivate
it[createTime] = user.createTime
it[updateTime] = user.updateTime
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/kotlin/io/sakurasou/model/dao/user/Users.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ object Users : LongIdTable("users") {
val name = varchar("name", 50).uniqueIndex()
val password = char("password", 60)
val email = varchar("email", 255).nullable()
val isDefaultImagePrivate = bool("is_default_image_private")
val createTime = datetime("create_time")
val updateTime = datetime("update_time")

Expand Down
1 change: 1 addition & 0 deletions app/src/main/kotlin/io/sakurasou/model/dto/ImageDTO.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ data class ImageInsertDTO(
val height: Int,
val md5: String,
val sha1: String,
val isPrivate: Boolean,
val createTime: LocalDateTime
)
1 change: 1 addition & 0 deletions app/src/main/kotlin/io/sakurasou/model/dto/UserDTO.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ data class UserInsertDTO(
val username: String,
val password: String,
val email: String?,
val isDefaultImagePrivate: Boolean,
val createTime: LocalDateTime,
val updateTime: LocalDateTime
)
1 change: 1 addition & 0 deletions app/src/main/kotlin/io/sakurasou/model/entity/Image.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ data class Image(
val height: Int,
val md5: String,
val sha1: String,
val isPrivate: Boolean,
val createTime: LocalDateTime
)
1 change: 1 addition & 0 deletions app/src/main/kotlin/io/sakurasou/model/entity/User.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ data class User(
val name: String,
val password: String,
val email: String?,
val isDefaultImagePrivate: Boolean,
val createTime: LocalDateTime,
val updateTime: LocalDateTime
)
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class CommonServiceImpl(
username = siteInitRequest.username,
password = encodePassword,
email = siteInitRequest.email,
isDefaultImagePrivate = true,
createTime = now,
updateTime = now
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class UserServiceImpl(
username = userInsertRequest.username,
password = encodePassword,
email = userInsertRequest.email,
isDefaultImagePrivate = true,
createTime = now,
updateTime = now
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class AuthServiceTest {
name = username,
password = hashedPassword,
email = email,
isDefaultImagePrivate = true,
createTime = now,
updateTime = now
)
Expand Down Expand Up @@ -98,6 +99,7 @@ class AuthServiceTest {
name = username,
password = hashedPassword,
email = email,
isDefaultImagePrivate = true,
createTime = now,
updateTime = now
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class CommonServiceTest {
username = "testUser",
password = encodedPassword,
email = "[email protected]",
isDefaultImagePrivate = true,
createTime = now,
updateTime = now
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class UserServiceTest {
username = "testUser",
password = encodedPassword,
email = "[email protected]",
isDefaultImagePrivate = true,
createTime = now,
updateTime = now
)
Expand Down

0 comments on commit ad198ec

Please sign in to comment.