package categoryrepository

import (
	categorydomain "legalgo-BE-go/internal/domain/category"

	"github.com/google/uuid"
)

func (a *accessor) Create(spec categorydomain.CategoryReq) error {
	data := categorydomain.Category{
		ID:   uuid.NewString(),
		Name: spec.Name,
		Code: spec.Code,
	}

	if err := a.DB.Create(&data).Error; err != nil {
		return err
	}

	return nil
}
