Merged in feature/textextraction (pull request #110)
Text Extraction * bases * go * splitting * structure * movetoasync * movetoasync * settinguptrigger * reorder * storevent * standardisepollingvalidation * unittests * fixlint * fixlint * awscfg * generatesample * followthrough * tests * clena * store * externalidcleanup * clientid * local * baseunittests * putobjecttests * tests
This commit is contained in:
@@ -20,21 +20,15 @@ namedResults AS (
|
||||
)
|
||||
SELECT
|
||||
d.id,
|
||||
c.externalId AS clientId,
|
||||
d.clientId,
|
||||
d.hash,
|
||||
COALESCE(jsonb_object_agg(r.name, r.value) FILTER (WHERE r.name IS NOT NULL), '{}') AS fields
|
||||
FROM docs AS d
|
||||
JOIN clients AS c ON c.id = d.clientId
|
||||
LEFT JOIN namedResults AS r ON d.id = r.id
|
||||
GROUP BY d.id, c.externalId, d.hash;
|
||||
GROUP BY d.id, d.clientId, d.hash;
|
||||
|
||||
-- name: ListDocumentsByClientExternalId :many
|
||||
WITH client as (
|
||||
SELECT id from clients where externalId = @clientId
|
||||
)
|
||||
SELECT d.id, d.hash
|
||||
from documents as d
|
||||
JOIN client as c on d.clientId = c.id;
|
||||
-- name: ListDocumentsByClient :many
|
||||
SELECT id, hash from documents where clientId = @clientId;
|
||||
|
||||
-- name: CreateDocument :one
|
||||
INSERT INTO documents (clientId, hash) VALUES ($1, $2) RETURNING id;
|
||||
|
||||
Reference in New Issue
Block a user