62886dbba8
Remove Job * removejob * rmjob * sync * cleanup * precommit * startslow * startslow * startslow * openapi * clean * test * scripts * littlecleanercmds * mermaid
34 lines
643 B
Go
34 lines
643 B
Go
package document
|
|
|
|
import (
|
|
"context"
|
|
|
|
"queryorchestration/internal/database"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type DocumentInList struct {
|
|
ID uuid.UUID
|
|
Bucket string
|
|
Key string
|
|
}
|
|
|
|
func (s *Service) ListByClientId(ctx context.Context, id uuid.UUID) ([]*DocumentInList, error) {
|
|
documents, err := s.cfg.GetDBQueries().ListDocumentsByClientId(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
|
|
}
|