[+] Verse: Save unlock challenge

pull/122/head
Azalea 2025-03-09 09:57:46 -04:00
parent 18ecbe0f44
commit b2f680da4e
4 changed files with 28 additions and 0 deletions

View File

@ -124,6 +124,10 @@ fun ChusanController.upsertApiInit() {
db.userDuel.saveAll(list.distinctBy { it.duelId }.mapApply {
id = db.userDuel.findByUserAndDuelId(u, duelId)?.id ?: 0 }) }
userUnlockChallengeList?.let { list ->
db.userChallenge.saveAll(list.distinctBy { it.unlockChallengeId }.mapApply {
id = db.userChallenge.findByUserAndUnlockChallengeId(u, unlockChallengeId)?.id ?: 0 }) }
// Need testing
// userLoginBonusList?.let { list ->
// db.userLoginBonus.saveAll(list.distinctBy { it["presetId"] as String }.map {

View File

@ -136,6 +136,10 @@ interface Chu3NetBattleLogRepo : Chu3UserLinked<Chu3NetBattleLog> {
interface Chu3UserMiscRepo : Chu3UserLinked<Chu3UserMisc>
interface Chu3UserChallengeRepo : Chu3UserLinked<Chu3UserChallenge> {
fun findByUserAndUnlockChallengeId(user: Chu3UserData, unlockChallengeId: Int): Chu3UserChallenge?
}
interface Chu3GameChargeRepo : JpaRepository<GameCharge, Long>
interface Chu3GameEventRepo : JpaRepository<GameEvent, Int> {
@ -191,6 +195,7 @@ class Chu3Repos(
val userCMissionProgress: Chu3UserCMissionProgressRepo,
val netBattleLog: Chu3NetBattleLogRepo,
val userMisc: Chu3UserMiscRepo,
val userChallenge: Chu3UserChallengeRepo,
val gameCharge: Chu3GameChargeRepo,
val gameEvent: Chu3GameEventRepo,
val gameGachaCard: Chu3GameGachaCardRepo,

View File

@ -63,4 +63,5 @@ class UpsertUserAll(
var userNetBattleData: List<UpsertNetBattleData>? = null,
var userCMissionList: List<UserCMissionResp>? = null,
var userFavoriteMusicList: List<FavNewMusic>? = null,
var userUnlockChallengeList: List<Chu3UserChallenge>? = null,
)

View File

@ -0,0 +1,18 @@
package icu.samnyan.aqua.sega.chusan.model.userdata
import jakarta.persistence.Entity
import jakarta.persistence.Table
import jakarta.persistence.UniqueConstraint
@Entity(name = "ChusanUserChallenge")
@Table(name = "chusan_user_challenge", uniqueConstraints = [UniqueConstraint(columnNames = ["user_id", "unlock_challenge_id"])])
class Chu3UserChallenge : Chu3UserEntity() {
var unlockChallengeId = 0
var status = 0
var clearCourseId = 0
var conditionType = 0
var score = 0
var life = 0
var clearDate = "" // len 20 YYYY-MM-DD HH:MM:SS
}