Implement creating food
This commit is contained in:
12
app.go
12
app.go
@@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user