Add the whole api stack for weight
This commit is contained in:
44
app.go
44
app.go
@@ -80,6 +80,50 @@ func (a *App) GetYearlyFood() WailsAggregateFood {
|
||||
return WailsAggregateFood{Data: data, Success: true}
|
||||
}
|
||||
|
||||
// region weight
|
||||
func (a *App) GetWeight() WailsWeight {
|
||||
data, err := weightService.GetRecent()
|
||||
if err != nil {
|
||||
return WailsWeight{Success: false, Error: err.Error()}
|
||||
}
|
||||
return WailsWeight{Data: data, Success: true}
|
||||
}
|
||||
func (a *App) CreateWeight(weight Weight) WailsWeight1 {
|
||||
data, err := weightService.Create(weight)
|
||||
if err != nil {
|
||||
return WailsWeight1{Success: false, Error: err.Error()}
|
||||
}
|
||||
return WailsWeight1{Data: data, Success: true}
|
||||
}
|
||||
func (a *App) GetDailyWeight() WailsAggregateWeight {
|
||||
data, err := weightService.GetDaily()
|
||||
if err != nil {
|
||||
return WailsAggregateWeight{Success: false, Error: err.Error()}
|
||||
}
|
||||
return WailsAggregateWeight{Data: data, Success: true}
|
||||
}
|
||||
func (a *App) GetWeeklyWeight() WailsAggregateWeight {
|
||||
data, err := weightService.GetWeekly()
|
||||
if err != nil {
|
||||
return WailsAggregateWeight{Success: false, Error: err.Error()}
|
||||
}
|
||||
return WailsAggregateWeight{Data: data, Success: true}
|
||||
}
|
||||
func (a *App) GetMonthlyWeight() WailsAggregateWeight {
|
||||
data, err := weightService.GetMonthly()
|
||||
if err != nil {
|
||||
return WailsAggregateWeight{Success: false, Error: err.Error()}
|
||||
}
|
||||
return WailsAggregateWeight{Data: data, Success: true}
|
||||
}
|
||||
func (a *App) GetYearlyWeight() WailsAggregateWeight {
|
||||
data, err := weightService.GetYearly()
|
||||
if err != nil {
|
||||
return WailsAggregateWeight{Success: false, Error: err.Error()}
|
||||
}
|
||||
return WailsAggregateWeight{Data: data, Success: true}
|
||||
}
|
||||
|
||||
// region settings
|
||||
func (a *App) GetSettings() settings {
|
||||
return Settings
|
||||
|
Reference in New Issue
Block a user