[FIX] Fix Gin route conflict for user routes
- Change :userId to :id in avatar routes for consistency - Fixes panic: ':userId' conflicts with existing wildcard ':id' - All routes now use consistent :id parameter
This commit is contained in:
parent
db7ad3dd7a
commit
00a4a09f2c
1 changed files with 4 additions and 4 deletions
|
|
@ -595,8 +595,8 @@ func (r *APIRouter) setupUserRoutes(router *gin.RouterGroup) {
|
|||
// BE-API-007: User role assignment routes
|
||||
roleService := services.NewRoleService(r.db.GormDB)
|
||||
roleHandler := handlers.NewRoleHandler(roleService, r.logger)
|
||||
protected.POST("/:userId/roles", roleHandler.AssignRole) // POST /api/v1/users/:userId/roles
|
||||
protected.DELETE("/:userId/roles/:roleId", roleHandler.RevokeRole) // DELETE /api/v1/users/:userId/roles/:roleId
|
||||
protected.POST("/:id/roles", roleHandler.AssignRole) // POST /api/v1/users/:id/roles
|
||||
protected.DELETE("/:id/roles/:roleId", roleHandler.RevokeRole) // DELETE /api/v1/users/:id/roles/:roleId
|
||||
|
||||
// BE-API-021: Avatar upload endpoint
|
||||
// BE-API-022: Avatar delete endpoint
|
||||
|
|
@ -606,8 +606,8 @@ func (r *APIRouter) setupUserRoutes(router *gin.RouterGroup) {
|
|||
}
|
||||
imageService := services.NewImageService(avatarUploadDir)
|
||||
avatarHandler := handlers.NewAvatarHandler(imageService, userService)
|
||||
protected.POST("/:userId/avatar", avatarHandler.UploadAvatar) // BE-API-021: Upload avatar endpoint
|
||||
protected.DELETE("/:userId/avatar", avatarHandler.DeleteAvatar) // BE-API-022: Delete avatar endpoint
|
||||
protected.POST("/:id/avatar", avatarHandler.UploadAvatar) // BE-API-021: Upload avatar endpoint
|
||||
protected.DELETE("/:id/avatar", avatarHandler.DeleteAvatar) // BE-API-022: Delete avatar endpoint
|
||||
|
||||
// BE-API-027: User liked tracks endpoint
|
||||
// Initialize TrackLikeService and minimal TrackHandler for user liked tracks
|
||||
|
|
|
|||
Loading…
Reference in a new issue