0df3d16976
Query Version Sync Runner * testing * queryversiosyncworking * update * tests * fixtests
36 lines
739 B
Go
36 lines
739 B
Go
package resultsync
|
|
|
|
import (
|
|
"context"
|
|
"queryorchestration/internal/serviceconfig/queue"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type Body struct {
|
|
DocumentID uuid.UUID `json:"document_id" validate:"required,uuid"`
|
|
QueryID uuid.UUID `json:"query_id" validate:"required,uuid"`
|
|
}
|
|
|
|
func (s *Service) TriggerMultiSync(ctx context.Context, documentID uuid.UUID, queryIDs []uuid.UUID) error {
|
|
for _, id := range queryIDs {
|
|
err := s.TriggerSync(ctx, &Body{
|
|
DocumentID: documentID,
|
|
QueryID: id,
|
|
})
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
func (s *Service) TriggerSync(ctx context.Context, params *Body) error {
|
|
return s.cfg.SendToQueue(ctx, &queue.SendParams{
|
|
QueueURL: s.cfg.GetQueryURL(),
|
|
Body: params,
|
|
})
|
|
}
|