Merge branch 'master' into 104-focus-point-mutation
This commit is contained in:
@@ -104,6 +104,8 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
row.fields = this.getProductFields(row);
|
||||
row.designerId = row.designerid;
|
||||
row.orientation = this.getOrientation(row.fields);
|
||||
row.copyright = row.copyright ?? '';
|
||||
row.batch = row.batch ?? '';
|
||||
return row;
|
||||
}
|
||||
|
||||
@@ -170,10 +172,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],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -189,7 +192,7 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
path: info.path,
|
||||
browsable: info.browsable ? 1 : 0,
|
||||
visible: info.visible ? 1 : 0,
|
||||
designerid: info.designerId,
|
||||
designerid: info.designerId ?? null,
|
||||
ref1: info.ref1,
|
||||
ref2: info.ref2,
|
||||
ref3: info.ref3,
|
||||
@@ -199,6 +202,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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user