Skip to content

Commit 3b6efc2

Browse files
committed
Change ProductExtraction handler to not ref uploadId
I want to make uploadId optional, so trying to remove usage.
1 parent dc252a1 commit 3b6efc2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/components/product/handlers/extract-products-from-pnp.handler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ export class ExtractProductsFromPnpHandler
4848
event instanceof EngagementCreatedEvent
4949
? event.engagement
5050
: event.updated;
51-
const pnpFileId = event.input.pnp?.uploadId;
52-
const { methodology } = event.input;
53-
if (!pnpFileId || !methodology) {
51+
const { pnp: hasPnpInput, methodology } = event.input;
52+
if (!hasPnpInput || !methodology) {
5453
return;
5554
}
5655

57-
const file = this.files.asDownloadable({ id: pnpFileId }, pnpFileId);
56+
const pnp = await this.files.getFile(engagement.pnp, event.session);
57+
const file = this.files.asDownloadable({}, pnp.latestVersionId);
5858

5959
const availableSteps = getAvailableSteps({
6060
methodology,
@@ -64,7 +64,7 @@ export class ExtractProductsFromPnpHandler
6464
productRows = await this.extractor.extract(file, availableSteps);
6565
} catch (e) {
6666
this.logger.warning(e.message, {
67-
id: file.id,
67+
id: pnp.latestVersionId,
6868
exception: e,
6969
});
7070
return;

0 commit comments

Comments
 (0)