Files
query-orchestration/internal/job/get.go
T
Jay Brown 15adaebfcd Merged in feature/serviceconfig-integration (pull request #38)
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
2025-01-31 13:43:55 +00:00

32 lines
576 B
Go

package job
import (
"context"
"queryorchestration/internal/database"
"github.com/google/uuid"
)
func (s *Service) Get(ctx context.Context, id uuid.UUID) (*Job, error) {
job, err := s.cfg.GetDBQueries().GetJob(ctx, database.MustToDBUUID(id))
if err != nil {
return nil, err
}
client, err := s.svc.Client.Get(ctx, database.MustToUUID(job.Clientid))
if err != nil {
return nil, err
}
canSync := job.Cansync
if !client.CanSync {
canSync = false
}
return &Job{
ID: id,
ClientID: database.MustToUUID(job.Clientid),
CanSync: canSync,
}, nil
}