Merged in feature/textExtractionsPart3 (pull request #195)

enrich doc responses

* enrich doc responses
This commit is contained in:
Jay Brown
2025-12-11 14:25:51 +00:00
parent a94637ab13
commit 8c218f162b
22 changed files with 1797 additions and 363 deletions
@@ -94,6 +94,52 @@ func (q *Queries) CreateDocument(ctx context.Context, arg *CreateDocumentParams)
return id, err
}
const getDocumentEnriched = `-- name: GetDocumentEnriched :one
SELECT
d.id,
d.clientId,
d.hash,
d.folderId,
d.filename,
d.originalPath
FROM documents d
WHERE d.id = $1
`
type GetDocumentEnrichedRow struct {
ID uuid.UUID `db:"id"`
Clientid string `db:"clientid"`
Hash string `db:"hash"`
Folderid *uuid.UUID `db:"folderid"`
Filename *string `db:"filename"`
Originalpath *string `db:"originalpath"`
}
// Retrieves a document with extended metadata including folder and filename
//
// SELECT
// d.id,
// d.clientId,
// d.hash,
// d.folderId,
// d.filename,
// d.originalPath
// FROM documents d
// WHERE d.id = $1
func (q *Queries) GetDocumentEnriched(ctx context.Context, id uuid.UUID) (*GetDocumentEnrichedRow, error) {
row := q.db.QueryRow(ctx, getDocumentEnriched, id)
var i GetDocumentEnrichedRow
err := row.Scan(
&i.ID,
&i.Clientid,
&i.Hash,
&i.Folderid,
&i.Filename,
&i.Originalpath,
)
return &i, err
}
const getDocumentEntry = `-- name: GetDocumentEntry :one
SELECT documentId, bucket, key FROM documentEntries WHERE documentId = $1 ORDER BY id DESC LIMIT 1
`