generated from dave/wails-template
Rework the fuck of everything
This commit is contained in:
63
app.go
63
app.go
@@ -63,6 +63,69 @@ func (a *App) SetPaid(billid int64, month time.Time) WailsPayment {
|
||||
return res
|
||||
}
|
||||
|
||||
func (a *App) SetPaidWithDate(billid int64, month time.Time, paymentDate time.Time) WailsPayment {
|
||||
res := WailsPayment{}
|
||||
payment, err := service.MarkPaid(billid, month, paymentDate)
|
||||
if err!= nil {
|
||||
res.Success = false
|
||||
res.Error = err.Error()
|
||||
return res
|
||||
}
|
||||
res.Success = true
|
||||
res.Data = payment
|
||||
return res
|
||||
}
|
||||
|
||||
func (a *App) MovePayment(billid int64, fromMonth time.Time, toMonth time.Time) WailsPayment {
|
||||
res := WailsPayment{}
|
||||
payment, err := service.MovePayment(billid, fromMonth, toMonth)
|
||||
if err!= nil {
|
||||
res.Success = false
|
||||
res.Error = err.Error()
|
||||
return res
|
||||
}
|
||||
res.Success = true
|
||||
res.Data = payment
|
||||
return res
|
||||
}
|
||||
|
||||
func (a *App) AddBill(name string) WailsBill {
|
||||
res := WailsBill{}
|
||||
bill, err := service.AddBill(name)
|
||||
if err != nil {
|
||||
res.Success = false
|
||||
res.Error = err.Error()
|
||||
return res
|
||||
}
|
||||
res.Success = true
|
||||
res.Data = bill
|
||||
return res
|
||||
}
|
||||
|
||||
func (a *App) RemoveBill(billid int64) WailsVoid {
|
||||
res := WailsVoid{}
|
||||
err := service.RemoveBill(billid)
|
||||
if err != nil {
|
||||
res.Success = false
|
||||
res.Error = err.Error()
|
||||
return res
|
||||
}
|
||||
res.Success = true
|
||||
return res
|
||||
}
|
||||
|
||||
func (a *App) UnmarkPaid(billid int64, month time.Time) WailsVoid {
|
||||
res := WailsVoid{}
|
||||
err := service.UnmarkPaid(billid, month)
|
||||
if err != nil {
|
||||
res.Success = false
|
||||
res.Error = err.Error()
|
||||
return res
|
||||
}
|
||||
res.Success = true
|
||||
return res
|
||||
}
|
||||
|
||||
// These exist only so that wails generates models for Bill and Payment
|
||||
func (a *App) EmptyBill() Bill {
|
||||
return Bill{}
|
||||
|
||||
Reference in New Issue
Block a user