Add mass edit of visible, browsable and blacklisting (#86)
* Add massedit WIP * Add massedit * Review comments * Remove more debug
This commit is contained in:
@@ -463,6 +463,39 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* @function massUpdatePublishing
|
||||
* @description Mass update visible and browsable
|
||||
*/
|
||||
async massUpdatePublishing(
|
||||
productIds: Array<number>,
|
||||
visible: boolean,
|
||||
browsable: boolean,
|
||||
) {
|
||||
return this.knex
|
||||
.table('product-products')
|
||||
.update({
|
||||
browsable: browsable ? 1 : 0,
|
||||
visible: visible ? 1 : 0,
|
||||
})
|
||||
.whereIn('productid', productIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @function massUpdateBlacklisting
|
||||
* @description Mass update blacklisting
|
||||
*/
|
||||
async massUpdateBlacklisting(
|
||||
productIds: Array<number>,
|
||||
markets: Array<ProductBlacklistMarketInput>,
|
||||
) {
|
||||
const promises = productIds.map((pId) =>
|
||||
this.updateBlacklisting(pId, markets),
|
||||
);
|
||||
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
/**
|
||||
* @function updateFocusPoint
|
||||
* @description Updates the focus point on a motif
|
||||
|
||||
Reference in New Issue
Block a user