added ref4 (#169)
This commit is contained in:
@@ -206,6 +206,7 @@
|
|||||||
ref1
|
ref1
|
||||||
ref2
|
ref2
|
||||||
ref3
|
ref3
|
||||||
|
ref4
|
||||||
wallpaperTypes
|
wallpaperTypes
|
||||||
keywords {
|
keywords {
|
||||||
id
|
id
|
||||||
|
|||||||
@@ -350,10 +350,10 @@ export class ProductAPI extends BaseSQLDataSource {
|
|||||||
|
|
||||||
async searchByReferences(name: string): Promise<Array<Product>> {
|
async searchByReferences(name: string): Promise<Array<Product>> {
|
||||||
ScopeAccess.validate(this.user).all([Scopes.PRODUCTS_READ]);
|
ScopeAccess.validate(this.user).all([Scopes.PRODUCTS_READ]);
|
||||||
const query = sql.referenceProducts(); // ref1, ref2, ref3
|
const query = sql.referenceProducts(); // ref1, ref2, ref3, ref4
|
||||||
|
|
||||||
return this.knex
|
return this.knex
|
||||||
.raw(query, [name, name, name])
|
.raw(query, [name, name, name, name])
|
||||||
.then((data) => data.rows.map((row) => this.createProductFromRow(row)));
|
.then((data) => data.rows.map((row) => this.createProductFromRow(row)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -556,6 +556,7 @@ export class ProductAPI extends BaseSQLDataSource {
|
|||||||
ref1: info.ref1,
|
ref1: info.ref1,
|
||||||
ref2: info.ref2,
|
ref2: info.ref2,
|
||||||
ref3: info.ref3,
|
ref3: info.ref3,
|
||||||
|
ref4: info.ref4,
|
||||||
})
|
})
|
||||||
.where({ productid: productId }),
|
.where({ productid: productId }),
|
||||||
this.updateProductField(productId, 'artNo', info.artNo),
|
this.updateProductField(productId, 'artNo', info.artNo),
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ SELECT products.productid AS id,
|
|||||||
products.ref1,
|
products.ref1,
|
||||||
products.ref2,
|
products.ref2,
|
||||||
products.ref3,
|
products.ref3,
|
||||||
|
products.ref4,
|
||||||
(
|
(
|
||||||
SELECT json_agg(
|
SELECT json_agg(
|
||||||
json_build_object(
|
json_build_object(
|
||||||
@@ -200,7 +201,7 @@ export function referenceProducts() {
|
|||||||
return (
|
return (
|
||||||
baseQuery +
|
baseQuery +
|
||||||
/* sql */ `
|
/* sql */ `
|
||||||
WHERE LOWER(products.ref1) LIKE ? OR LOWER(products.ref2) LIKE ? OR LOWER(products.ref3) LIKE ? ORDER BY products.inserted DESC`
|
WHERE LOWER(products.ref1) LIKE ? OR LOWER(products.ref2) LIKE ? OR LOWER(products.ref3) LIKE ? OR LOWER(products.ref4) LIKE ? ORDER BY products.inserted DESC`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -266,6 +266,7 @@ type Product {
|
|||||||
ref1: String
|
ref1: String
|
||||||
ref2: String
|
ref2: String
|
||||||
ref3: String
|
ref3: String
|
||||||
|
ref4: String
|
||||||
related: [Product]
|
related: [Product]
|
||||||
wallpaperTypes: [ProductWallpaperType]!
|
wallpaperTypes: [ProductWallpaperType]!
|
||||||
fields: ProductFields
|
fields: ProductFields
|
||||||
@@ -423,6 +424,7 @@ input ProductInfoInput {
|
|||||||
ref1: String!
|
ref1: String!
|
||||||
ref2: String!
|
ref2: String!
|
||||||
ref3: String!
|
ref3: String!
|
||||||
|
ref4: String!
|
||||||
designerId: Int
|
designerId: Int
|
||||||
browsable: Boolean!
|
browsable: Boolean!
|
||||||
visible: Boolean!
|
visible: Boolean!
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ export interface ProductInfoInput {
|
|||||||
ref1: string;
|
ref1: string;
|
||||||
ref2: string;
|
ref2: string;
|
||||||
ref3: string;
|
ref3: string;
|
||||||
|
ref4: string;
|
||||||
designerId: Maybe<number>;
|
designerId: Maybe<number>;
|
||||||
browsable: boolean;
|
browsable: boolean;
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
@@ -145,6 +146,7 @@ export interface Product {
|
|||||||
ref1: string;
|
ref1: string;
|
||||||
ref2: string;
|
ref2: string;
|
||||||
ref3: string;
|
ref3: string;
|
||||||
|
ref4: string;
|
||||||
orientation?: Orientation;
|
orientation?: Orientation;
|
||||||
printProducts: [PrintProduct];
|
printProducts: [PrintProduct];
|
||||||
blacklisting: [ProductBlacklist];
|
blacklisting: [ProductBlacklist];
|
||||||
|
|||||||
Reference in New Issue
Block a user