Added designers

This commit is contained in:
Niklas Fondberg
2021-04-08 23:11:24 +02:00
parent 2b57afbc4a
commit 3c648cee29
18 changed files with 366 additions and 151 deletions
+6 -2
View File
@@ -45,11 +45,12 @@ export class ProductAPI extends SQLDataSource {
}
getPrintProducts(row: any): Array<PrintProduct> {
if (!row.printProducts) {
if (!row.printproducts) {
return [];
}
return row.printProducts.map((pp: any) => {
return row.printproducts.map((pp: any) => {
pp.group = ProductGroup[pp.groupId];
pp.id = pp.printId;
return pp;
});
}
@@ -66,6 +67,7 @@ export class ProductAPI extends SQLDataSource {
data.rows.map((row) => {
row.blacklisting = this.getBlacklisting(row);
row.printProducts = this.getPrintProducts(row);
row.designerId = row.designerid;
return row;
}),
);
@@ -76,8 +78,10 @@ export class ProductAPI extends SQLDataSource {
const res = await this.knex.raw(query).then((data) =>
data.rows.map((row) => {
console.log(row);
row.blacklisting = this.getBlacklisting(row);
row.printProducts = this.getPrintProducts(row);
row.designerId = row.designerid;
return row;
}),
);