added support for sqs sample ripper when creating new products (#167)
This commit is contained in:
@@ -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;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user