[+] Wacca NET controller (incomplete)

This commit is contained in:
Azalea 2024-03-29 05:13:22 -04:00
parent 3ab2b16042
commit 68ec7f504a
3 changed files with 55 additions and 5 deletions

View File

@ -0,0 +1,41 @@
package icu.samnyan.aqua.net.games.wacca
import ext.API
import ext.minus
import icu.samnyan.aqua.net.db.AquaUserServices
import icu.samnyan.aqua.net.games.GameApiController
import icu.samnyan.aqua.net.games.GenericGameSummary
import icu.samnyan.aqua.net.games.TrendOut
import icu.samnyan.aqua.net.games.USERNAME_CHARS
import icu.samnyan.aqua.net.utils.AquaNetProps
import icu.samnyan.aqua.sega.wacca.model.db.WaccaRepos
import icu.samnyan.aqua.sega.wacca.model.db.WaccaUser
import icu.samnyan.aqua.sega.wacca.model.db.WcUserPlayLogRepo
import icu.samnyan.aqua.sega.wacca.model.db.WcUserRepo
import org.springframework.web.bind.annotation.RestController
@RestController
@API("api/v2/game/wacca")
class Wacca(
override val us: AquaUserServices,
override val playlogRepo: WcUserPlayLogRepo,
override val userDataRepo: WcUserRepo,
val repos: WaccaRepos,
val netProps: AquaNetProps,
): GameApiController<WaccaUser>("wacca", WaccaUser::class) {
override val settableFields: Map<String, (WaccaUser, String) -> Unit> by lazy { mapOf(
"userName" to { u, v -> u.userName = v
if (!v.all { it in USERNAME_CHARS }) { 400 - "Invalid character in username" }
},
) }
override suspend fun trend(username: String): List<TrendOut> {
TODO("Not yet implemented")
}
override suspend fun userSummary(username: String): GenericGameSummary {
TODO("Not yet implemented")
}
override val shownRanks: List<Pair<Int, String>> = emptyList()
}

View File

@ -105,10 +105,18 @@ val waccaRatingMult = linkedMapOf(
960_000 to 3.25,
950_000 to 3.0,
940_000 to 2.75,
930_000 to 2.5,
920_000 to 2.25,
910_000 to 2.0,
900_000 to 1.0,
920_000 to 2.5,
900_000 to 2.0,
850_000 to 1.5,
800_000 to 1.0,
700_000 to 0.8,
600_000 to 0.7,
500_000 to 0.6,
400_000 to 0.5,
300_000 to 0.4,
200_000 to 0.3,
100_000 to 0.2,
1 to 0.1,
0 to 0.0
)

View File

@ -1,13 +1,14 @@
package icu.samnyan.aqua.sega.wacca.model.db
import icu.samnyan.aqua.net.games.GenericPlaylogRepo
import icu.samnyan.aqua.net.games.GenericUserDataRepo
import jakarta.transaction.Transactional
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.NoRepositoryBean
import org.springframework.stereotype.Component
interface WcUserRepo : JpaRepository<WaccaUser, Long> {
interface WcUserRepo : JpaRepository<WaccaUser, Long>, GenericUserDataRepo<WaccaUser> {
fun findByCardExtId(extId: Long): WaccaUser?
}