Merged in feature/textExtractionsPart1 (pull request #192)
all schema and rest apis for text extraction support * in progress * stage 8 complete * phase 9 completed * phase 9 complete * ongoing - s3 path fix * working * optimize ci build * e2e tests * missing test
This commit is contained in:
@@ -31,7 +31,7 @@ func (q *Queries) AddDocumentEntry(ctx context.Context, arg *AddDocumentEntryPar
|
||||
}
|
||||
|
||||
const addDocumentUpload = `-- name: AddDocumentUpload :exec
|
||||
INSERT INTO documentUploads (id, clientId, bucket, key, part, createdAt, filename, batch_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
INSERT INTO documentUploads (id, clientId, bucket, key, part, createdAt, filename, batch_id, folder_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
||||
`
|
||||
|
||||
type AddDocumentUploadParams struct {
|
||||
@@ -43,11 +43,12 @@ type AddDocumentUploadParams struct {
|
||||
Createdat pgtype.Timestamp `db:"createdat"`
|
||||
Filename *string `db:"filename"`
|
||||
BatchID *uuid.UUID `db:"batch_id"`
|
||||
FolderID *uuid.UUID `db:"folder_id"`
|
||||
}
|
||||
|
||||
// AddDocumentUpload
|
||||
//
|
||||
// INSERT INTO documentUploads (id, clientId, bucket, key, part, createdAt, filename, batch_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
// INSERT INTO documentUploads (id, clientId, bucket, key, part, createdAt, filename, batch_id, folder_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
||||
func (q *Queries) AddDocumentUpload(ctx context.Context, arg *AddDocumentUploadParams) error {
|
||||
_, err := q.db.Exec(ctx, addDocumentUpload,
|
||||
arg.ID,
|
||||
@@ -58,30 +59,35 @@ func (q *Queries) AddDocumentUpload(ctx context.Context, arg *AddDocumentUploadP
|
||||
arg.Createdat,
|
||||
arg.Filename,
|
||||
arg.BatchID,
|
||||
arg.FolderID,
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
const createDocument = `-- name: CreateDocument :one
|
||||
INSERT INTO documents (clientId, hash, batch_id, filename) VALUES ($1, $2, $3, $4) RETURNING id
|
||||
INSERT INTO documents (clientId, hash, batch_id, filename, folderId, originalPath) VALUES ($1, $2, $3, $4, $5, $6) RETURNING id
|
||||
`
|
||||
|
||||
type CreateDocumentParams struct {
|
||||
Clientid string `db:"clientid"`
|
||||
Hash string `db:"hash"`
|
||||
BatchID *uuid.UUID `db:"batch_id"`
|
||||
Filename *string `db:"filename"`
|
||||
Clientid string `db:"clientid"`
|
||||
Hash string `db:"hash"`
|
||||
BatchID *uuid.UUID `db:"batch_id"`
|
||||
Filename *string `db:"filename"`
|
||||
Folderid *uuid.UUID `db:"folderid"`
|
||||
Originalpath *string `db:"originalpath"`
|
||||
}
|
||||
|
||||
// CreateDocument
|
||||
//
|
||||
// INSERT INTO documents (clientId, hash, batch_id, filename) VALUES ($1, $2, $3, $4) RETURNING id
|
||||
// INSERT INTO documents (clientId, hash, batch_id, filename, folderId, originalPath) VALUES ($1, $2, $3, $4, $5, $6) RETURNING id
|
||||
func (q *Queries) CreateDocument(ctx context.Context, arg *CreateDocumentParams) (uuid.UUID, error) {
|
||||
row := q.db.QueryRow(ctx, createDocument,
|
||||
arg.Clientid,
|
||||
arg.Hash,
|
||||
arg.BatchID,
|
||||
arg.Filename,
|
||||
arg.Folderid,
|
||||
arg.Originalpath,
|
||||
)
|
||||
var id uuid.UUID
|
||||
err := row.Scan(&id)
|
||||
@@ -220,7 +226,7 @@ func (q *Queries) GetDocumentSummary(ctx context.Context, id uuid.UUID) (*GetDoc
|
||||
}
|
||||
|
||||
const getDocumentUploadByKey = `-- name: GetDocumentUploadByKey :one
|
||||
SELECT id, clientId, bucket, key, part, createdAt, filename, batch_id FROM documentUploads WHERE bucket = $1 AND key = $2 LIMIT 1
|
||||
SELECT id, clientId, bucket, key, part, createdAt, filename, batch_id, folder_id FROM documentUploads WHERE bucket = $1 AND key = $2 LIMIT 1
|
||||
`
|
||||
|
||||
type GetDocumentUploadByKeyParams struct {
|
||||
@@ -237,11 +243,12 @@ type GetDocumentUploadByKeyRow struct {
|
||||
Createdat pgtype.Timestamp `db:"createdat"`
|
||||
Filename *string `db:"filename"`
|
||||
BatchID *uuid.UUID `db:"batch_id"`
|
||||
FolderID *uuid.UUID `db:"folder_id"`
|
||||
}
|
||||
|
||||
// GetDocumentUploadByKey
|
||||
//
|
||||
// SELECT id, clientId, bucket, key, part, createdAt, filename, batch_id FROM documentUploads WHERE bucket = $1 AND key = $2 LIMIT 1
|
||||
// SELECT id, clientId, bucket, key, part, createdAt, filename, batch_id, folder_id FROM documentUploads WHERE bucket = $1 AND key = $2 LIMIT 1
|
||||
func (q *Queries) GetDocumentUploadByKey(ctx context.Context, arg *GetDocumentUploadByKeyParams) (*GetDocumentUploadByKeyRow, error) {
|
||||
row := q.db.QueryRow(ctx, getDocumentUploadByKey, arg.Bucket, arg.Key)
|
||||
var i GetDocumentUploadByKeyRow
|
||||
@@ -254,6 +261,7 @@ func (q *Queries) GetDocumentUploadByKey(ctx context.Context, arg *GetDocumentUp
|
||||
&i.Createdat,
|
||||
&i.Filename,
|
||||
&i.BatchID,
|
||||
&i.FolderID,
|
||||
)
|
||||
return &i, err
|
||||
}
|
||||
@@ -355,7 +363,7 @@ func (q *Queries) ListDocumentIDsBatch(ctx context.Context, arg *ListDocumentIDs
|
||||
}
|
||||
|
||||
const listDocumentUploads = `-- name: ListDocumentUploads :many
|
||||
SELECT id, clientId, bucket, key, part, createdAt, filename, batch_id FROM documentUploads WHERE clientId = $1 ORDER BY createdAt
|
||||
SELECT id, clientId, bucket, key, part, createdAt, filename, batch_id, folder_id FROM documentUploads WHERE clientId = $1 ORDER BY createdAt
|
||||
`
|
||||
|
||||
type ListDocumentUploadsRow struct {
|
||||
@@ -367,11 +375,12 @@ type ListDocumentUploadsRow struct {
|
||||
Createdat pgtype.Timestamp `db:"createdat"`
|
||||
Filename *string `db:"filename"`
|
||||
BatchID *uuid.UUID `db:"batch_id"`
|
||||
FolderID *uuid.UUID `db:"folder_id"`
|
||||
}
|
||||
|
||||
// ListDocumentUploads
|
||||
//
|
||||
// SELECT id, clientId, bucket, key, part, createdAt, filename, batch_id FROM documentUploads WHERE clientId = $1 ORDER BY createdAt
|
||||
// SELECT id, clientId, bucket, key, part, createdAt, filename, batch_id, folder_id FROM documentUploads WHERE clientId = $1 ORDER BY createdAt
|
||||
func (q *Queries) ListDocumentUploads(ctx context.Context, clientid string) ([]*ListDocumentUploadsRow, error) {
|
||||
rows, err := q.db.Query(ctx, listDocumentUploads, clientid)
|
||||
if err != nil {
|
||||
@@ -390,6 +399,7 @@ func (q *Queries) ListDocumentUploads(ctx context.Context, clientid string) ([]*
|
||||
&i.Createdat,
|
||||
&i.Filename,
|
||||
&i.BatchID,
|
||||
&i.FolderID,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user