added new tests for API Endpoints

This commit is contained in:
2026-04-14 21:43:43 +02:00
parent aca4e72a7a
commit 06f67a833c
3 changed files with 1224 additions and 1 deletions
File diff suppressed because it is too large Load Diff
-1
View File
@@ -57,7 +57,6 @@ func TestGetMasterData(t *testing.T) {
character.RegisterRoutes(protected) character.RegisterRoutes(protected)
gsmaster.RegisterRoutes(protected) gsmaster.RegisterRoutes(protected)
RegisterRoutes(protected) RegisterRoutes(protected)
protected.GET("/maintenance", gsmaster.GetMasterData)
protected.GET("/test", func(c *gin.Context) { protected.GET("/test", func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"status": "Test OK"}) c.JSON(http.StatusOK, gin.H{"status": "Test OK"})
}) })
+11
View File
@@ -397,6 +397,17 @@ func (object *Spell) Save() error {
return nil return nil
} }
func (object *Spell) Delete() error {
result := database.DB.Delete(&object, object.ID)
if result.Error != nil {
return result.Error
}
if result.RowsAffected == 0 {
return fmt.Errorf("no record found with ID %v", object.ID)
}
return nil
}
// SelectSpells gibt alle Zauber zurück, optional gefiltert nach einem Feld // SelectSpells gibt alle Zauber zurück, optional gefiltert nach einem Feld
func SelectSpells(opts ...string) ([]Spell, error) { func SelectSpells(opts ...string) ([]Spell, error) {
fieldName := "" fieldName := ""