Merged in feature/jobcrud (pull request #35)
Job CRUD + Collector Integration * startedcreate * openapispec * createjobintegration * jobgetcontroller * jobcreateclient * updatejob * job * collector
This commit is contained in:
@@ -14,7 +14,7 @@ type CreateParams struct {
|
||||
JobID uuid.UUID
|
||||
MinCleanVersion *int32
|
||||
MinTextVersion *int32
|
||||
Fields map[string]uuid.UUID
|
||||
Fields *map[string]uuid.UUID
|
||||
}
|
||||
|
||||
func (s *Service) Create(ctx context.Context, params *CreateParams) (uuid.UUID, error) {
|
||||
@@ -35,7 +35,7 @@ type dbCreateParams struct {
|
||||
JobID pgtype.UUID
|
||||
MinCleanVersion *int32
|
||||
MinTextVersion *int32
|
||||
Fields map[string]pgtype.UUID
|
||||
Fields *map[string]pgtype.UUID
|
||||
}
|
||||
|
||||
type fields struct {
|
||||
@@ -102,15 +102,17 @@ func (s *Service) submitCreate(ctx context.Context, params *dbCreateParams) (uui
|
||||
}
|
||||
}
|
||||
|
||||
for key, field := range params.Fields {
|
||||
err = qtx.AddCollectorQuery(ctx, &repository.AddCollectorQueryParams{
|
||||
Collectorid: dbID,
|
||||
Name: key,
|
||||
Queryid: field,
|
||||
Addedversion: latestVersion,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
if params.Fields != nil {
|
||||
for key, field := range *params.Fields {
|
||||
err = qtx.AddCollectorQuery(ctx, &repository.AddCollectorQueryParams{
|
||||
Collectorid: dbID,
|
||||
Name: key,
|
||||
Queryid: field,
|
||||
Addedversion: latestVersion,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user