package staffrepository

import (
	staffdomain "legalgo-BE-go/internal/domain/staff"
	"legalgo-BE-go/internal/utilities/utils"
)

func (ur *impl) Update(spec staffdomain.Staff) error {
	val, err := utils.StructToMap(spec)
	if err != nil {
		return err
	}

	if err := ur.db.Model(&staffdomain.Staff{}).Where("id = ?", spec.ID).Updates(val).Error; err != nil {
		return err
	}

	return nil
}
