routes + repo fix
This commit is contained in:
parent
8186d8a46c
commit
88fcbfe1a5
2 changed files with 5 additions and 5 deletions
|
|
@ -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) {
|
func (h *Handler) RegisterRoutes(r *gin.RouterGroup, authMW gin.HandlerFunc, refreshMW gin.HandlerFunc) {
|
||||||
userGroup := r.Group("/user")
|
userGroup := r.Group("/user")
|
||||||
|
|
||||||
userGroup.POST("/", h.controller.register)
|
userGroup.POST("", h.controller.register)
|
||||||
userGroup.GET("/", authMW, h.controller.get)
|
userGroup.GET("", authMW, h.controller.get)
|
||||||
userGroup.PUT("/", authMW, h.controller.update)
|
userGroup.PUT("", authMW, h.controller.update)
|
||||||
userGroup.DELETE("/", authMW, h.controller.delete)
|
userGroup.DELETE("", authMW, h.controller.delete)
|
||||||
|
|
||||||
//auth
|
//auth
|
||||||
h.controller.authPath = fmt.Sprintf("%s/user/auth", h.apiPrefix)
|
h.controller.authPath = fmt.Sprintf("%s/user/auth", h.apiPrefix)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ func (r *repo) getByUuid(userUuid string) (user User, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repo) update(user map[string]any) 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 {
|
func (r *repo) delete(userUuid string) error {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue