package categorysvc

import (
	categorydomain "legalgo-BE-go/internal/domain/category"
	timeutils "legalgo-BE-go/internal/utilities/time_utils"
)

func (i *impl) Update(categoryID string, spec categorydomain.CategoryReq) error {
	updateData := categorydomain.Category{
		ID:        categoryID,
		Name:      spec.Name,
		Code:      spec.Code,
		UpdatedAt: timeutils.Now(),
	}

	if err := i.categoryRepo.Update(updateData); err != nil {
		return err
	}

	return nil
}
