diff --git a/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/Users.kt b/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/Users.kt index eb7b1ac..5d21d4d 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/Users.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/Users.kt @@ -17,7 +17,7 @@ import org.jooq.ForeignKey import org.jooq.Name import org.jooq.Record import org.jooq.Records -import org.jooq.Row17 +import org.jooq.Row18 import org.jooq.Schema import org.jooq.SelectField import org.jooq.Table @@ -148,6 +148,11 @@ open class Users( */ val IS_ADMIN: TableField = createField(DSL.name("is_admin"), SQLDataType.BOOLEAN.defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "") + /** + * The column public.users.count_miss. + */ + val COUNT_MISS: TableField = createField(DSL.name("count_miss"), SQLDataType.BIGINT, this, "") + private constructor(alias: Name, aliased: Table?): this(alias, null, null, aliased, null) private constructor(alias: Name, aliased: Table?, parameters: Array?>?): this(alias, null, null, aliased, parameters) @@ -189,18 +194,18 @@ open class Users( override fun rename(name: Table<*>): Users = Users(name.getQualifiedName(), null) // ------------------------------------------------------------------------- - // Row17 type methods + // Row18 type methods // ------------------------------------------------------------------------- - override fun fieldsRow(): Row17 = super.fieldsRow() as Row17 + override fun fieldsRow(): Row18 = super.fieldsRow() as Row18 /** * Convenience mapping calling {@link SelectField#convertFrom(Function)}. */ - fun mapping(from: (Long?, String?, LocalDateTime?, String?, Long?, Long?, Double?, Double?, Long?, Long?, Long?, Long?, Long?, Long?, Long?, OffsetDateTime?, Boolean?) -> U): SelectField = convertFrom(Records.mapping(from)) + fun mapping(from: (Long?, String?, LocalDateTime?, String?, Long?, Long?, Double?, Double?, Long?, Long?, Long?, Long?, Long?, Long?, Long?, OffsetDateTime?, Boolean?, Long?) -> U): SelectField = convertFrom(Records.mapping(from)) /** * Convenience mapping calling {@link SelectField#convertFrom(Class, * Function)}. */ - fun mapping(toType: Class, from: (Long?, String?, LocalDateTime?, String?, Long?, Long?, Double?, Double?, Long?, Long?, Long?, Long?, Long?, Long?, Long?, OffsetDateTime?, Boolean?) -> U): SelectField = convertFrom(toType, Records.mapping(from)) + fun mapping(toType: Class, from: (Long?, String?, LocalDateTime?, String?, Long?, Long?, Double?, Double?, Long?, Long?, Long?, Long?, Long?, Long?, Long?, OffsetDateTime?, Boolean?, Long?) -> U): SelectField = convertFrom(toType, Records.mapping(from)) } diff --git a/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/records/UsersRecord.kt b/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/records/UsersRecord.kt index 14abcb0..b67cf84 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/records/UsersRecord.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/generated/tables/records/UsersRecord.kt @@ -11,8 +11,8 @@ import java.time.OffsetDateTime import org.jooq.Field import org.jooq.Record1 -import org.jooq.Record17 -import org.jooq.Row17 +import org.jooq.Record18 +import org.jooq.Row18 import org.jooq.impl.UpdatableRecordImpl @@ -20,7 +20,7 @@ import org.jooq.impl.UpdatableRecordImpl * This class is generated by jOOQ. */ @Suppress("UNCHECKED_CAST") -open class UsersRecord private constructor() : UpdatableRecordImpl(Users.USERS), Record17 { +open class UsersRecord private constructor() : UpdatableRecordImpl(Users.USERS), Record18 { open var userId: Long? set(value): Unit = set(0, value) @@ -92,6 +92,10 @@ open class UsersRecord private constructor() : UpdatableRecordImpl( set(value): Unit = set(16, value) get(): Boolean? = get(16) as Boolean? + open var countMiss: Long? + set(value): Unit = set(17, value) + get(): Long? = get(17) as Long? + // ------------------------------------------------------------------------- // Primary key information // ------------------------------------------------------------------------- @@ -99,11 +103,11 @@ open class UsersRecord private constructor() : UpdatableRecordImpl( override fun key(): Record1 = super.key() as Record1 // ------------------------------------------------------------------------- - // Record17 type implementation + // Record18 type implementation // ------------------------------------------------------------------------- - override fun fieldsRow(): Row17 = super.fieldsRow() as Row17 - override fun valuesRow(): Row17 = super.valuesRow() as Row17 + override fun fieldsRow(): Row18 = super.fieldsRow() as Row18 + override fun valuesRow(): Row18 = super.valuesRow() as Row18 override fun field1(): Field = Users.USERS.USER_ID override fun field2(): Field = Users.USERS.USERNAME override fun field3(): Field = Users.USERS.JOIN_DATE @@ -121,6 +125,7 @@ open class UsersRecord private constructor() : UpdatableRecordImpl( override fun field15(): Field = Users.USERS.COUNT_50 override fun field16(): Field = Users.USERS.SYS_LAST_UPDATE override fun field17(): Field = Users.USERS.IS_ADMIN + override fun field18(): Field = Users.USERS.COUNT_MISS override fun component1(): Long? = userId override fun component2(): String? = username override fun component3(): LocalDateTime? = joinDate @@ -138,6 +143,7 @@ open class UsersRecord private constructor() : UpdatableRecordImpl( override fun component15(): Long? = count_50 override fun component16(): OffsetDateTime? = sysLastUpdate override fun component17(): Boolean? = isAdmin + override fun component18(): Long? = countMiss override fun value1(): Long? = userId override fun value2(): String? = username override fun value3(): LocalDateTime? = joinDate @@ -155,6 +161,7 @@ open class UsersRecord private constructor() : UpdatableRecordImpl( override fun value15(): Long? = count_50 override fun value16(): OffsetDateTime? = sysLastUpdate override fun value17(): Boolean? = isAdmin + override fun value18(): Long? = countMiss override fun value1(value: Long?): UsersRecord { set(0, value) @@ -241,7 +248,12 @@ open class UsersRecord private constructor() : UpdatableRecordImpl( return this } - override fun values(value1: Long?, value2: String?, value3: LocalDateTime?, value4: String?, value5: Long?, value6: Long?, value7: Double?, value8: Double?, value9: Long?, value10: Long?, value11: Long?, value12: Long?, value13: Long?, value14: Long?, value15: Long?, value16: OffsetDateTime?, value17: Boolean?): UsersRecord { + override fun value18(value: Long?): UsersRecord { + set(17, value) + return this + } + + override fun values(value1: Long?, value2: String?, value3: LocalDateTime?, value4: String?, value5: Long?, value6: Long?, value7: Double?, value8: Double?, value9: Long?, value10: Long?, value11: Long?, value12: Long?, value13: Long?, value14: Long?, value15: Long?, value16: OffsetDateTime?, value17: Boolean?, value18: Long?): UsersRecord { this.value1(value1) this.value2(value2) this.value3(value3) @@ -259,13 +271,14 @@ open class UsersRecord private constructor() : UpdatableRecordImpl( this.value15(value15) this.value16(value16) this.value17(value17) + this.value18(value18) return this } /** * Create a detached, initialised UsersRecord */ - constructor(userId: Long? = null, username: String? = null, joinDate: LocalDateTime? = null, country: String? = null, countryRank: Long? = null, rank: Long? = null, ppRaw: Double? = null, accuracy: Double? = null, playcount: Long? = null, totalScore: Long? = null, rankedScore: Long? = null, secondsPlayed: Long? = null, count_100: Long? = null, count_300: Long? = null, count_50: Long? = null, sysLastUpdate: OffsetDateTime? = null, isAdmin: Boolean? = null): this() { + constructor(userId: Long? = null, username: String? = null, joinDate: LocalDateTime? = null, country: String? = null, countryRank: Long? = null, rank: Long? = null, ppRaw: Double? = null, accuracy: Double? = null, playcount: Long? = null, totalScore: Long? = null, rankedScore: Long? = null, secondsPlayed: Long? = null, count_100: Long? = null, count_300: Long? = null, count_50: Long? = null, sysLastUpdate: OffsetDateTime? = null, isAdmin: Boolean? = null, countMiss: Long? = null): this() { this.userId = userId this.username = username this.joinDate = joinDate @@ -283,6 +296,7 @@ open class UsersRecord private constructor() : UpdatableRecordImpl( this.count_50 = count_50 this.sysLastUpdate = sysLastUpdate this.isAdmin = isAdmin + this.countMiss = countMiss resetChangedOnNotNull() } } diff --git a/nise-backend/src/main/kotlin/com/nisemoe/nise/database/UserService.kt b/nise-backend/src/main/kotlin/com/nisemoe/nise/database/UserService.kt index 4388db6..006653c 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/nise/database/UserService.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/nise/database/UserService.kt @@ -120,6 +120,7 @@ class UserService( .set(USERS.COUNT_300, userStatistics?.count_300) .set(USERS.COUNT_100, userStatistics?.count_100) .set(USERS.COUNT_50, userStatistics?.count_50) + .set(USERS.COUNT_MISS, userStatistics?.count_miss) .apply { if(apiUser.join_date != null) { set(USERS.JOIN_DATE, OffsetDateTime.parse(apiUser.join_date).toLocalDateTime()) diff --git a/nise-backend/src/main/kotlin/com/nisemoe/nise/search/SearchSchemaController.kt b/nise-backend/src/main/kotlin/com/nisemoe/nise/search/SearchSchemaController.kt index 0794c48..231079f 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/nise/search/SearchSchemaController.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/nise/search/SearchSchemaController.kt @@ -33,7 +33,7 @@ class SearchSchemaController( InternalSchemaField("user_count_300", "300s", Category.user, Type.number, false, "number of 300 hits", databaseField = USERS.COUNT_300), InternalSchemaField("user_count_100", "100s", Category.user, Type.number, false, "number of 100 hits", databaseField = USERS.COUNT_100), InternalSchemaField("user_count_50", "50s", Category.user, Type.number, false, "number of 50 hits", databaseField = USERS.COUNT_50), - InternalSchemaField("user_count_miss", "Misses", Category.user, Type.number, false, "missed hits"), // TODO: Why no miss count? + InternalSchemaField("user_count_miss", "Misses", Category.user, Type.number, false, "missed hits", databaseField = USERS.COUNT_MISS), // Score fields InternalSchemaField("is_banned", "Banned", Category.score, Type.boolean, false, "has to score been deleted?", databaseField = SCORES.IS_BANNED), diff --git a/nise-backend/src/main/resources/db/migration/V0.0.1.025__alter_users.sql b/nise-backend/src/main/resources/db/migration/V0.0.1.025__alter_users.sql new file mode 100644 index 0000000..07a0974 --- /dev/null +++ b/nise-backend/src/main/resources/db/migration/V0.0.1.025__alter_users.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.users + ADD COLUMN count_miss int8; \ No newline at end of file