Use new rest lib (Update receives all columns that need to be updated)

This commit is contained in:
Deluan
2021-11-01 13:55:47 -04:00
parent b2acec0a09
commit 778f474d26
14 changed files with 46 additions and 26 deletions
+2 -1
View File
@@ -169,8 +169,9 @@ func (r *userRepository) Save(entity interface{}) (string, error) {
return u.ID, err
}
func (r *userRepository) Update(entity interface{}, cols ...string) error {
func (r *userRepository) Update(id string, entity interface{}, cols ...string) error {
u := entity.(*model.User)
u.ID = id
usr := loggedUser(r.ctx)
if !usr.IsAdmin && usr.ID != u.ID {
return rest.ErrPermissionDenied