-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'integrationTesting' into B-22227-INT
- Loading branch information
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
migrations/app/schema/20250213151815_fix_spacing_fetch_documents.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CREATE OR REPLACE FUNCTION public.fetch_documents(docCursor refcursor, useruploadCursor refcursor, uploadCursor refcursor, _docID uuid) RETURNS setof refcursor AS $$ | ||
BEGIN | ||
OPEN $1 FOR | ||
SELECT documents.created_at, documents.deleted_at, documents.id, documents.service_member_id, documents.updated_at | ||
FROM documents AS documents | ||
WHERE documents.id = _docID and documents.deleted_at is null | ||
LIMIT 1; | ||
RETURN NEXT $1; | ||
OPEN $2 FOR | ||
SELECT user_uploads.created_at, user_uploads.deleted_at, user_uploads.document_id, user_uploads.id, user_uploads.updated_at, | ||
user_uploads.upload_id, user_uploads.uploader_id | ||
FROM user_uploads AS user_uploads | ||
WHERE user_uploads.deleted_at is null and user_uploads.document_id = _docID | ||
ORDER BY created_at asc; | ||
RETURN NEXT $2; | ||
OPEN $3 FOR | ||
SELECT uploads.id, uploads.bytes, uploads.checksum, uploads.content_type, uploads.created_at, uploads.deleted_at, uploads.filename, | ||
uploads.rotation, uploads.storage_key, uploads.updated_at, uploads.upload_type FROM uploads AS uploads , user_uploads | ||
WHERE uploads.deleted_at is null and uploads.id = user_uploads.upload_id and user_uploads.deleted_at is null and user_uploads.document_id = _docID; | ||
RETURN NEXT $3; | ||
END; | ||
$$ LANGUAGE plpgsql; |