Add product comments (#54)

This commit is contained in:
Niklas Fondberg
2021-09-23 14:17:10 +02:00
committed by GitHub
parent 2bbb669032
commit 4fda9a8a73
4 changed files with 16 additions and 0 deletions
+5
View File
@@ -89,6 +89,7 @@ export class ProductAPI extends BaseSQLDataSource {
fields['artNo'] = fields['artNo'];
fields['name'] = fields['name'];
fields['copyright'] = fields['copyright'] ?? '';
fields['comments'] = fields['comments'] ?? '';
fields['batch'] = fields['batch'] ?? '';
fields['height'] = nullOrNumber(fields['height'] ?? null);
fields['width'] = nullOrNumber(fields['width'] ?? null);
@@ -281,6 +282,10 @@ export class ProductAPI extends BaseSQLDataSource {
return Promise.all(promises);
}
async updateComments(productId: number, comments: string): Promise<void> {
return this.updateProductField(productId, 'comments', comments);
}
async updateBlacklisting(
productId: number,
markets: Array<ProductBlacklistMarketInput>,
+7
View File
@@ -250,4 +250,11 @@ export const productMutationTypeDefs = {
);
return (<ProductAPI>dataSources.productApi).getProduct(productId);
},
async updateProductComments(_, { productId, comments }, { dataSources }) {
await (<ProductAPI>dataSources.productApi).updateComments(
productId,
comments,
);
return (<ProductAPI>dataSources.productApi).getProduct(productId);
},
};
+3
View File
@@ -295,6 +295,7 @@ type ProductFields {
printFileWidth: Int
printFileHeight: Int
printFileDpi: Int
comments: String
}
enum Orientation {
@@ -469,4 +470,6 @@ type Mutation {
addCategoriesToProduct(productId: Int!, categoryIds: [Int]!): Product
removeCategoriesFromProduct(productId: Int!, categoryIds: [Int]!): Product
updateProductComments(productId: Int!, comments: String!): Product
}
+1
View File
@@ -151,6 +151,7 @@ export interface ProductFields {
printFileWidth?: number;
printFileHeight?: number;
printFileDpi?: number;
comments?: string;
// Below exists for Canvas frame in DB but in shop limits.php is used
// minHeight: number;
// minWidth: number;