mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
34 lines
1.2 KiB
Go
34 lines
1.2 KiB
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
_ "net/http/pprof"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
func (s Server) MountHandlers() {
|
|
// public
|
|
s.Router.GET("/debug/pprof/*", echo.WrapHandler(http.DefaultServeMux))
|
|
s.Router.POST("/", handleExtension())
|
|
// authentication
|
|
s.Router.GET("/", handleLoginPage(s.as))
|
|
s.Router.GET("/auth", handleProvider())
|
|
s.Router.GET("/auth/callback", handleProviderCallback())
|
|
s.Router.GET("/logout", handleProviderLogout())
|
|
// admin
|
|
g := s.Router.Group("")
|
|
g.GET("/bookings", handleListBookingPage(s.bs, s.hc))
|
|
g.GET("/bookings/new", handleNewBookingPage(s.hc))
|
|
g.POST("/bookings/new", handleCreateBooking(s.bs))
|
|
g.GET("/bookings/:id", handleBookingPage(s.bs, s.hc))
|
|
g.PUT("/bookings/:id", handleUpdateBooking(s.bs, s.hc))
|
|
g.POST("/bookings/:id/items", handleCreateItem(s.bs))
|
|
g.POST("/items/:id", handlePayItem(s.bs))
|
|
g.PUT("/items/:id", handleUpdateItem(s.bs))
|
|
g.GET("/items/:id", handleLineItemForm(s.bs))
|
|
g.GET("/bookings/pdf/:id", handleCreateInvoicePdf(s.bs, s.ps, s.hc))
|
|
g.GET("/reports", handleReportsPage())
|
|
g.GET("/reports/do", handleComputeReport(s.bs, s.hc))
|
|
g.GET("/reports/pdf", handleCreateReportPdf(s.bs, s.ps))
|
|
}
|