Update Customer
This commit is contained in:
parent
cd1073d46a
commit
0839c04257
@ -41,7 +41,7 @@ func (u *User) ToEntity(ctx mycontext.Context) *entity.User {
|
|||||||
PartnerID: u.PartnerID,
|
PartnerID: u.PartnerID,
|
||||||
SiteID: u.SiteID,
|
SiteID: u.SiteID,
|
||||||
NIK: u.NIK,
|
NIK: u.NIK,
|
||||||
UserType: u.UserType,
|
UserType: "CUSTOMER",
|
||||||
PhoneNumber: u.PhoneNumber,
|
PhoneNumber: u.PhoneNumber,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -115,7 +115,7 @@ func (s *UserService) Update(ctx mycontext.Context, id int64, userReq *entity.Us
|
|||||||
return nil, errors.New("user not found")
|
return nil, errors.New("user not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ctx.IsAdmin() {
|
if !ctx.IsAdmin() && userReq.UserType != "CUSTOMER" {
|
||||||
if *existingUser.PartnerID != *userReq.PartnerID {
|
if *existingUser.PartnerID != *userReq.PartnerID {
|
||||||
return nil, errors.New("user partner cant be changed")
|
return nil, errors.New("user partner cant be changed")
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user