added support for sqs sample ripper when creating new products (#167)

This commit is contained in:
Arwid Thornström
2024-10-10 14:34:29 +02:00
committed by GitHub
parent 3101e04b66
commit 549046096c
8 changed files with 54 additions and 22 deletions
+11 -1
View File
@@ -23,6 +23,7 @@ import { PrintProductDefaultsAPI } from '../datasources/printproduct-defaults-ap
import { PrintProductDefaults } from '../types/printproduct-defaults-types';
import { GraphQLError } from 'graphql';
import { getOrientationString, isRepeatingPattern } from '../datasources/utils';
import { sendMessage } from '../aws/sqs';
const ProductBlacklist = {
async market(parent, _args, { dataSources }) {
@@ -223,7 +224,16 @@ export const productMutationTypeDefs = {
batch,
designerId,
);
return (<ProductAPI>dataSources.productApi).getProduct(id);
const product = await (<ProductAPI>dataSources.productApi).getProduct(id);
// Send sqs message to trigger sample ripper
await sendMessage(
JSON.stringify({ productId: id, artNo: product.fields.artNo }),
process.env.SAMPLE_SQS_QUEUE_URL,
);
return product;
},
/**