Merged in feature/e2etest (pull request #74)
Feature/e2etest * e2etest * testcleanups
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package document
|
||||
|
||||
import (
|
||||
"context"
|
||||
"queryorchestration/internal/database"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type DocumentInList struct {
|
||||
ID uuid.UUID
|
||||
Bucket string
|
||||
Key string
|
||||
}
|
||||
|
||||
func (s *Service) ListByJobId(ctx context.Context, id uuid.UUID) ([]*DocumentInList, error) {
|
||||
documents, err := s.cfg.GetDBQueries().ListDocumentsByJobId(ctx, database.MustToDBUUID(id))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
docs := make([]*DocumentInList, len(documents))
|
||||
for i, doc := range documents {
|
||||
docs[i] = &DocumentInList{
|
||||
ID: database.MustToUUID(doc.ID),
|
||||
Bucket: doc.Bucket,
|
||||
Key: doc.Key,
|
||||
}
|
||||
}
|
||||
|
||||
return docs, nil
|
||||
}
|
||||
Reference in New Issue
Block a user