Skip to content

Commit

Permalink
refactor:修改表单名和部分Column名
Browse files Browse the repository at this point in the history
  • Loading branch information
shaoyuanyu committed Nov 2, 2024
1 parent 191d04e commit 604c015
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ProblemService(
status = newProblem.status
score = newProblem.score
utcCreated = Clock.System.now()
utcLastModified = this.utcCreated
utcUpdated = this.utcCreated
}
}.id.value

Expand Down Expand Up @@ -68,7 +68,7 @@ class ProblemService(
it.tip = newProblem.tip
it.status = newProblem.status
it.score = newProblem.score
it.utcLastModified = Clock.System.now()
it.utcUpdated = Clock.System.now()
}.let {
if (it == null) {
throw ProblemIdNotFoundException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ProblemEntity(id: EntityID<Int>) : IntEntity(id) {
var status by ProblemTable.status
var score by ProblemTable.score
var utcCreated by ProblemTable.utcCreated
var utcLastModified by ProblemTable.utcLastModified
var utcUpdated by ProblemTable.utcUpdated
}

fun ProblemEntity.expose(): Problem =
Expand All @@ -46,7 +46,7 @@ fun ProblemEntity.expose(): Problem =
status = this.status,
score = this.score,
utcCreated = this.utcCreated,
utcLastModified = this.utcLastModified,
utcLastModified = this.utcUpdated,
)

fun List<ProblemEntity>.expose(): List<Problem> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp

object ProblemTable: IntIdTable("exposed_problem") {
object ProblemTable: IntIdTable("problem") {

val title: Column<String> = varchar("title", 100).index()

Expand Down Expand Up @@ -54,5 +54,5 @@ object ProblemTable: IntIdTable("exposed_problem") {
/**
* 最后修改时间,UTC
*/
val utcLastModified: Column<Instant> = timestamp("utc_last_modified")
val utcUpdated: Column<Instant> = timestamp("utc_updated")
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cn.kzoj.persistence.database.problemcase
import org.jetbrains.exposed.dao.id.IntIdTable
import org.jetbrains.exposed.sql.Column

object ProblemCaseTable: IntIdTable("exposed_problem_case") {
object ProblemCaseTable: IntIdTable("problem_case") {

val problemId: Column<Int> = integer("problem_id").index()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.jetbrains.exposed.dao.id.UUIDTable
import org.jetbrains.exposed.sql.Column
import org.jetbrains.exposed.sql.kotlin.datetime.timestamp

object UserTable: UUIDTable("exposed_user") {
object UserTable: UUIDTable("user") {

/**
* username 唯一
Expand Down

0 comments on commit 604c015

Please sign in to comment.