27 lines
841 B
Go
27 lines
841 B
Go
package main
|
|
|
|
import "github.com/go-chi/chi/v5"
|
|
|
|
func (a *app) registerNotificationRoutes(r chi.Router) {
|
|
r.Route("/notifications", func(r chi.Router) {
|
|
r.Route("/templates", func(r chi.Router) {
|
|
r.Use(a.notificationsAdminMiddleware)
|
|
r.Get("/", a.listNotificationTemplates)
|
|
r.Post("/", a.createNotificationTemplate)
|
|
r.Get("/{id}", a.getNotificationTemplate)
|
|
r.Patch("/{id}", a.patchNotificationTemplate)
|
|
r.Delete("/{id}", a.deleteNotificationTemplate)
|
|
})
|
|
|
|
r.Route("/deliveries", func(r chi.Router) {
|
|
r.Use(a.notificationsAdminMiddleware)
|
|
r.Get("/", a.listNotificationDeliveries)
|
|
r.Post("/", a.createNotificationDelivery)
|
|
})
|
|
|
|
r.Get("/preferences", a.listNotificationPreferences)
|
|
r.Post("/preferences", a.createNotificationPreference)
|
|
r.Patch("/preferences/{id}", a.patchNotificationPreference)
|
|
})
|
|
}
|