Add bernard sqs msg to add redirect for changed paths (#73)
This commit is contained in:
@@ -27,6 +27,7 @@ import {
|
||||
roundOrDefaultTo,
|
||||
} from './utils';
|
||||
import { UserInputError } from 'apollo-server';
|
||||
import { sendPathChangedCmd } from '../bernard/client';
|
||||
|
||||
const MINUTE = 60;
|
||||
|
||||
@@ -362,6 +363,10 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
): Promise<any[]> {
|
||||
// Check path and insert new unique path if taken
|
||||
const uniquePath = await this.getUniqueProductPath(info.path, productId);
|
||||
const oldProd = await this.getProduct(productId);
|
||||
if (oldProd.path !== uniquePath) {
|
||||
sendPathChangedCmd(oldProd.path, uniquePath);
|
||||
}
|
||||
|
||||
const promises = [];
|
||||
promises.push(
|
||||
@@ -397,6 +402,7 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
info.printFileDpi.toString(),
|
||||
),
|
||||
);
|
||||
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user