Skip to content

Commit

Permalink
filter for non deleted subs/forms in an entity source query
Browse files Browse the repository at this point in the history
  • Loading branch information
ktuite committed Sep 18, 2024
1 parent 19def70 commit 37a7637
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/model/query/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,12 @@ const _get = (includeSource) => {
`}
${!includeSource ? sql`` : sql`
LEFT JOIN entity_def_sources ON entity_defs."sourceId" = entity_def_sources."id"
LEFT JOIN submission_defs ON submission_defs.id = entity_def_sources."submissionDefId"
LEFT JOIN (
SELECT submission_defs.* FROM submission_defs
JOIN submissions ON submission_defs."submissionId" = submissions.id
JOIN forms ON submissions."formId" = forms.id
WHERE submissions."deletedAt" IS NULL AND forms."deletedAt" IS NULL
) as submission_defs on submission_defs.id = entity_def_sources."submissionDefId"
LEFT JOIN (
SELECT submissions.*, submission_defs."userAgent" FROM submissions
JOIN submission_defs ON submissions.id = submission_defs."submissionId" AND root
Expand Down

0 comments on commit 37a7637

Please sign in to comment.