104 add focus point mutation
This commit is contained in:
@@ -12,7 +12,6 @@ import {
|
||||
Orientation,
|
||||
ProductsFilterInput,
|
||||
ProductInfoInput,
|
||||
ProductBlacklistInput,
|
||||
ProductBlacklistMarketInput,
|
||||
ProductMaterials,
|
||||
ProductSizeTypes,
|
||||
@@ -204,6 +203,27 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
async updateFocusPoint(
|
||||
productId: number,
|
||||
focusXpoint2: number,
|
||||
focusYpoint2: number,
|
||||
): Promise<Promise<void>[]> {
|
||||
const promises = [];
|
||||
promises.push(
|
||||
this.updateProductField(
|
||||
productId,
|
||||
'focusXpoint2',
|
||||
focusXpoint2.toString(),
|
||||
),
|
||||
this.updateProductField(
|
||||
productId,
|
||||
'focusYpoint2',
|
||||
focusYpoint2.toString(),
|
||||
),
|
||||
);
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
async updateBlacklisting(
|
||||
productId: number,
|
||||
markets: Array<ProductBlacklistMarketInput>,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { ProductAPI } from '../datasources/product-api';
|
||||
import {
|
||||
Product,
|
||||
ProductGroup,
|
||||
ProductListResult,
|
||||
ProductsFilterInput,
|
||||
} from '../types/product-types';
|
||||
@@ -88,6 +87,18 @@ export const productMutationTypeDefs = {
|
||||
);
|
||||
return (<ProductAPI>dataSources.productApi).getProduct(productId);
|
||||
},
|
||||
async productFocusPoint(
|
||||
_,
|
||||
{ productId, focusXpoint2, focusYpoint2 },
|
||||
{ dataSources },
|
||||
) {
|
||||
await (<ProductAPI>dataSources.productApi).updateFocusPoint(
|
||||
productId,
|
||||
focusXpoint2,
|
||||
focusYpoint2,
|
||||
);
|
||||
return (<ProductAPI>dataSources.productApi).getProduct(productId);
|
||||
},
|
||||
async productBlacklisting(_, { productId, markets }, { dataSources }) {
|
||||
await (<ProductAPI>dataSources.productApi).updateBlacklisting(
|
||||
productId,
|
||||
|
||||
@@ -398,6 +398,7 @@ input ProductBlacklistingInput {
|
||||
|
||||
type Mutation {
|
||||
productInfo(productId: Int!, info: ProductInfoInput!): Product
|
||||
productFocusPoint(productId: Int!, focusXpoint2: Float!, focusYpoint2: Float!): Product
|
||||
productBlacklisting(
|
||||
productId: Int!
|
||||
markets: [ProductBlacklistingInput]
|
||||
|
||||
Reference in New Issue
Block a user