feat: update staff data
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package staffsvc
|
||||
|
||||
import (
|
||||
staffdomain "legalgo-BE-go/internal/domain/staff"
|
||||
)
|
||||
|
||||
func (as *impl) Update(id string, spec staffdomain.StaffUpdate) error {
|
||||
if _, err := as.staffRepo.GetStaffByID(id); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
newSpec := staffdomain.Staff{
|
||||
ID: id,
|
||||
Email: spec.Email,
|
||||
Name: spec.Name,
|
||||
ProfilePicture: spec.ProfilePicture,
|
||||
}
|
||||
|
||||
if err := as.staffRepo.Update(newSpec); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user