package categoryrepository

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

	"github.com/google/uuid"
)

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

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

	return nil
}
