package staffrepository

import (
	authdomain "legalgo-BE-go/internal/domain/auth"
	"legalgo-BE-go/internal/utilities/utils"
)

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

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

	return nil
}
