package categoryrepository

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

func (a *accessor) GetIDByCode(codes []string) ([]string, error) {
	var categories []string

	if err := a.db.
		Model(&categorydomain.Category{}).
		Select("id").Where("code IN ?", codes).
		Pluck("id", &categories).
		Error; err != nil {
		return nil, err
	}

	return categories, nil
}
