fix batch bug addproduct mutation (#95)
This commit is contained in:
@@ -380,7 +380,8 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
* set a unique path, artNo is the productId with e infront.
|
||||
*/
|
||||
async addProduct(name: string, batch: string): Promise<number> {
|
||||
const path = batch ? batch + ' ' + name : name;
|
||||
const fixedBatch = !!batch ? batch : '';
|
||||
const path = batch ? fixedBatch + ' ' + name : name;
|
||||
const productPath = slug(path);
|
||||
const safePath = await this.getUniqueProductPath(productPath, null);
|
||||
|
||||
@@ -395,7 +396,7 @@ export class ProductAPI extends BaseSQLDataSource {
|
||||
const id = idres[0];
|
||||
this.updateProductField(id, 'artNo', `e${id}`);
|
||||
await this.updateProductField(id, 'name', name);
|
||||
await this.updateProductField(id, 'batch', batch);
|
||||
await this.updateProductField(id, 'batch', fixedBatch);
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user