rentease/internal/server/routes.go
2024-03-22 21:45:57 +01:00

21 lines
948 B
Go

package server
func (s Server) MountHandlers() {
// public
s.Router.GET("/", handleHomePage())
s.Router.POST("/request-booking", handleRequestBooking(s.bs))
// admin
s.Router.GET("/bookings", handleListBookingPage(s.bs, s.hc))
s.Router.GET("/bookings/new", handleNewBookingPage(s.hc))
s.Router.POST("/bookings/new", handleCreateBooking(s.bs))
s.Router.GET("/bookings/:id", handleBookingPage(s.bs, s.hc))
s.Router.PUT("/bookings/:id", handleUpdateBooking(s.bs, s.hc))
s.Router.POST("/bookings/:id/items", handleCreateItem(s.bs))
s.Router.POST("/items/:id", handlePayItem(s.bs))
s.Router.PUT("/items/:id", handleUpdateItem(s.bs))
s.Router.GET("/items/:id", handleLineItemForm(s.bs))
s.Router.GET("/bookings/pdf/:id", handleCreateInvoicePdf(s.bs, s.ps, s.hc))
s.Router.GET("/reports", handleReportsPage())
s.Router.GET("/reports/do", handleComputeReport(s.bs, s.hc))
s.Router.GET("/reports/pdf", handleCreateReportPdf(s.bs, s.ps))
}