This commit is contained in:
seb
2026-10-26 19:22:04 +01:00
parent 563945394b
commit bab5c151d0
33 changed files with 2660 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ import { queriesFor, requireId, requireText } from '../logistics/helpers.js';
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
import resolveManifestAccess from '../manifestattachment/resolveManifestAccess.js';
import { syncOrderSummary } from '../order/syncSummary.js';
import { syncRetoureSummary } from '../retoure/syncSummary.js';
import makeRunner from '../runner.js';
function shape(row) {
@@ -67,7 +68,17 @@ export default function create(provider) {
type,
amount: input.amount,
};
await syncOrderSummary(runner, { companyId, manifestId });
const mTypeRes = await runner.query(
runner.dialect === 'sqlite3'
? 'SELECT "type" FROM manifest WHERE id = @manifestId'
: 'SELECT [type] FROM manifest WHERE id = @manifestId',
{ manifestId },
);
if (mTypeRes.rows[0]?.type === 'retoure') {
await syncRetoureSummary(runner, { companyId, manifestId });
} else {
await syncOrderSummary(runner, { companyId, manifestId });
}
return shape(row);
};