Continued work around getting messages and notifications cleaned up since moving to MySQL and changing to Gin, SCS, NoSurf.
This commit is contained in:
@@ -21,10 +21,10 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
accountHandlers "synlotto-website/internal/handlers/account"
|
||||
accountMessageHandlers "synlotto-website/internal/handlers/account/messages"
|
||||
accountNotificationHandlers "synlotto-website/internal/handlers/account/notifications"
|
||||
accountTicketHandlers "synlotto-website/internal/handlers/account/tickets"
|
||||
accountHandler "synlotto-website/internal/handlers/account"
|
||||
accoutMessageHandler "synlotto-website/internal/handlers/account/messages"
|
||||
accountNotificationHandler "synlotto-website/internal/handlers/account/notifications"
|
||||
accountTicketHandler "synlotto-website/internal/handlers/account/tickets"
|
||||
|
||||
"synlotto-website/internal/http/middleware"
|
||||
"synlotto-website/internal/platform/bootstrap"
|
||||
@@ -37,45 +37,45 @@ func RegisterAccountRoutes(app *bootstrap.App) {
|
||||
acc := r.Group("/account")
|
||||
acc.Use(middleware.PublicOnly())
|
||||
{
|
||||
acc.GET("/login", accountHandlers.LoginGet)
|
||||
acc.POST("/login", accountHandlers.LoginPost)
|
||||
acc.GET("/signup", accountHandlers.SignupGet)
|
||||
acc.POST("/signup", accountHandlers.SignupPost)
|
||||
acc.GET("/login", accountHandler.LoginGet)
|
||||
acc.POST("/login", accountHandler.LoginPost)
|
||||
acc.GET("/signup", accountHandler.SignupGet)
|
||||
acc.POST("/signup", accountHandler.SignupPost)
|
||||
}
|
||||
|
||||
// Auth-required account actions
|
||||
accAuth := r.Group("/account")
|
||||
accAuth.Use(middleware.AuthMiddleware(), middleware.RequireAuth())
|
||||
{
|
||||
accAuth.POST("/logout", accountHandlers.Logout)
|
||||
accAuth.GET("/logout", accountHandlers.Logout) // optional
|
||||
accAuth.POST("/logout", accountHandler.Logout)
|
||||
accAuth.GET("/logout", accountHandler.Logout) // optional
|
||||
}
|
||||
|
||||
// Messages (auth-required)
|
||||
messages := r.Group("/account/messages")
|
||||
messages.Use(middleware.AuthMiddleware(), middleware.RequireAuth())
|
||||
{
|
||||
messages.GET("/", accountMessageHandlers.List)
|
||||
messages.GET("/add", accountMessageHandlers.AddGet)
|
||||
messages.POST("/add", accountMessageHandlers.AddPost)
|
||||
messages.GET("/archived", accountMessageHandlers.ArchivedList) // renders archived.html
|
||||
messages.GET("/:id", accountMessageHandlers.ReadGet) // renders read.html
|
||||
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
|
||||
}
|
||||
|
||||
// Notifications (auth-required)
|
||||
notifications := r.Group("/account/notifications")
|
||||
notifications.Use(middleware.AuthMiddleware(), middleware.RequireAuth())
|
||||
{
|
||||
notifications.GET("/", accountNotificationHandlers.List)
|
||||
notifications.GET("/:id", accountNotificationHandlers.ReadGet) // renders read.html
|
||||
notifications.GET("/", accountNotificationHandler.List)
|
||||
notifications.GET("/:id", accountNotificationHandler.ReadGet) // renders read.html
|
||||
}
|
||||
|
||||
// Tickets (auth-required)
|
||||
tickets := r.Group("/account/tickets")
|
||||
tickets.Use(middleware.AuthMiddleware(), middleware.RequireAuth())
|
||||
{
|
||||
tickets.GET("/", accountTicketHandlers.List) // GET /account/tickets
|
||||
tickets.GET("/add", accountTicketHandlers.AddGet) // GET /account/tickets/add
|
||||
tickets.POST("/add", accountTicketHandlers.AddPost) // POST /account/tickets/add
|
||||
tickets.GET("/", accountTicketHandler.List) // GET /account/tickets
|
||||
tickets.GET("/add", accountTicketHandler.AddGet) // GET /account/tickets/add
|
||||
tickets.POST("/add", accountTicketHandler.AddPost) // POST /account/tickets/add
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user