2025-01-21 18:24:14 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"queryorchestration/internal/database"
|
|
|
|
|
|
|
|
|
|
"github.com/google/uuid"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func (s *Service) Create(ctx context.Context, name string) (uuid.UUID, error) {
|
2025-01-29 16:26:11 +00:00
|
|
|
err := normalizeName(&name)
|
2025-01-21 18:24:14 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return uuid.Nil, err
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-31 13:43:55 +00:00
|
|
|
id, err := s.cfg.GetDBQueries().CreateClient(ctx, name)
|
2025-01-21 18:24:14 +00:00
|
|
|
if err != nil {
|
|
|
|
|
return uuid.Nil, err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return database.MustToUUID(id), nil
|
|
|
|
|
}
|