Implement creating food

This commit is contained in:
2024-08-09 21:20:02 +02:00
parent db34fe039e
commit d9ae2e1ab3
10 changed files with 171 additions and 84 deletions

12
app.go
View File

@@ -28,7 +28,6 @@ func (a *App) GetFood() WailsFood {
}
return WailsFood{Data: data, Success: true}
}
func (a *App) CreateFood(food Food) WailsFood1 {
data, err := foodService.Create(food)
if err != nil {
@@ -36,7 +35,6 @@ func (a *App) CreateFood(food Food) WailsFood1 {
}
return WailsFood1{Data: data, Success: true}
}
func (a *App) UpdateFood(food Food) WailsFood1 {
data, err := foodService.Update(food)
if err != nil {
@@ -45,10 +43,18 @@ func (a *App) UpdateFood(food Food) WailsFood1 {
return WailsFood1{Data: data, Success: true}
}
func (a *App) GetLastPer100(name string) WailsPer100 {
data, err := foodService.GetLastPer100(name)
if err != nil {
return WailsPer100{Success: false, Error: err.Error()}
}
return WailsPer100{Data: data, Success: true}
}
// region settings
func (a *App) GetSettings() settings {
return Settings
}
func (a *App) SetSetting(key string, value any) settings {
return settingsService.Set(key, value)
}
}