Add print file analysis fields and fix bug with no inserts (#26)
This commit is contained in:
@@ -171,10 +171,11 @@ export class ProductAPI extends BaseSQLDataSource {
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
return this.knex.raw(
|
return this.knex.raw(
|
||||||
/* sql */ `
|
/* sql */ `
|
||||||
UPDATE "product-products_fields" SET value = ?
|
INSERT INTO "product-products_fields" (productid, fieldid, value, inserted, updated)
|
||||||
WHERE productid = ?
|
VALUES (?, (SELECT fieldid FROM "product-fields" WHERE field = ?), ?, now(), now())
|
||||||
AND fieldid = (SELECT fieldid FROM "product-fields" WHERE field = ?)`,
|
ON CONFLICT (productid, fieldid)
|
||||||
[value, productId, field],
|
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, 'name', info.name),
|
||||||
this.updateProductField(productId, 'batch', info.batch),
|
this.updateProductField(productId, 'batch', info.batch),
|
||||||
this.updateProductField(productId, 'copyright', info.copyright),
|
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);
|
return Promise.all(promises);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -386,6 +386,9 @@ input ProductInfoInput {
|
|||||||
designerId: Int!
|
designerId: Int!
|
||||||
browsable: Boolean!
|
browsable: Boolean!
|
||||||
visible: Boolean!
|
visible: Boolean!
|
||||||
|
printFileWidth: Int!
|
||||||
|
printFileHeight: Int!
|
||||||
|
printFileDpi: Int!
|
||||||
}
|
}
|
||||||
|
|
||||||
input ProductBlacklistingInput {
|
input ProductBlacklistingInput {
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ export interface ProductInfoInput {
|
|||||||
designerId: number;
|
designerId: number;
|
||||||
browsable: boolean;
|
browsable: boolean;
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
|
printFileWidth: number;
|
||||||
|
printFileHeight: number;
|
||||||
|
printFileDpi: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ProductBlacklistMarketInput {
|
export interface ProductBlacklistMarketInput {
|
||||||
|
|||||||
Reference in New Issue
Block a user