diff --git a/src/datasources/product-api.ts b/src/datasources/product-api.ts index 9c18743..b9c9ace 100644 --- a/src/datasources/product-api.ts +++ b/src/datasources/product-api.ts @@ -171,10 +171,11 @@ export class ProductAPI extends BaseSQLDataSource { ): Promise { 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); } diff --git a/src/schema.graphql b/src/schema.graphql index 86767de..5caee89 100644 --- a/src/schema.graphql +++ b/src/schema.graphql @@ -386,6 +386,9 @@ input ProductInfoInput { designerId: Int! browsable: Boolean! visible: Boolean! + printFileWidth: Int! + printFileHeight: Int! + printFileDpi: Int! } input ProductBlacklistingInput { diff --git a/src/types/product-types.ts b/src/types/product-types.ts index 0060919..acabffb 100644 --- a/src/types/product-types.ts +++ b/src/types/product-types.ts @@ -13,6 +13,9 @@ export interface ProductInfoInput { designerId: number; browsable: boolean; visible: boolean; + printFileWidth: number; + printFileHeight: number; + printFileDpi: number; } export interface ProductBlacklistMarketInput {