Add product comments (#54)
This commit is contained in:
@@ -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>,
|
||||
|
||||
@@ -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);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user