mirror of https://github.com/hykilpikonna/AquaDX
[+] Unlock option database model
parent
a952674df7
commit
752d65557f
|
@ -0,0 +1,35 @@
|
||||||
|
package icu.samnyan.aqua.net.db
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||||
|
import ext.SettingField
|
||||||
|
import jakarta.persistence.Entity
|
||||||
|
import jakarta.persistence.GeneratedValue
|
||||||
|
import jakarta.persistence.GenerationType
|
||||||
|
import jakarta.persistence.Id
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
class AquaGameOptions(
|
||||||
|
@Id @JsonIgnore
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
var id: Long = 0,
|
||||||
|
|
||||||
|
@SettingField("Unlock All Music",
|
||||||
|
"Unlock all music and master difficulty in game")
|
||||||
|
val unlockMusic: Boolean = false,
|
||||||
|
|
||||||
|
@SettingField("Unlock All Chara",
|
||||||
|
"Unlock all characters and partners in game")
|
||||||
|
val unlockChara: Boolean = false,
|
||||||
|
|
||||||
|
@SettingField("Unlock All Collectables",
|
||||||
|
"Unlock all collectables (nameplate, title, icon, frame) in game. " +
|
||||||
|
"This setting is not relevant in chusan because in-game user box is disabled in chusan.")
|
||||||
|
val unlockCollectables: Boolean = false,
|
||||||
|
|
||||||
|
@SettingField("Unlock All Tickets" ,
|
||||||
|
"Unlock all map tickets (the game still limits which tickets can be used)")
|
||||||
|
val unlockTickets: Boolean = false,
|
||||||
|
)
|
||||||
|
|
||||||
|
interface AquaGameOptionsRepository : JpaRepository<AquaGameOptions, Long>
|
|
@ -11,7 +11,6 @@ import icu.samnyan.aqua.sega.general.model.Card
|
||||||
import jakarta.persistence.*
|
import jakarta.persistence.*
|
||||||
import org.springframework.data.jpa.repository.JpaRepository
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
import org.springframework.security.crypto.password.PasswordEncoder
|
import org.springframework.security.crypto.password.PasswordEncoder
|
||||||
import org.springframework.stereotype.Repository
|
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import java.io.Serializable
|
import java.io.Serializable
|
||||||
import kotlin.jvm.optionals.getOrNull
|
import kotlin.jvm.optionals.getOrNull
|
||||||
|
@ -19,8 +18,7 @@ import kotlin.reflect.KFunction
|
||||||
import kotlin.reflect.KMutableProperty
|
import kotlin.reflect.KMutableProperty
|
||||||
import kotlin.reflect.full.functions
|
import kotlin.reflect.full.functions
|
||||||
|
|
||||||
@Entity(name = "AquaNetUser")
|
@Entity
|
||||||
@Table(name = "aqua_net_user")
|
|
||||||
class AquaNetUser(
|
class AquaNetUser(
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@ -75,6 +73,10 @@ class AquaNetUser(
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@OneToMany(mappedBy = "user", cascade = [CascadeType.ALL])
|
@OneToMany(mappedBy = "user", cascade = [CascadeType.ALL])
|
||||||
var keychipSessions: MutableList<KeychipSession> = mutableListOf(),
|
var keychipSessions: MutableList<KeychipSession> = mutableListOf(),
|
||||||
|
|
||||||
|
@OneToOne(cascade = [CascadeType.ALL])
|
||||||
|
@JoinColumn(name = "gameOptions", unique = true, nullable = true)
|
||||||
|
var gameOptions: AquaGameOptions? = null
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
val computedName get() = displayName.ifEmpty { username }
|
val computedName get() = displayName.ifEmpty { username }
|
||||||
|
|
||||||
|
@ -89,7 +91,6 @@ class AquaNetUser(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Repository("AquaNetUserRepository")
|
|
||||||
interface AquaNetUserRepo : JpaRepository<AquaNetUser, Long> {
|
interface AquaNetUserRepo : JpaRepository<AquaNetUser, Long> {
|
||||||
fun findByAuId(auId: Long): AquaNetUser?
|
fun findByAuId(auId: Long): AquaNetUser?
|
||||||
fun findByEmailIgnoreCase(email: String): AquaNetUser?
|
fun findByEmailIgnoreCase(email: String): AquaNetUser?
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
CREATE TABLE aqua_game_options
|
||||||
|
(
|
||||||
|
id BIGINT AUTO_INCREMENT NOT NULL,
|
||||||
|
unlock_music BIT(1) NOT NULL,
|
||||||
|
unlock_chara BIT(1) NOT NULL,
|
||||||
|
unlock_collectables BIT(1) NOT NULL,
|
||||||
|
unlock_tickets BIT(1) NOT NULL,
|
||||||
|
CONSTRAINT pk_aquagameoptions PRIMARY KEY (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE aqua_net_user
|
||||||
|
ADD game_options BIGINT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE aqua_net_user
|
||||||
|
ADD CONSTRAINT uc_aquanetuser_gameoptions UNIQUE (game_options);
|
||||||
|
|
||||||
|
ALTER TABLE aqua_net_user
|
||||||
|
ADD CONSTRAINT FK_AQUANETUSER_ON_GAMEOPTIONS FOREIGN KEY (game_options) REFERENCES aqua_game_options (id);
|
Loading…
Reference in New Issue