Skip to content

Commit

Permalink
confirm test fails without fix to lib/
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Oct 7, 2024
1 parent 4272fab commit 59e103e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/resources/odata.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ module.exports = (service, endpoint) => {
return matches[1];
};

const singleRecord = endpoint.odata.json(async ({ Forms, Submissions, env }, { auth, params, query, originalUrl }) => {
const form = await getForm(Forms, auth, params);
const allFields = await Forms.getFields(form.def.id);
const selectedFields = await selectFields(query, getTableFromOriginalUrl(originalUrl))(allFields);
const row = await Submissions.getForExport(form.id, getUuid(params.uuid), draft).then(getOrNotFound);
return singleRowToOData(selectedFields, row, env.domain, originalUrl, query);
});
const singleRecord = endpoint.odata.json(({ Forms, Submissions, env }, { auth, params, query, originalUrl }) =>
getForm(Forms, auth, params)
.then((form) => Promise.all([
Forms.getFields(form.def.id).then(selectFields(query, getTableFromOriginalUrl(originalUrl))),
Submissions.getForExport(form.id, getUuid(params.uuid), draft).then(getOrNotFound), // may require s3 blob handling
])
.then(([fields, row]) => singleRowToOData(fields, row, env.domain, originalUrl, query))));

// TODO: because of the way express compiles the *, we have to register this twice.
service.get(`${base}/Submissions\\((:uuid)\\)`, singleRecord);
Expand Down

0 comments on commit 59e103e

Please sign in to comment.