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> {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -386,6 +386,9 @@ input ProductInfoInput {
|
||||
designerId: Int!
|
||||
browsable: Boolean!
|
||||
visible: Boolean!
|
||||
printFileWidth: Int!
|
||||
printFileHeight: Int!
|
||||
printFileDpi: Int!
|
||||
}
|
||||
|
||||
input ProductBlacklistingInput {
|
||||
|
||||
@@ -13,6 +13,9 @@ export interface ProductInfoInput {
|
||||
designerId: number;
|
||||
browsable: boolean;
|
||||
visible: boolean;
|
||||
printFileWidth: number;
|
||||
printFileHeight: number;
|
||||
printFileDpi: number;
|
||||
}
|
||||
|
||||
export interface ProductBlacklistMarketInput {
|
||||
|
||||
Reference in New Issue
Block a user