Implement clear

This commit is contained in:
Jan Bader 2022-01-26 21:38:41 +00:00
parent 430c4d52da
commit 0e438e0244
2 changed files with 9 additions and 6 deletions

View File

@ -50,7 +50,6 @@ func (h *Handler) Serve() {
withBudget.Use(h.verifyLoginWithForbidden) withBudget.Use(h.verifyLoginWithForbidden)
withBudget.GET("/budget/:budgetid/:year/:month", h.budgeting) withBudget.GET("/budget/:budgetid/:year/:month", h.budgeting)
withBudget.GET("/budget/:budgetid/all-accounts", h.allAccounts) withBudget.GET("/budget/:budgetid/all-accounts", h.allAccounts)
withBudget.GET("/budget/:budgetid/settings/clear", h.clearBudget)
withBudget.GET("/budget/:budgetid/settings/clean-negative", h.cleanNegativeBudget) withBudget.GET("/budget/:budgetid/settings/clean-negative", h.cleanNegativeBudget)
withBudget.GET("/budget/:budgetid/transaction/:transactionid", h.transaction) withBudget.GET("/budget/:budgetid/transaction/:transactionid", h.transaction)
@ -66,10 +65,9 @@ func (h *Handler) Serve() {
authenticated.GET("/dashboard", h.dashboard) authenticated.GET("/dashboard", h.dashboard)
authenticated.GET("/account/:accountid/transactions", h.transactionsForAccount) authenticated.GET("/account/:accountid/transactions", h.transactionsForAccount)
authenticated.GET("/admin/clear-database", h.clearDatabase) authenticated.GET("/admin/clear-database", h.clearDatabase)
authenticated.GET("/budget/:budgetid", h.budgeting)
withBudget2 := authenticated.Group("") authenticated.POST("/budget/:budgetid/import/ynab", h.importYNAB)
withBudget2.GET("/budget/:budgetid", h.budgeting) authenticated.POST("/budget/:budgetid/settings/clear", h.clearBudget)
withBudget2.POST("/budget/:budgetid/import/ynab", h.importYNAB)
budget := authenticated.Group("/budget") budget := authenticated.Group("/budget")
budget.POST("/new", h.newBudget) budget.POST("/new", h.newBudget)

View File

@ -24,7 +24,12 @@ export default {
this.$data.transactionsFile = e.target.files[0]; this.$data.transactionsFile = e.target.files[0];
}, },
clearBudget() { clearBudget() {
// <a href="/budget/{{$store.getters.CurrentBudget.ID}}/settings/clear">Clear budget</a> fetch("/api/v1/budget/" + this.$store.getters.CurrentBudget.ID + "/settings/clear", {
method: "POST",
headers: {
'Authorization': 'Bearer ' + this.$store.state.Session.Token
},
})
}, },
cleanNegative() { cleanNegative() {
// <a href="/budget/{{.Budget.ID}}/settings/clean-negative">Fix all historic negative category-balances</a> // <a href="/budget/{{.Budget.ID}}/settings/clean-negative">Fix all historic negative category-balances</a>