u
This commit is contained in:
@@ -466,6 +466,15 @@ export function register(app, basePath = '') {
|
||||
// #region POST /company/import
|
||||
|
||||
const activeImportsByCompany = new Set();
|
||||
/** Signals for data the catalog import may create/modify (emitted even after a failed, partially applied run). */
|
||||
const IMPORT_SIGNALS = ['category', 'articles', 'brand', 'attributename', 'warehouse', 'carrier', 'order', 'shipment', 'stock', 'ledger'];
|
||||
const emitImportSignals = (companyId) => {
|
||||
for (const signal of IMPORT_SIGNALS) {
|
||||
emit(signal, signal === 'brand'
|
||||
? { companyId, data: { sender: '', brandId: null } }
|
||||
: { companyId });
|
||||
}
|
||||
};
|
||||
|
||||
app.post(
|
||||
`${basePath}/company/import`,
|
||||
@@ -637,6 +646,7 @@ export function register(app, basePath = '') {
|
||||
}
|
||||
} finally {
|
||||
activeImportsByCompany.delete(companyId);
|
||||
emitImportSignals(companyId);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user