added frontend for

Equipment, Weapons, Weaponskills
This commit is contained in:
2025-01-18 20:59:54 +01:00
parent bf209173bc
commit abaff6c7f6
9 changed files with 589 additions and 117 deletions
+32
View File
@@ -228,6 +228,38 @@ func DeleteMDSkill(c *gin.Context) {
deleteMDItem[Skill](c)
}
//
func GetMDWeaponSkills(c *gin.Context) {
type dtaStruct struct {
Weaponskills []WeaponSkill `json:"weaponskills"`
}
var dta dtaStruct
if err := database.DB.Find(&dta.Weaponskills).Error; err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to retrieve Weaponskills"})
return
}
c.JSON(http.StatusOK, dta)
}
func GetMDWeaponSkill(c *gin.Context) {
getMDItem[WeaponSkill](c)
}
func UpdateMDWeaponSkill(c *gin.Context) {
updateMDItem[WeaponSkill](c)
}
func AddWeaponSkill(c *gin.Context) {
addMDItem[WeaponSkill](c)
}
func DeleteMDWeaponSkill(c *gin.Context) {
deleteMDItem[WeaponSkill](c)
}
//
func GetMDSkillCategories(c *gin.Context) {
var ski Skill
skillCategories, err := ski.GetSkillCategories()
+6 -5
View File
@@ -37,7 +37,7 @@ type Spell struct {
AP string `gorm:"default:1" json:"ap"`
Art string `gorm:"default:Gestenzauber" json:"art"`
Zauberdauer string `gorm:"default:10 sec" json:"zauberdauer"`
Reichweite string `json:"reichweite"`
Reichweite string `json:"reichweite"` // in m
Wirkungsziel string `json:"wirkungsziel"`
Wirkungsbereich string `json:"wirkungsbereich"`
Wirkungsdauer string `json:"wirkungsdauer"`
@@ -47,8 +47,9 @@ type Spell struct {
type Equipment struct {
LookupList
Gewicht float64 `json:"gewicht"`
Wert float64 `json:"wert"`
Gewicht float64 `json:"gewicht"` // in kg
Wert float64 `json:"wert"` // in Gold
PersonalItem bool `gorm:"default:false" json:"personal_item"`
}
type Weapon struct {
@@ -59,8 +60,8 @@ type Weapon struct {
type Container struct {
Equipment
Tragkraft float64 `json:"tragkraft"`
Volumen float64 `json:"volumen"`
Tragkraft float64 `json:"tragkraft"` // in kg
Volumen float64 `json:"volumen"` // in Liter
}
type Transportation struct {
+10 -5
View File
@@ -52,6 +52,11 @@ func MaintenanceRouterGrp(rt *gin.RouterGroup) *gin.RouterGroup {
rCharGrp.PUT("/skills/:id", gsmaster.UpdateMDSkill)
rCharGrp.POST("/skills", gsmaster.AddSkill)
rCharGrp.DELETE("/skills/:id", gsmaster.DeleteMDSkill)
rCharGrp.GET("/weaponskills", gsmaster.GetMDWeaponSkills)
rCharGrp.GET("/weaponskills/:id", gsmaster.GetMDWeaponSkill)
rCharGrp.PUT("/weaponskills/:id", gsmaster.UpdateMDWeaponSkill)
rCharGrp.POST("/weaponskills", gsmaster.AddWeaponSkill)
rCharGrp.DELETE("/weaponskills/:id", gsmaster.DeleteMDWeaponSkill)
rCharGrp.GET("/spells", gsmaster.GetMDSpells)
rCharGrp.GET("/spells/:id", gsmaster.GetMDSpell)
rCharGrp.PUT("/spells/:id", gsmaster.UpdateMDSpell)
@@ -62,11 +67,11 @@ func MaintenanceRouterGrp(rt *gin.RouterGroup) *gin.RouterGroup {
rCharGrp.PUT("/equipment/:id", gsmaster.UpdateMDEquipment)
rCharGrp.POST("/equipment", gsmaster.AddEquipment)
rCharGrp.DELETE("/equipment/:id", gsmaster.DeleteMDEquipment)
rCharGrp.GET("/weapon", gsmaster.GetMDWeapons)
rCharGrp.GET("/weapon/:id", gsmaster.GetMDWeapon)
rCharGrp.PUT("/weapon/:id", gsmaster.UpdateMDWeapon)
rCharGrp.POST("/weapon", gsmaster.AddWeapon)
rCharGrp.DELETE("/weapon/:id", gsmaster.DeleteMDWeapon)
rCharGrp.GET("/weapons", gsmaster.GetMDWeapons)
rCharGrp.GET("/weapons/:id", gsmaster.GetMDWeapon)
rCharGrp.PUT("/weapons/:id", gsmaster.UpdateMDWeapon)
rCharGrp.POST("/weapons", gsmaster.AddWeapon)
rCharGrp.DELETE("/weapons/:id", gsmaster.DeleteMDWeapon)
return rCharGrp
}