moved LP, AP and B to domain

This commit is contained in:
2024-12-30 16:11:01 +01:00
parent c1b90d09ff
commit 6a20587f42
3 changed files with 34 additions and 34 deletions
+31 -3
View File
@@ -15,7 +15,35 @@ type Eigenschaft struct {
Name string `gorm:"primaryKey" json:"name"`
Value int `json:"value"`
}
type Lp struct {
ID uint `gorm:"primaryKey" json:"id"`
CharacterID uint `gorm:"index" json:"character_id"`
Max int `json:"max"`
Value int `json:"value"`
}
type Ap struct {
ID uint `gorm:"primaryKey" json:"id"`
CharacterID uint `gorm:"index" json:"character_id"`
Max int `json:"max"`
Value int `json:"value"`
}
type B struct {
ID uint `gorm:"primaryKey" json:"id"`
CharacterID uint `gorm:"index" json:"character_id"`
Max int `json:"max"`
Value int `json:"value"`
}
/*
type Gestalt struct {
models.BamortCharTrait
}
*/
type Char struct {
models.BamortBase
Rasse string `json:"rasse"`
@@ -27,9 +55,9 @@ type Char struct {
Gewicht int `json:"gewicht"`
Glaube string `json:"glaube"`
Hand string `json:"hand"`
Lp models.Lp `gorm:"foreignKey:CharacterID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"lp"`
Ap models.Ap `gorm:"foreignKey:CharacterID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"ap"`
B models.B `gorm:"foreignKey:CharacterID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"b"`
Lp Lp `gorm:"foreignKey:CharacterID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"lp"`
Ap Ap `gorm:"foreignKey:CharacterID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"ap"`
B B `gorm:"foreignKey:CharacterID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"b"`
Merkmale models.Merkmale `gorm:"foreignKey:CharacterID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"merkmale"`
Eigenschaften []Eigenschaft `gorm:"foreignKey:CharacterID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"eigenschaften"`
Fertigkeiten []models.Fertigkeit `gorm:"foreignKey:CharacterID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE" json:"fertigkeiten"`
-28
View File
@@ -70,10 +70,6 @@ type Merkmale struct {
Groesse string `json:"groesse"`
}
type Gestalt struct {
BamortCharTrait
}
type Erfahrungsschatz struct {
BamortCharTrait
Value int `json:"value"`
@@ -86,30 +82,6 @@ type Bennies struct {
Sg int `json:"sg"`
}
type Lp struct {
ID uint `gorm:"primaryKey" json:"id"`
CharacterID uint `gorm:"index" json:"character_id"`
Max int `json:"max"`
Value int `json:"value"`
}
type Ap struct {
ID uint `gorm:"primaryKey" json:"id"`
CharacterID uint `gorm:"index" json:"character_id"`
Max int `json:"max"`
Value int `json:"value"`
}
type B struct {
ID uint `gorm:"primaryKey" json:"id"`
CharacterID uint `gorm:"index" json:"character_id"`
Max int `json:"max"`
Value int `json:"value"`
}
type Behaeltniss struct {
BamortCharTrait
Beschreibung string `json:"beschreibung"`
+3 -3
View File
@@ -18,9 +18,9 @@ func initTestDB4Character() *gorm.DB {
db := SetupTestDB()
db.AutoMigrate(
&character.Char{},
&models.Lp{},
&models.Ap{},
&models.B{},
&character.Lp{},
&character.Ap{},
&character.B{},
&models.Merkmale{},
&character.Eigenschaft{},
&models.Fertigkeit{},