Merge remote-tracking branch 'origin/release/2025-08-15' into feature/IO-3255-simplified-part-management

This commit is contained in:
Dave Richer
2025-08-11 13:50:41 -04:00
4 changed files with 550 additions and 438 deletions

View File

@@ -2846,6 +2846,26 @@ exports.GET_DOCUMENTS_BY_JOB = `
}
}
}`;
exports.GET_DOCUMENTS_BY_BILL = `
query GET_DOCUMENTS_BY_BILL($billId: uuid!) {
documents_aggregate(where: {billid: {_eq: $billId}}) {
aggregate {
sum {
size
}
}
}
documents(order_by: {takenat: desc}, where: {billid: {_eq: $billId}}) {
id
name
key
type
size
takenat
extension
}
}
`;
exports.QUERY_TEMPORARY_DOCS = ` query QUERY_TEMPORARY_DOCS {
documents(where: { jobid: { _is_null: true } }, order_by: { takenat: desc }) {

View File

@@ -18,6 +18,7 @@ const {
GET_DOCUMENTS_BY_JOB,
QUERY_TEMPORARY_DOCS,
GET_DOCUMENTS_BY_IDS,
GET_DOCUMENTS_BY_BILL,
DELETE_MEDIA_DOCUMENTS
} = require("../graphql-client/queries");
const yazl = require("yazl");
@@ -90,9 +91,11 @@ const getThumbnailUrls = async (req, res) => {
//Delayed as the key structure may change slightly from what it is currently and will require evaluating mobile components.
const client = req.userGraphQLClient;
//If there's no jobid and no billid, we're in temporary documents.
const data = await (jobid
? client.request(GET_DOCUMENTS_BY_JOB, { jobId: jobid })
: client.request(QUERY_TEMPORARY_DOCS));
const data = await (
billid ? client.request(GET_DOCUMENTS_BY_BILL, { billId: billid }) :
jobid
? client.request(GET_DOCUMENTS_BY_JOB, { jobId: jobid })
: client.request(QUERY_TEMPORARY_DOCS));
const thumbResizeParams = `rs:fill:250:250:1/g:ce`;
const s3client = new S3Client({ region: InstanceRegion() });