Add print file analysis fields and fix bug with no inserts (#26)

This commit is contained in:
Niklas Fondberg
2021-09-07 10:20:34 +02:00
committed by GitHub
parent d5945da7ae
commit 4b49c6a93c
3 changed files with 26 additions and 4 deletions
+20 -4
View File
@@ -171,10 +171,11 @@ export class ProductAPI extends BaseSQLDataSource {
): Promise<void> {
return this.knex.raw(
/* sql */ `
UPDATE "product-products_fields" SET value = ?
WHERE productid = ?
AND fieldid = (SELECT fieldid FROM "product-fields" WHERE field = ?)`,
[value, productId, field],
INSERT INTO "product-products_fields" (productid, fieldid, value, inserted, updated)
VALUES (?, (SELECT fieldid FROM "product-fields" WHERE field = ?), ?, now(), now())
ON CONFLICT (productid, fieldid)
DO UPDATE SET "value" = ?`,
[productId, field, value, value],
);
}
@@ -200,6 +201,21 @@ export class ProductAPI extends BaseSQLDataSource {
this.updateProductField(productId, 'name', info.name),
this.updateProductField(productId, 'batch', info.batch),
this.updateProductField(productId, 'copyright', info.copyright),
this.updateProductField(
productId,
'print_file_width',
info.printFileWidth.toString(),
),
this.updateProductField(
productId,
'print_file_height',
info.printFileHeight.toString(),
),
this.updateProductField(
productId,
'print_file_dpi',
info.printFileDpi.toString(),
),
);
return Promise.all(promises);
}
+3
View File
@@ -386,6 +386,9 @@ input ProductInfoInput {
designerId: Int!
browsable: Boolean!
visible: Boolean!
printFileWidth: Int!
printFileHeight: Int!
printFileDpi: Int!
}
input ProductBlacklistingInput {
+3
View File
@@ -13,6 +13,9 @@ export interface ProductInfoInput {
designerId: number;
browsable: boolean;
visible: boolean;
printFileWidth: number;
printFileHeight: number;
printFileDpi: number;
}
export interface ProductBlacklistMarketInput {