Add prod from CMS (#111)
This commit is contained in:
@@ -305,6 +305,7 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
return ids.map(async (id) => this.getProduct(id));
|
||||
}
|
||||
|
||||
//
|
||||
// mutations below
|
||||
async updateProductField(
|
||||
productId: number,
|
||||
@@ -383,7 +384,11 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
* @description Adds a new product to system, will use batchname and name to
|
||||
* set a unique path, artNo is the productId with e infront.
|
||||
*/
|
||||
async addProduct(name: string, batch: string): Promise<number> {
|
||||
async addProduct(
|
||||
name: string,
|
||||
batch: string,
|
||||
designerId: number,
|
||||
): Promise<number> {
|
||||
const fixedBatch = !!batch ? batch : '';
|
||||
const path = batch ? fixedBatch + ' ' + name : name;
|
||||
const productPath = slug(path);
|
||||
@@ -395,6 +400,7 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
path: slug(safePath),
|
||||
browsable: 0,
|
||||
visible: 0,
|
||||
designerid: designerId,
|
||||
})
|
||||
.returning('productid');
|
||||
const id = idres[0].productid;
|
||||
|
||||
Reference in New Issue
Block a user