Reorganize routes and remove legacy ones
This commit is contained in:
parent
27ce8d250f
commit
52bb343402
@ -41,20 +41,12 @@ func (h *Handler) LoadRoutes(router *gin.Engine) {
|
|||||||
router.Use(enableCachingForStaticFiles())
|
router.Use(enableCachingForStaticFiles())
|
||||||
router.NoRoute(h.ServeStatic)
|
router.NoRoute(h.ServeStatic)
|
||||||
|
|
||||||
withLogin := router.Group("")
|
|
||||||
withLogin.Use(h.verifyLoginWithRedirect)
|
|
||||||
|
|
||||||
withBudget := router.Group("")
|
|
||||||
withBudget.Use(h.verifyLoginWithForbidden)
|
|
||||||
withBudget.GET("/budget/:budgetid/:year/:month", h.budgeting)
|
|
||||||
withBudget.GET("/budget/:budgetid/settings/clean-negative", h.cleanNegativeBudget)
|
|
||||||
|
|
||||||
api := router.Group("/api/v1")
|
api := router.Group("/api/v1")
|
||||||
|
|
||||||
unauthenticated := api.Group("/user")
|
anonymous := api.Group("/user")
|
||||||
unauthenticated.GET("/login", func(c *gin.Context) { c.Redirect(http.StatusPermanentRedirect, "/login") })
|
anonymous.GET("/login", func(c *gin.Context) { c.Redirect(http.StatusPermanentRedirect, "/login") })
|
||||||
unauthenticated.POST("/login", h.loginPost)
|
anonymous.POST("/login", h.loginPost)
|
||||||
unauthenticated.POST("/register", h.registerPost)
|
anonymous.POST("/register", h.registerPost)
|
||||||
|
|
||||||
authenticated := api.Group("")
|
authenticated := api.Group("")
|
||||||
authenticated.Use(h.verifyLoginWithForbidden)
|
authenticated.Use(h.verifyLoginWithForbidden)
|
||||||
@ -62,18 +54,19 @@ func (h *Handler) LoadRoutes(router *gin.Engine) {
|
|||||||
authenticated.GET("/account/:accountid/transactions", h.transactionsForAccount)
|
authenticated.GET("/account/:accountid/transactions", h.transactionsForAccount)
|
||||||
authenticated.POST("/account/:accountid", h.editAccount)
|
authenticated.POST("/account/:accountid", h.editAccount)
|
||||||
authenticated.GET("/admin/clear-database", h.clearDatabase)
|
authenticated.GET("/admin/clear-database", h.clearDatabase)
|
||||||
authenticated.GET("/budget/:budgetid", h.budgeting)
|
|
||||||
authenticated.GET("/budget/:budgetid/:year/:month", h.budgetingForMonth)
|
|
||||||
authenticated.GET("/budget/:budgetid/autocomplete/payees", h.autocompletePayee)
|
|
||||||
authenticated.GET("/budget/:budgetid/autocomplete/categories", h.autocompleteCategories)
|
|
||||||
authenticated.DELETE("/budget/:budgetid", h.deleteBudget)
|
|
||||||
authenticated.POST("/budget/:budgetid/import/ynab", h.importYNAB)
|
|
||||||
authenticated.POST("/budget/:budgetid/export/ynab/transactions", h.exportYNABTransactions)
|
|
||||||
authenticated.POST("/budget/:budgetid/export/ynab/assignments", h.exportYNABAssignments)
|
|
||||||
authenticated.POST("/budget/:budgetid/settings/clear", h.clearBudget)
|
|
||||||
|
|
||||||
budget := authenticated.Group("/budget")
|
budget := authenticated.Group("/budget")
|
||||||
budget.POST("/new", h.newBudget)
|
budget.POST("/new", h.newBudget)
|
||||||
|
budget.GET("/:budgetid", h.budgeting)
|
||||||
|
budget.GET("/:budgetid/:year/:month", h.budgetingForMonth)
|
||||||
|
budget.GET("/:budgetid/autocomplete/payees", h.autocompletePayee)
|
||||||
|
budget.GET("/:budgetid/autocomplete/categories", h.autocompleteCategories)
|
||||||
|
budget.DELETE("/:budgetid", h.deleteBudget)
|
||||||
|
budget.POST("/:budgetid/import/ynab", h.importYNAB)
|
||||||
|
budget.POST("/:budgetid/export/ynab/transactions", h.exportYNABTransactions)
|
||||||
|
budget.POST("/:budgetid/export/ynab/assignments", h.exportYNABAssignments)
|
||||||
|
budget.POST("/:budgetid/settings/clear", h.clearBudget)
|
||||||
|
budget.POST("/:budgetid/settings/clean-negative", h.cleanNegativeBudget)
|
||||||
|
|
||||||
transaction := authenticated.Group("/transaction")
|
transaction := authenticated.Group("/transaction")
|
||||||
transaction.POST("/new", h.newTransaction)
|
transaction.POST("/new", h.newTransaction)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user