15adaebfcd
DRAFT PR : WIP working through ideas for integration * movearound * attempttwo * openapi * further sanding * fix * start on tests * runthroughsingleconfig * somechanges * reflectissue * removeerrs * mostlyremovepanic * removeenv * noncfgtests * go * repo * fix service config test * add PWD to all * test fix * fix lint * todo for later * passingunittests * alltests * testlogger * testloggername * clean
28 lines
536 B
Go
28 lines
536 B
Go
package job
|
|
|
|
import (
|
|
"context"
|
|
"queryorchestration/internal/database"
|
|
"queryorchestration/internal/job/collector"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
func (s *Service) Create(ctx context.Context, clientID uuid.UUID) (uuid.UUID, error) {
|
|
did, err := s.cfg.GetDBQueries().CreateJob(ctx, database.MustToDBUUID(clientID))
|
|
if err != nil {
|
|
return uuid.Nil, err
|
|
}
|
|
|
|
id := database.MustToUUID(did)
|
|
|
|
_, err = s.svc.Collector.Create(ctx, &collector.CreateParams{
|
|
JobID: id,
|
|
})
|
|
if err != nil {
|
|
return uuid.Nil, err
|
|
}
|
|
|
|
return id, nil
|
|
}
|