tango-app-api-store-builder 1.0.18 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,7 +27,6 @@ import fs from 'fs';
27
27
  import os from 'os';
28
28
  import { fileURLToPath } from 'url';
29
29
  import path from 'path';
30
- const ObjectId=mongoose.Types.ObjectId;
31
30
 
32
31
  const __filename = fileURLToPath( import.meta.url );
33
32
  const __dirname = path.dirname( __filename );
@@ -17359,91 +17358,6 @@ async function createUser( data ) {
17359
17358
  }
17360
17359
  }
17361
17360
 
17362
- export async function createLayout( req, res ) {
17363
- try {
17364
- let storeDetails = await storeService.find( { storeName: { $in: req.body.storeName }, clientId: req.body.clientId, status: 'active' }, { storeName: 1, storeId: 1 } );
17365
- if ( !storeDetails ) {
17366
- return res.sendError( 'No data found', 204 );
17367
- }
17368
- await Promise.all( storeDetails.map( async ( store ) => {
17369
- let planoDetails = await storeBuilderService.find( { storeName: store.storeName }, { planoId: 1, _id: 1 } );
17370
- await Promise.all( planoDetails.map( async ( task ) => {
17371
- let getLayoutDetails = await processedTaskService.findOne( { storeName: store.storeName, planoType: 'layout' }, { _id: 1 } );
17372
- if ( !getLayoutDetails ) {
17373
- let data = {
17374
- client_id: req.body.clientId,
17375
- date_iso: new Date( dayjs().format( 'YYYY-MM-DD' ) ),
17376
- date_string: dayjs().format( 'YYYY-MM-DD' ),
17377
- sourceCheckList_id: new ObjectId(),
17378
- checkListName: 'Layout Verification',
17379
- checkListId: new ObjectId(),
17380
- scheduleStartTime: dayjs().format( 'hh:mm A' ),
17381
- scheduleEndTime: dayjs().format( 'hh:mm A' ),
17382
- scheduleStartTime_iso: dayjs().format(),
17383
- scheduleEndTime_iso: dayjs().format(),
17384
- allowedOverTime: false,
17385
- allowedStoreLocation: false,
17386
- createdBy: new ObjectId(),
17387
- createdByName: 'tango',
17388
- questionAnswers: [],
17389
- isdeleted: false,
17390
- questionCount: 0,
17391
- storeCount: 0,
17392
- locationCount: 0,
17393
- checkListType: 'task',
17394
- country: '',
17395
- store_id: store.storeId,
17396
- storeName: store.storeName,
17397
- userId: new ObjectId(),
17398
- userName: 'tango',
17399
- userEmail: 'tango@tangotech.co.in',
17400
- checklistStatus: 'submit',
17401
- timeFlagStatus: true,
17402
- timeFlag: 0,
17403
- questionFlag: 0,
17404
- mobileDetectionFlag: 0,
17405
- storeOpenCloseFlag: 0,
17406
- reinitiateStatus: false,
17407
- markasread: false,
17408
- uniformDetectionFlag: 0,
17409
- scheduleRepeatedType: 'daily',
17410
- approvalStatus: false,
17411
- approvalEnable: false,
17412
- redoStatus: false,
17413
- isPlano: true,
17414
- planoType: 'layout',
17415
- planoId: task.planoId,
17416
- floorId: task._id,
17417
- };
17418
-
17419
- let taskData = await processedTaskService.create( data );
17420
- let layoutData = {
17421
- "date_string": dayjs().format( 'YYYY-MM-DD' ),
17422
- "floorId": task._id,
17423
- "fixtureId": null,
17424
- "planoId": task.planoId,
17425
- "taskType": "initial",
17426
- "type": "layout",
17427
- "taskId": taskData._id,
17428
- "answers": [],
17429
- "approvalStatus": "approved",
17430
- "date_iso": new Date( dayjs().format( 'YYYY-MM-DD' ) ),
17431
- "status": "complete",
17432
- "storeId": store.storeId,
17433
- "storeName": store.storeName,
17434
- };
17435
- await planoTaskService.create( layoutData );
17436
- await storeBuilderService.updateOne( { _id: task._id }, { planoProgress: 50 } );
17437
- }
17438
- } ) );
17439
- } ) );
17440
- return res.sendSuccess( 'Layout SUbmitted Successfully' );
17441
- } catch ( e ) {
17442
- logger.error( { functionName: 'createLayout', error: e } );
17443
- return res.sendError( e, 500 );
17444
- }
17445
- }
17446
-
17447
17361
  async function standardizeHeaders() {
17448
17362
  const headerMap = {
17449
17363
  "Innovation": "Innovation",
@@ -18623,27 +18537,3 @@ async function updateMellerCollection() {
18623
18537
 
18624
18538
  // updateMellerCollection();
18625
18539
 
18626
-
18627
- export async function updateProduct( req, res ) {
18628
- try {
18629
- let query = [
18630
- {
18631
- $group: {
18632
- _id: '$brandName',
18633
- id: { $first: '$_id' },
18634
- },
18635
- },
18636
- ];
18637
- let getProducts = await planoProductService.aggregate( query );
18638
- if ( getProducts.length ) {
18639
- await Promise.all( getProducts.map( async ( prod, index ) => {
18640
- await planoProductService.updateOne( { _id: prod.id }, { rfId: req.body.rfId[index] } );
18641
- } ) );
18642
- }
18643
-
18644
- return res.sendSuccess( 'Updated Successfully' );
18645
- } catch ( e ) {
18646
- logger.error( { functionName: "updateProduct", error: e } );
18647
- return res.sendError( e, 500 );
18648
- }
18649
- }