Continued work on messages and notifications.
This commit is contained in:
@@ -22,7 +22,7 @@ package routes
|
||||
|
||||
import (
|
||||
accountHandler "synlotto-website/internal/handlers/account"
|
||||
accoutMessageHandler "synlotto-website/internal/handlers/account/messages"
|
||||
accountMsgHandlers "synlotto-website/internal/handlers/account/messages"
|
||||
accountNotificationHandler "synlotto-website/internal/handlers/account/notifications"
|
||||
accountTicketHandler "synlotto-website/internal/handlers/account/tickets"
|
||||
|
||||
@@ -33,6 +33,16 @@ import (
|
||||
func RegisterAccountRoutes(app *bootstrap.App) {
|
||||
r := app.Router
|
||||
|
||||
// Instantiate handlers that have method receivers
|
||||
messageSvc := app.Services.Messages
|
||||
msgH := &accountMsgHandlers.AccountMessageHandlers{Svc: messageSvc}
|
||||
|
||||
notificationSvc := app.Services.Notifications
|
||||
notifH := &accountNotificationHandler.AccountNotificationHandlers{Svc: notificationSvc}
|
||||
|
||||
// ticketSvc := app.Services.TicketService
|
||||
// ticketH := &accountTickets.AccountTicketHandlers{Svc: ticketSvc}
|
||||
|
||||
// Public account pages
|
||||
acc := r.Group("/account")
|
||||
acc.Use(middleware.PublicOnly())
|
||||
@@ -55,19 +65,19 @@ func RegisterAccountRoutes(app *bootstrap.App) {
|
||||
messages := r.Group("/account/messages")
|
||||
messages.Use(middleware.AuthMiddleware(), middleware.RequireAuth())
|
||||
{
|
||||
messages.GET("/", accoutMessageHandler.List)
|
||||
messages.GET("/add", accoutMessageHandler.AddGet)
|
||||
messages.POST("/add", accoutMessageHandler.AddPost)
|
||||
messages.GET("/archived", accoutMessageHandler.ArchivedList) // renders archived.html
|
||||
messages.GET("/:id", accoutMessageHandler.ReadGet) // renders read.html
|
||||
messages.GET("/", msgH.List)
|
||||
messages.GET("/add", msgH.AddGet)
|
||||
messages.POST("/add", msgH.AddPost)
|
||||
messages.GET("/archived", msgH.ArchivedList) // renders archived.html
|
||||
messages.GET("/:id", msgH.ReadGet) // renders read.html
|
||||
}
|
||||
|
||||
// Notifications (auth-required)
|
||||
notifications := r.Group("/account/notifications")
|
||||
notifications.Use(middleware.AuthMiddleware(), middleware.RequireAuth())
|
||||
{
|
||||
notifications.GET("/", accountNotificationHandler.List)
|
||||
notifications.GET("/:id", accountNotificationHandler.ReadGet) // renders read.html
|
||||
notifications.GET("/", notifH.List)
|
||||
notifications.GET("/:id", notifH.ReadGet) // renders read.html
|
||||
}
|
||||
|
||||
// Tickets (auth-required)
|
||||
|
||||
Reference in New Issue
Block a user