Update Customer

This commit is contained in:
aditya.siregar 2024-08-30 01:52:42 +07:00
parent cd1073d46a
commit 0839c04257
2 changed files with 2 additions and 2 deletions

View File

@ -41,7 +41,7 @@ func (u *User) ToEntity(ctx mycontext.Context) *entity.User {
PartnerID: u.PartnerID,
SiteID: u.SiteID,
NIK: u.NIK,
UserType: u.UserType,
UserType: "CUSTOMER",
PhoneNumber: u.PhoneNumber,
}
}

View File

@ -115,7 +115,7 @@ func (s *UserService) Update(ctx mycontext.Context, id int64, userReq *entity.Us
return nil, errors.New("user not found")
}
if !ctx.IsAdmin() {
if !ctx.IsAdmin() && userReq.UserType != "CUSTOMER" {
if *existingUser.PartnerID != *userReq.PartnerID {
return nil, errors.New("user partner cant be changed")
}