Add createJWTMiddleware helper that sets database.Users object in context, matching the original main.go JWT middleware behavior. This fixes 'authentication context error' panics in handlers that call MustGetAuthenticatedUser. Changes: - Add createJWTMiddleware() in router.go - Update all route files to use the helper - Set user claims AND database.Users object in context
21 lines
745 B
Go
21 lines
745 B
Go
package router
|
|
|
|
func registerConflictRoutes(cfg *Config) {
|
|
e := cfg.Echo
|
|
|
|
// JWT middleware for protected routes
|
|
jwtMiddleware := createJWTMiddleware(cfg)
|
|
|
|
protected := e.Group("/api", jwtMiddleware)
|
|
|
|
// Conflict resolution routes
|
|
conflicts := protected.Group("/conflicts")
|
|
conflicts.GET("", cfg.ConflictHandler.ListConflicts)
|
|
conflicts.GET("/:id", cfg.ConflictHandler.GetConflict)
|
|
conflicts.POST("/:id/resolve", cfg.ConflictHandler.ResolveConflict)
|
|
conflicts.DELETE("/:id", cfg.ConflictHandler.DeleteConflict)
|
|
conflicts.POST("/dismiss-all", cfg.ConflictHandler.DismissAllResolved)
|
|
conflicts.POST("/bulk-resolve", cfg.ConflictHandler.BulkResolveConflicts)
|
|
conflicts.POST("/bulk-dismiss", cfg.ConflictHandler.BulkDismissConflicts)
|
|
}
|