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