mirror of https://github.com/hykilpikonna/AquaDX
[F] Forgot to save ;-;
parent
6f63998000
commit
103ae607be
|
@ -2,8 +2,6 @@ package icu.samnyan.aqua.net
|
||||||
|
|
||||||
import ext.*
|
import ext.*
|
||||||
import icu.samnyan.aqua.net.components.JWT
|
import icu.samnyan.aqua.net.components.JWT
|
||||||
import icu.samnyan.aqua.net.db.AquaNetUser
|
|
||||||
import icu.samnyan.aqua.net.db.AquaNetUserRepo
|
|
||||||
import icu.samnyan.aqua.net.utils.SUCCESS
|
import icu.samnyan.aqua.net.utils.SUCCESS
|
||||||
import icu.samnyan.aqua.sega.general.dao.CardRepository
|
import icu.samnyan.aqua.sega.general.dao.CardRepository
|
||||||
import icu.samnyan.aqua.sega.general.model.Card
|
import icu.samnyan.aqua.sega.general.model.Card
|
||||||
|
@ -15,7 +13,6 @@ import kotlin.jvm.optionals.getOrNull
|
||||||
@RestController
|
@RestController
|
||||||
@API("/api/v2/card")
|
@API("/api/v2/card")
|
||||||
class CardController(
|
class CardController(
|
||||||
val userRepo: AquaNetUserRepo,
|
|
||||||
val jwt: JWT,
|
val jwt: JWT,
|
||||||
val cardService: CardService,
|
val cardService: CardService,
|
||||||
val cardGameService: CardGameService,
|
val cardGameService: CardGameService,
|
||||||
|
@ -69,25 +66,25 @@ class CardGameService(
|
||||||
val ongeki: icu.samnyan.aqua.sega.ongeki.dao.userdata.UserDataRepository,
|
val ongeki: icu.samnyan.aqua.sega.ongeki.dao.userdata.UserDataRepository,
|
||||||
val diva: icu.samnyan.aqua.sega.diva.dao.userdata.PlayerProfileRepository,
|
val diva: icu.samnyan.aqua.sega.diva.dao.userdata.PlayerProfileRepository,
|
||||||
) {
|
) {
|
||||||
suspend fun migrate(card: Card, games: List<String>) = async {
|
suspend fun migrate(crd: Card, games: List<String>) = async {
|
||||||
// Migrate data from the card to the user's ghost card
|
// Migrate data from the card to the user's ghost card
|
||||||
// An easy migration is to change the UserData card field to the user's ghost card
|
// An easy migration is to change the UserData card field to the user's ghost card
|
||||||
games.forEach { game ->
|
games.forEach { game ->
|
||||||
when (game) {
|
when (game) {
|
||||||
"maimai" -> maimai.findByCard_ExtId(card.extId).getOrNull()?.let {
|
"maimai" -> maimai.findByCard_ExtId(crd.extId).getOrNull()?.let {
|
||||||
it.card = card.aquaUser!!.ghostCard
|
maimai.save(it.apply { card = crd.aquaUser!!.ghostCard })
|
||||||
}
|
}
|
||||||
"maimai2" -> maimai2.findByCard_ExtId(card.extId).getOrNull()?.let {
|
"maimai2" -> maimai2.findByCard_ExtId(crd.extId).getOrNull()?.let {
|
||||||
it.card = card.aquaUser!!.ghostCard
|
maimai2.save(it.apply { card = crd.aquaUser!!.ghostCard })
|
||||||
}
|
}
|
||||||
"chusan" -> chusan.findByCard_ExtId(card.extId).getOrNull()?.let {
|
"chusan" -> chusan.findByCard_ExtId(crd.extId).getOrNull()?.let {
|
||||||
it.card = card.aquaUser!!.ghostCard
|
chusan.save(it.apply { card = crd.aquaUser!!.ghostCard })
|
||||||
}
|
}
|
||||||
"chunithm" -> chunithm.findByCard_ExtId(card.extId).getOrNull()?.let {
|
"chunithm" -> chunithm.findByCard_ExtId(crd.extId).getOrNull()?.let {
|
||||||
it.card = card.aquaUser!!.ghostCard
|
chunithm.save(it.apply { card = crd.aquaUser!!.ghostCard })
|
||||||
}
|
}
|
||||||
"ongeki" -> ongeki.findByCard_ExtId(card.extId).getOrNull()?.let {
|
"ongeki" -> ongeki.findByCard_ExtId(crd.extId).getOrNull()?.let {
|
||||||
it.card = card.aquaUser!!.ghostCard
|
ongeki.save(it.apply { card = crd.aquaUser!!.ghostCard })
|
||||||
}
|
}
|
||||||
// TODO: diva
|
// TODO: diva
|
||||||
// "diva" -> diva.findByPdId(card.extId.toInt()).getOrNull()?.let {
|
// "diva" -> diva.findByPdId(card.extId.toInt()).getOrNull()?.let {
|
||||||
|
|
|
@ -16,13 +16,9 @@ import icu.samnyan.aqua.sega.general.model.Card
|
||||||
import icu.samnyan.aqua.sega.general.service.CardService
|
import icu.samnyan.aqua.sega.general.service.CardService
|
||||||
import jakarta.servlet.http.HttpServletRequest
|
import jakarta.servlet.http.HttpServletRequest
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder
|
import org.springframework.security.crypto.password.PasswordEncoder
|
||||||
import org.springframework.web.bind.annotation.PostMapping
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping
|
|
||||||
import org.springframework.web.bind.annotation.RestController
|
import org.springframework.web.bind.annotation.RestController
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.util.Random
|
|
||||||
import kotlin.reflect.KMutableProperty
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@API("/api/v2/user")
|
@API("/api/v2/user")
|
||||||
|
|
Loading…
Reference in New Issue