routes + repo fix

This commit is contained in:
nquidox 2025-11-02 20:59:25 +03:00
parent 8186d8a46c
commit 88fcbfe1a5
2 changed files with 5 additions and 5 deletions

View file

@ -26,10 +26,10 @@ func newController(service *service, utils interfaces.Utils) *controller {
func (h *Handler) RegisterRoutes(r *gin.RouterGroup, authMW gin.HandlerFunc, refreshMW gin.HandlerFunc) {
userGroup := r.Group("/user")
userGroup.POST("/", h.controller.register)
userGroup.GET("/", authMW, h.controller.get)
userGroup.PUT("/", authMW, h.controller.update)
userGroup.DELETE("/", authMW, h.controller.delete)
userGroup.POST("", h.controller.register)
userGroup.GET("", authMW, h.controller.get)
userGroup.PUT("", authMW, h.controller.update)
userGroup.DELETE("", authMW, h.controller.delete)
//auth
h.controller.authPath = fmt.Sprintf("%s/user/auth", h.apiPrefix)

View file

@ -40,7 +40,7 @@ func (r *repo) getByUuid(userUuid string) (user User, err error) {
}
func (r *repo) update(user map[string]any) error {
return r.db.Where("uuid = ?", user["uuid"]).Updates(&user).Error
return r.db.Model(&User{}).Where("uuid = ?", user["uuid"]).Updates(&user).Error
}
func (r *repo) delete(userUuid string) error {