@@ -155,7 +155,6 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
}
|
||||
|
||||
createProductFromRow(row: any) {
|
||||
row.publishingDate = row.publishing_date;
|
||||
row.blacklisting = this.getBlacklisting(row);
|
||||
row.printProducts = this.getPrintProducts(row);
|
||||
row.type = this.getProductTypes(row);
|
||||
@@ -431,15 +430,6 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
promises.push(promise);
|
||||
}
|
||||
|
||||
const pd = info.publishingDate;
|
||||
const publishingDate = new Date(
|
||||
pd.getFullYear(),
|
||||
pd.getMonth(),
|
||||
pd.getDate(),
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
);
|
||||
promises.push(
|
||||
this.knex
|
||||
.table('product-products')
|
||||
@@ -448,7 +438,6 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
browsable: info.browsable ? 1 : 0,
|
||||
visible: info.visible ? 1 : 0,
|
||||
designerid: info.designerId ?? null,
|
||||
publishingDate: publishingDate,
|
||||
ref1: info.ref1,
|
||||
ref2: info.ref2,
|
||||
ref3: info.ref3,
|
||||
@@ -478,32 +467,6 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* @function productPublishing
|
||||
* @description updates a products publishing
|
||||
*/
|
||||
async productPublishing(productId: number, date: Date) {
|
||||
return this.knex
|
||||
.table('product-products')
|
||||
.update({
|
||||
publishing_date: date,
|
||||
})
|
||||
.where('productid', productId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @function massUpdatePublishingDate
|
||||
* @description Mass update publishing date
|
||||
*/
|
||||
async massUpdatePublishingDate(productIds: Array<number>, date: Date) {
|
||||
return this.knex
|
||||
.table('product-products')
|
||||
.update({
|
||||
publishing_date: date,
|
||||
})
|
||||
.whereIn('productid', productIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @function massUpdatePublishing
|
||||
* @description Mass update visible and browsable
|
||||
|
||||
@@ -12,7 +12,6 @@ SELECT products.productid AS id,
|
||||
products.designerid,
|
||||
products.inserted,
|
||||
products.updated,
|
||||
products.publishing_date,
|
||||
products.ref1,
|
||||
products.ref2,
|
||||
products.ref3,
|
||||
@@ -90,7 +89,7 @@ export function products(input: ProductsFilterInput) {
|
||||
AND products.browsable = ${filter?.browsable ? '1' : '0'}`
|
||||
: ``
|
||||
}
|
||||
ORDER BY products.publishing_date DESC
|
||||
ORDER BY products.inserted DESC
|
||||
LIMIT ${limit} OFFSET ${offset}
|
||||
`
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user