tango-app-api-store-builder 1.0.0-beta-112 → 1.0.0-beta-113
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.
- package/index.js +1 -4
- package/package.json +2 -3
- package/src/controllers/script.controller.js +400 -1727
- package/src/controllers/storeBuilder.controller.js +318 -526
- package/src/controllers/task.controller.js +55 -169
- package/src/dtos/validation.dtos.js +0 -226
- package/src/routes/script.routes.js +1 -3
- package/src/routes/storeBuilder.routes.js +1 -5
- package/src/routes/task.routes.js +0 -1
- package/src/service/fixtureConfig.service.js +3 -26
- package/src/service/planoStaticData.service.js +0 -3
- package/src/service/planoTask.service.js +0 -3
- package/inputjson/layoutverification.json +0 -466
- package/response.json +0 -647
- package/src/controllers/fixtureTemplate.controller.js +0 -463
- package/src/controllers/managePlano.controller.js +0 -386
- package/src/controllers/planoLibrary.controller.js +0 -1399
- package/src/routes/fixtureTemplate.routes.js +0 -17
- package/src/routes/managePlano.routes.js +0 -16
- package/src/routes/planoLibrary.routes.js +0 -40
- package/src/service/planoLibrary.service.js +0 -37
- package/src/service/planoVm.service.js +0 -49
- package/src/service/planoproductCategory.service.js +0 -39
- package/src/service/vmType.service.js +0 -33
|
@@ -4,16 +4,14 @@ import * as storeService from '../service/store.service.js';
|
|
|
4
4
|
import * as processedChecklistService from '../service/processedchecklist.service.js';
|
|
5
5
|
import * as userService from '../service/user.service.js';
|
|
6
6
|
import dayjs from 'dayjs';
|
|
7
|
-
import { logger, fileUpload, signedUrl } from 'tango-app-api-middleware';
|
|
7
|
+
import { logger, fileUpload, signedUrl, download } from 'tango-app-api-middleware';
|
|
8
8
|
import * as planoTaskService from '../service/planoTask.service.js';
|
|
9
9
|
import * as planoService from '../service/planogram.service.js';
|
|
10
10
|
import * as checklistService from '../service/checklist.service.js';
|
|
11
11
|
import timeZone from 'dayjs/plugin/timezone.js';
|
|
12
12
|
import * as planoProductService from '../service/planoProduct.service.js';
|
|
13
|
-
import mongoose from 'mongoose';
|
|
14
|
-
const ObjectId = mongoose.Types.ObjectId;
|
|
15
13
|
import * as floorService from '../service/storeBuilder.service.js';
|
|
16
|
-
import
|
|
14
|
+
import mongoose from 'mongoose';
|
|
17
15
|
|
|
18
16
|
dayjs.extend( timeZone );
|
|
19
17
|
|
|
@@ -116,18 +114,6 @@ export async function createTask( req, res ) {
|
|
|
116
114
|
if ( !taskDetails.length ) {
|
|
117
115
|
return res.sendError( 'No data found', 204 );
|
|
118
116
|
}
|
|
119
|
-
let endDate;
|
|
120
|
-
let scheduleEndTime = '11:59 PM';
|
|
121
|
-
let taskConfig = await planoStaticService.findOne( { clientId: req.body.clientId } );
|
|
122
|
-
if ( taskConfig && !req.body?.endTime ) {
|
|
123
|
-
scheduleEndTime = taskConfig.dueTime;
|
|
124
|
-
req.body.days = taskConfig?.dueDay || 0;
|
|
125
|
-
req.body.geoFencing = taskConfig?.allowedStoreLocation || false;
|
|
126
|
-
}
|
|
127
|
-
if ( req.body?.endTime ) {
|
|
128
|
-
scheduleEndTime = req.body.endTime;
|
|
129
|
-
}
|
|
130
|
-
endDate = dayjs().add( req.body.days, 'day' ).format( 'YYYY-MM-DD' );
|
|
131
117
|
let userEmailList = [ ...new Set( req.body.stores.map( ( ele ) => ele.email ) ) ];
|
|
132
118
|
for ( let mail of userEmailList ) {
|
|
133
119
|
let query = [
|
|
@@ -154,7 +140,7 @@ export async function createTask( req, res ) {
|
|
|
154
140
|
await createUser( userData );
|
|
155
141
|
}
|
|
156
142
|
}
|
|
157
|
-
endDate =
|
|
143
|
+
let endDate = dayjs().add( req.body.days, 'day' ).format( 'YYYY-MM-DD' );
|
|
158
144
|
await Promise.all( taskDetails.map( async ( task ) => {
|
|
159
145
|
let splitName = task?.checkListName.split( ' ' );
|
|
160
146
|
splitName.pop();
|
|
@@ -166,11 +152,11 @@ export async function createTask( req, res ) {
|
|
|
166
152
|
checkListName: task.checkListName,
|
|
167
153
|
checkListId: task._id,
|
|
168
154
|
scheduleStartTime: '12:00 AM',
|
|
169
|
-
scheduleEndTime:
|
|
155
|
+
scheduleEndTime: '11:59 PM',
|
|
170
156
|
scheduleStartTime_iso: dayjs.utc( '12:00 AM', 'hh:mm A' ).format(),
|
|
171
|
-
scheduleEndTime_iso: dayjs.utc(
|
|
157
|
+
scheduleEndTime_iso: dayjs( endDate ).utc( '11:59 PM', 'hh:mm A' ).format(),
|
|
172
158
|
allowedOverTime: false,
|
|
173
|
-
allowedStoreLocation:
|
|
159
|
+
allowedStoreLocation: false,
|
|
174
160
|
createdBy: task.createdBy,
|
|
175
161
|
createdByName: task.createdByName,
|
|
176
162
|
questionAnswers: [],
|
|
@@ -250,7 +236,6 @@ export async function createTask( req, res ) {
|
|
|
250
236
|
taskData.userName = userDetails.userName;
|
|
251
237
|
taskData.userEmail = userDetails.email;
|
|
252
238
|
taskData.planoId = planoDetails?._id;
|
|
253
|
-
console.log( taskData );
|
|
254
239
|
for ( let i=0; i<req.body.days; i++ ) {
|
|
255
240
|
let currDate = dayjs().add( i, 'day' );
|
|
256
241
|
let insertData = { ...taskData, date_string: currDate.format( 'YYYY-MM-DD' ), date_iso: new Date( currDate.format( 'YYYY-MM-DD' ) ), scheduleStartTime_iso: dayjs.utc( `${currDate.format( 'YYYY-MM-DD' )} 12:00 AM`, 'YYYY-MM-DD hh:mm A' ).format() };
|
|
@@ -525,31 +510,9 @@ export async function updateAnswers( req, res ) {
|
|
|
525
510
|
};
|
|
526
511
|
|
|
527
512
|
await planoTaskService.updateOne( { planoId: req.body.planoId, floorId: req.body.floorId, fixtureId: req.body.fixtureId, type: req.body.type, date_string: dayjs().format( 'YYYY-MM-DD' ), ...( taskDetails?._id ) ? { taskId: taskDetails?._id } :{} }, data );
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
return res.sendError( e, 500 );
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
export async function updateAnswersv2( req, res ) {
|
|
535
|
-
try {
|
|
536
|
-
let taskDetails = await processedService.findOne( { date_string: dayjs().format( 'YYYY-MM-DD' ), userId: req.user._id, isPlano: true, planoType: 'layout' } );
|
|
537
|
-
console.log( taskDetails );
|
|
538
|
-
let data = {
|
|
539
|
-
fixtureId: req.body.fixtureId,
|
|
540
|
-
answers: req.body.answers,
|
|
541
|
-
status: req.body.status,
|
|
542
|
-
planoId: req.body.planoId,
|
|
543
|
-
floorId: req.body.floorId,
|
|
544
|
-
type: req.body.type,
|
|
545
|
-
date_iso: new Date( dayjs().format( 'YYYY-MM-DD' ) ),
|
|
546
|
-
taskId: taskDetails?._id,
|
|
547
|
-
storeName: taskDetails?.storeName,
|
|
548
|
-
storeId: taskDetails?.store_id,
|
|
549
|
-
};
|
|
550
|
-
console.log( data );
|
|
551
|
-
await planoTaskService.updateOne( { planoId: req.body.planoId, floorId: req.body.floorId, fixtureId: req.body.fixtureId, type: req.body.type, date_string: dayjs().format( 'YYYY-MM-DD' ), ...( taskDetails?._id ) ? { taskId: taskDetails?._id } :{} }, data );
|
|
552
|
-
|
|
513
|
+
// req.body.taskId = taskDetails?._id;
|
|
514
|
+
// req.body.status = 'submit';
|
|
515
|
+
// await updateStatus( req, res );
|
|
553
516
|
return res.sendSuccess( 'Fixture details updated successfully' );
|
|
554
517
|
} catch ( e ) {
|
|
555
518
|
logger.error( { functionName: 'updateAnswers', error: e } );
|
|
@@ -666,51 +629,11 @@ export async function generatetaskDetails( req, res ) {
|
|
|
666
629
|
date_iso: { $gte: new Date( req.body.fromDate ), $lte: new Date( req.body.toDate ) },
|
|
667
630
|
isPlano: true,
|
|
668
631
|
planoType: 'layout',
|
|
669
|
-
...( req.body?.store?.length ) ? { storeName: { $in: req.body.store } } :{},
|
|
670
|
-
userEmail: { $nin: [ 'sandeep.pal@yopmail.com', 'balaji@tangotech.co.in', 'gowri@tangotech.co.in', 'gowri@yopmail.com' ] },
|
|
671
632
|
},
|
|
672
633
|
},
|
|
673
|
-
// {
|
|
674
|
-
// $lookup: {
|
|
675
|
-
// from: '$planogram',
|
|
676
|
-
// let: { plano: '$planoId' },
|
|
677
|
-
// pipeline: [
|
|
678
|
-
// {
|
|
679
|
-
// $match: {
|
|
680
|
-
// $expr: {
|
|
681
|
-
// $and: {
|
|
682
|
-
// $eq: [ '$_id', '$$plano' ],
|
|
683
|
-
// },
|
|
684
|
-
// },
|
|
685
|
-
// },
|
|
686
|
-
// },
|
|
687
|
-
// ],
|
|
688
|
-
// as: 'planogram',
|
|
689
|
-
// },
|
|
690
|
-
// },
|
|
691
|
-
// {
|
|
692
|
-
// $lookup: {
|
|
693
|
-
// from: 'checklistassignconfigs',
|
|
694
|
-
// let: { storeId: '$store_id', email: '$userEmail' },
|
|
695
|
-
// pipeline: [
|
|
696
|
-
// {
|
|
697
|
-
// $match: {
|
|
698
|
-
// $expr: {
|
|
699
|
-
// $and: [
|
|
700
|
-
// // { $eq: [ '$checkListId', new ObjectId( '6789e3c7a5683c58215ec089' ) ] },
|
|
701
|
-
// { $eq: [ '$store_id', '$$storeId' ] },
|
|
702
|
-
// { $eq: [ '$userEmail', '$$email' ] },
|
|
703
|
-
// ],
|
|
704
|
-
// },
|
|
705
|
-
// },
|
|
706
|
-
// },
|
|
707
|
-
// ],
|
|
708
|
-
// as: 'assignUser',
|
|
709
|
-
// },
|
|
710
|
-
// },
|
|
711
634
|
{
|
|
712
635
|
$project: {
|
|
713
|
-
_id:
|
|
636
|
+
_id: 0,
|
|
714
637
|
storeName: 1,
|
|
715
638
|
store_id: 1,
|
|
716
639
|
userEmail: 1,
|
|
@@ -720,7 +643,7 @@ export async function generatetaskDetails( req, res ) {
|
|
|
720
643
|
storeStatus: {
|
|
721
644
|
$cond: {
|
|
722
645
|
if: { $eq: [ '$checklistStatus', 'submit' ] },
|
|
723
|
-
then: '',
|
|
646
|
+
then: 'Yes',
|
|
724
647
|
else: '',
|
|
725
648
|
|
|
726
649
|
},
|
|
@@ -729,101 +652,51 @@ export async function generatetaskDetails( req, res ) {
|
|
|
729
652
|
},
|
|
730
653
|
{
|
|
731
654
|
$group: {
|
|
732
|
-
_id: '$
|
|
655
|
+
_id: '$store_id',
|
|
733
656
|
count: { $sum: 1 },
|
|
734
657
|
storeName: { $first: '$storeName' },
|
|
735
|
-
taskId: { $push: '$_id' },
|
|
736
658
|
checklistStatus: { $push: '$checklistStatus' },
|
|
737
|
-
date_string: { $push: '$date_string' },
|
|
738
659
|
},
|
|
739
660
|
},
|
|
740
661
|
{
|
|
741
662
|
$project: {
|
|
742
663
|
_id: 0,
|
|
743
|
-
taskId: 1,
|
|
744
664
|
storeName: 1,
|
|
745
665
|
checklistStatus: 1,
|
|
746
666
|
count: 1,
|
|
747
|
-
date_string: 1,
|
|
748
|
-
planoId: '$_id',
|
|
749
667
|
},
|
|
750
668
|
},
|
|
751
669
|
];
|
|
670
|
+
console.log( JSON.stringify( query ) );
|
|
752
671
|
let taskDetails = await processedService.aggregate( query );
|
|
753
|
-
|
|
754
|
-
// ...( req.body.store.length ) ? { storeName: { $in: req.body.store } } : {}, taskId: { $in: taskDetails.flatMap( ( ele ) => ele.taskId ) } },
|
|
755
|
-
let processedTaskDetails = await planoTaskService.find( { date_string: { $gte: req.body.fromDate, $lte: req.body.toDate }, type: 'layout' }, { status: 1, planoId: 1, date_string: 1, _id: 0, taskId: 1 } );
|
|
756
|
-
console.log( processedTaskDetails.length );
|
|
757
|
-
|
|
758
|
-
processedTaskDetails = await Promise.all( processedTaskDetails.map( async ( ele ) => {
|
|
759
|
-
ele = { ...ele.toObject(), storeName: '' };
|
|
760
|
-
if ( ele.planoId ) {
|
|
761
|
-
let planoDetails = await planoService.findOne( { _id: ele.planoId }, { storeName: 1 } );
|
|
762
|
-
console.log( planoDetails );
|
|
763
|
-
if ( planoDetails ) {
|
|
764
|
-
ele.storeName = planoDetails.storeName;
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
return ele;
|
|
768
|
-
} ) );
|
|
769
|
-
|
|
672
|
+
let processedTaskDetails = await planoTaskService.find( { date_string: { $gte: req.body.fromDate, $lte: req.body.toDate }, type: 'layout', status: 'incomplete' } );
|
|
770
673
|
processedTaskDetails.forEach( ( item ) => {
|
|
771
|
-
let taskIndex = taskDetails.findIndex( ( taskItem ) => taskItem.checklistStatus
|
|
772
|
-
console.log( taskIndex, 'index' );
|
|
674
|
+
let taskIndex = taskDetails.findIndex( ( taskItem ) => taskItem.checklistStatus == 'submit' && item.date_string == taskItem.date_string && item.planoId.toString() == taskItem.planoId.toString() );
|
|
773
675
|
if ( taskIndex != -1 ) {
|
|
774
|
-
taskDetails[taskIndex].storeStatus =
|
|
676
|
+
taskDetails[taskIndex].storeStatus = 'No';
|
|
775
677
|
}
|
|
776
678
|
} );
|
|
777
679
|
|
|
778
680
|
taskDetails.forEach( ( ele ) => {
|
|
779
681
|
delete ele.planoId;
|
|
780
682
|
} );
|
|
683
|
+
// console.log( taskDetails );
|
|
684
|
+
// let completeStore = [ ...new Set( taskDetails.filter( ( ele ) => ele.checklistStatus.includes( 'submit' ) ).map( ( ele ) => ele.storeName ) ) ];
|
|
781
685
|
|
|
686
|
+
// let incompleteStore = [ ...new Set( taskDetails.filter( ( ele ) => !ele.checklistStatus.includes( 'submit' ) ).map( ( ele ) => {
|
|
687
|
+
// return { storeName: ele.storeName, checklistStatus: ele.checklistStatus[ele.checklistStatus.length-1] };
|
|
688
|
+
// } ) ) ];
|
|
782
689
|
|
|
783
|
-
|
|
784
|
-
completeStore = completeStore.reduce( ( acc, ele ) => {
|
|
785
|
-
if ( !acc[ele.storeName] ) {
|
|
786
|
-
acc[ele.storeName] = {
|
|
787
|
-
storeName: ele.storeName,
|
|
788
|
-
status: 'submit',
|
|
789
|
-
storeStatus: ele.storeStatus,
|
|
790
|
-
};
|
|
791
|
-
}
|
|
792
|
-
return acc;
|
|
793
|
-
}, {} );
|
|
794
|
-
|
|
795
|
-
completeStore = Object.values( completeStore );
|
|
796
|
-
|
|
797
|
-
let completeStoreList =completeStore.map( ( item ) => item.storeName );
|
|
798
|
-
|
|
799
|
-
let incompleteStore = taskDetails.filter( ( ele ) => !ele.checklistStatus.includes( 'submit' ) );
|
|
800
|
-
|
|
801
|
-
incompleteStore = incompleteStore.reduce( ( acc, ele ) => {
|
|
802
|
-
if ( !acc[ele.storeName] ) {
|
|
803
|
-
acc[ele.storeName] = {
|
|
804
|
-
storeName: ele.storeName,
|
|
805
|
-
status: ele.checklistStatus[ele.checklistStatus.length - 1],
|
|
806
|
-
storeStatus: ele.storeStatus,
|
|
807
|
-
};
|
|
808
|
-
}
|
|
809
|
-
return acc;
|
|
810
|
-
}, {} );
|
|
811
|
-
|
|
812
|
-
incompleteStore = Object.values( incompleteStore );
|
|
813
|
-
|
|
814
|
-
incompleteStore = incompleteStore.filter( ( ele ) => !completeStoreList.includes( ele.storeName ) );
|
|
690
|
+
// incompleteStore = incompleteStore.filter( ( ele ) => !completeStore.includes( ele ) );
|
|
815
691
|
|
|
816
692
|
if ( !taskDetails.length ) {
|
|
817
693
|
return res.sendError( 'No date found', 204 );
|
|
818
694
|
}
|
|
819
695
|
|
|
820
|
-
|
|
821
|
-
let yesCount = completeStore.filter( ( ele ) => ele.storeStatus == 'yes' );
|
|
822
|
-
let noCount = completeStore.filter( ( ele ) => ele.storeStatus == 'No' );
|
|
696
|
+
// return res.sendSuccess( { completeCount: completeStore.length, store: completeStore, incompleteStore: incompleteStore, incompleteStoreCount: incompleteStore.length } );
|
|
823
697
|
|
|
824
|
-
|
|
698
|
+
await download( taskDetails, res );
|
|
825
699
|
} catch ( e ) {
|
|
826
|
-
console.log( e );
|
|
827
700
|
logger.error( { functioName: 'generatetaskDetails', error: e } );
|
|
828
701
|
return res.sendError( e, 500 );
|
|
829
702
|
}
|
|
@@ -836,35 +709,22 @@ export async function taskSubmitDetails( req, res ) {
|
|
|
836
709
|
$match: {
|
|
837
710
|
date_string: { $gte: req.body.fromDate, $lte: req.body.toDate },
|
|
838
711
|
type: 'layout',
|
|
839
|
-
status: req.body.status,
|
|
840
|
-
},
|
|
841
|
-
},
|
|
842
|
-
{
|
|
843
|
-
$group: {
|
|
844
|
-
_id: '',
|
|
845
|
-
planoId: { $addToSet: '$planoId' },
|
|
846
712
|
},
|
|
847
713
|
},
|
|
848
714
|
{
|
|
849
715
|
$lookup: {
|
|
850
|
-
from: '
|
|
716
|
+
from: 'planograms',
|
|
851
717
|
let: { plano_id: '$planoId' },
|
|
852
718
|
pipeline: [
|
|
853
719
|
{
|
|
854
720
|
$match: {
|
|
855
721
|
$expr: {
|
|
856
722
|
$and: [
|
|
857
|
-
{ $
|
|
723
|
+
{ $eq: [ '$_id', '$$plano_id' ] },
|
|
858
724
|
],
|
|
859
725
|
},
|
|
860
726
|
},
|
|
861
727
|
},
|
|
862
|
-
{
|
|
863
|
-
$group: {
|
|
864
|
-
_id: '$planoId',
|
|
865
|
-
storeName: { $first: '$storeName' },
|
|
866
|
-
},
|
|
867
|
-
},
|
|
868
728
|
{
|
|
869
729
|
$project: {
|
|
870
730
|
storeName: 1,
|
|
@@ -878,15 +738,41 @@ export async function taskSubmitDetails( req, res ) {
|
|
|
878
738
|
{ $unwind: { path: '$planogram', preserveNullAndEmptyArrays: true } },
|
|
879
739
|
{
|
|
880
740
|
$project: {
|
|
881
|
-
_id: 0,
|
|
882
741
|
storeName: '$planogram.storeName',
|
|
742
|
+
answers: 1,
|
|
743
|
+
type: 1,
|
|
744
|
+
status: 1,
|
|
745
|
+
planoId: 1,
|
|
746
|
+
floorId: 1,
|
|
747
|
+
},
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
$group: {
|
|
751
|
+
_id: '$planoId',
|
|
752
|
+
storeName: { $first: '$storeName' },
|
|
753
|
+
answers: { $last: '$answers' },
|
|
754
|
+
type: { $last: '$type' },
|
|
755
|
+
status: { $last: '$status' },
|
|
756
|
+
floorId: { $last: '$floorId' },
|
|
757
|
+
},
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
$project: {
|
|
761
|
+
storeName: 1,
|
|
762
|
+
answers: 1,
|
|
763
|
+
type: 1,
|
|
764
|
+
status: 1,
|
|
765
|
+
planoId: '$_id',
|
|
766
|
+
floorId: 1,
|
|
883
767
|
},
|
|
884
768
|
},
|
|
885
769
|
];
|
|
886
770
|
|
|
887
771
|
let processedTaskDetails = await planoTaskService.aggregate( query );
|
|
888
|
-
|
|
889
|
-
|
|
772
|
+
let completeStore = [ ...new Set( processedTaskDetails.filter( ( ele ) => ele.status == 'complete' ).map( ( ele ) => ele.storeName ) ) ];
|
|
773
|
+
let incompleteStore = [ ...new Set( processedTaskDetails.filter( ( ele ) => ele.status == 'incomplete' ).map( ( ele ) => ele.storeName ) ) ];
|
|
774
|
+
incompleteStore = incompleteStore.filter( ( ele ) => !completeStore.includes( ele ) );
|
|
775
|
+
return res.sendSuccess( { complete: { count: completeStore.length, storeList: completeStore }, incompleteStore: { count: incompleteStore.length, storeList: incompleteStore }, data: processedTaskDetails } );
|
|
890
776
|
} catch ( e ) {
|
|
891
777
|
logger.error( { functioName: 'taskSubmitDetails', error: e } );
|
|
892
778
|
return res.sendError( e, 500 );
|
|
@@ -89,230 +89,4 @@ export const updateStatus = {
|
|
|
89
89
|
body: updateStatusSchema,
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
export const createFixtureSchema = joi.object( {
|
|
93
|
-
fixtureCategory: joi.string().required(),
|
|
94
|
-
fixtureType: joi.string().required(),
|
|
95
|
-
clientId: joi.string().required(),
|
|
96
|
-
} );
|
|
97
|
-
|
|
98
|
-
export const createFixture = {
|
|
99
|
-
body: createFixtureSchema,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export const updateFixtureSchema = joi.object( {
|
|
103
|
-
fixtureWidth: joi.object().optional(),
|
|
104
|
-
fixtureHeight: joi.object().optional(),
|
|
105
|
-
fixtureCategory: joi.string().optional(),
|
|
106
|
-
fixtureLength: joi.object().optional(),
|
|
107
|
-
header: joi.object().optional(),
|
|
108
|
-
footer: joi.object().optional(),
|
|
109
|
-
shelfConfig: joi.array().optional(),
|
|
110
|
-
status: joi.string().required(),
|
|
111
|
-
fixtureCapacity: joi.number().required(),
|
|
112
|
-
isBodyEnabled: joi.boolean().required(),
|
|
113
|
-
} );
|
|
114
|
-
|
|
115
|
-
export const fixtureIdSchema = joi.object( {
|
|
116
|
-
fixtureId: joi.string().required(),
|
|
117
|
-
} );
|
|
118
|
-
|
|
119
|
-
export const fixtureId ={
|
|
120
|
-
query: fixtureIdSchema,
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export const bodyFixtureId = {
|
|
124
|
-
body: fixtureIdSchema,
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export const updateFixture = {
|
|
128
|
-
body: updateFixtureSchema,
|
|
129
|
-
params: fixtureIdSchema,
|
|
130
|
-
};
|
|
131
|
-
export const fixtureVMListSchema = joi.object( {
|
|
132
|
-
clientId: joi.string().required(),
|
|
133
|
-
limit: joi.number().required(),
|
|
134
|
-
offset: joi.number().required(),
|
|
135
|
-
sortColumnName: joi.string().required().allow( '' ),
|
|
136
|
-
sortBy: joi.number().required().allow( '' ),
|
|
137
|
-
searchValue: joi.string().required().allow( '' ),
|
|
138
|
-
filter: joi.object( {
|
|
139
|
-
status: joi.array().items( joi.any() ).min( 0 ),
|
|
140
|
-
type: joi.array().items( joi.any() ).min( 0 ),
|
|
141
|
-
size: joi.array().items( joi.any() ).min( 0 ).optional(),
|
|
142
|
-
brand: joi.array().items( joi.any() ).min( 0 ).optional(),
|
|
143
|
-
category: joi.array().items( joi.any() ).min( 0 ).optional(),
|
|
144
|
-
subCategory: joi.array().items( joi.any() ).min( 0 ).optional(),
|
|
145
|
-
} ).required(),
|
|
146
|
-
export: joi.boolean().required(),
|
|
147
|
-
emptyDownload: joi.boolean().required(),
|
|
148
|
-
} );
|
|
149
|
-
|
|
150
|
-
export const fixtureList = {
|
|
151
|
-
body: fixtureVMListSchema,
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
export const addVmTypeSchema = joi.object( {
|
|
155
|
-
clientId: joi.string().required(),
|
|
156
|
-
vmData: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
157
|
-
} );
|
|
158
|
-
|
|
159
|
-
export const addVmType = {
|
|
160
|
-
body: addVmTypeSchema,
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export const getClientSchema = joi.object( {
|
|
164
|
-
clientId: joi.string().required(),
|
|
165
|
-
} );
|
|
166
|
-
|
|
167
|
-
export const getClient = {
|
|
168
|
-
query: getClientSchema,
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export const brandSchema = joi.object( {
|
|
172
|
-
clientId: joi.string().required(),
|
|
173
|
-
export: joi.boolean().optional(),
|
|
174
|
-
emptyDownload: joi.boolean().optional(),
|
|
175
|
-
} );
|
|
176
|
-
|
|
177
|
-
export const brandDetails ={
|
|
178
|
-
body: brandSchema,
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
export const deleteVMTypeImageSchema = joi.object( {
|
|
182
|
-
vmId: joi.string().required(),
|
|
183
|
-
index: joi.number().required(),
|
|
184
|
-
} );
|
|
185
|
-
|
|
186
|
-
export const deleteVMTypeImage = {
|
|
187
|
-
body: getClientSchema,
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
export const updateTaskConfigSchema = joi.object( {
|
|
191
|
-
clientId: joi.string().required(),
|
|
192
|
-
dueDay: joi.number().required(),
|
|
193
|
-
dueTime: joi.string().required(),
|
|
194
|
-
allowedStoreLocation: joi.boolean().required(),
|
|
195
|
-
} );
|
|
196
|
-
|
|
197
|
-
export const updateTaskConfig = {
|
|
198
|
-
body: updateTaskConfigSchema,
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
export const uploadBrandListSchema = joi.object( {
|
|
202
|
-
clientId: joi.string().required(),
|
|
203
|
-
brandData: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
204
|
-
} );
|
|
205
|
-
|
|
206
|
-
export const uploadBrandList = {
|
|
207
|
-
body: uploadBrandListSchema,
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export const fixtureBulkUploadSchema = joi.object( {
|
|
211
|
-
clientId: joi.string().required(),
|
|
212
|
-
fixtureData: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
213
|
-
newFixtureStatus: joi.string().optional(),
|
|
214
|
-
updateFixtureStatus: joi.string().optional(),
|
|
215
|
-
deleteFixtureList: joi.array().items( joi.any() ).min( 0 ),
|
|
216
|
-
} );
|
|
217
|
-
|
|
218
|
-
export const fixtureBulkUpload = {
|
|
219
|
-
body: fixtureBulkUploadSchema,
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
export const addUpdateBrandSchema = joi.object( {
|
|
223
|
-
clientId: joi.string().required(),
|
|
224
|
-
brandUsedList: joi.array().items( joi.any() ).min( 0 ).required(),
|
|
225
|
-
brandData: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
226
|
-
} );
|
|
227
|
-
|
|
228
|
-
export const addUpdateBrand = {
|
|
229
|
-
body: addUpdateBrandSchema,
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
export const getVmDetailsSchema = joi.object( {
|
|
233
|
-
vmId: joi.string().required(),
|
|
234
|
-
} );
|
|
235
|
-
|
|
236
|
-
export const getVmDetails = {
|
|
237
|
-
query: getVmDetailsSchema,
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
export const deleteVmLibSchema = joi.object( {
|
|
241
|
-
vmId: joi.string().required(),
|
|
242
|
-
} );
|
|
243
|
-
|
|
244
|
-
export const deleteVmLib = {
|
|
245
|
-
body: deleteVmLibSchema,
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
export const addUpdateVmSchema = joi.object( {
|
|
249
|
-
clientId: joi.string().required(),
|
|
250
|
-
vmName: joi.string().required(),
|
|
251
|
-
vmType: joi.string().required(),
|
|
252
|
-
vmBrand: joi.string().required(),
|
|
253
|
-
vmSubBrand: joi.string().optional().allow( '' ),
|
|
254
|
-
vmCategory: joi.string().optional().allow( '' ),
|
|
255
|
-
vmSubCategory: joi.string().optional().allow( '' ),
|
|
256
|
-
vmHeight: joi.object( {
|
|
257
|
-
value: joi.number().required(),
|
|
258
|
-
unit: joi.string().required(),
|
|
259
|
-
} ).required(),
|
|
260
|
-
vmWidth: joi.object( {
|
|
261
|
-
value: joi.number().required(),
|
|
262
|
-
unit: joi.string().required(),
|
|
263
|
-
} ).required(),
|
|
264
|
-
vmImageUrl: joi.string().optional(),
|
|
265
|
-
isDoubleSided: joi.boolean().required(),
|
|
266
|
-
status: joi.string().required(),
|
|
267
|
-
_id: joi.string().optional(),
|
|
268
|
-
} );
|
|
269
|
-
|
|
270
|
-
export const addUpdateVm = {
|
|
271
|
-
body: addUpdateVmSchema,
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
export const vmBulkUploadSchema = joi.object( {
|
|
275
|
-
clientId: joi.string().required(),
|
|
276
|
-
vmData: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
277
|
-
newVmStatus: joi.string().required(),
|
|
278
|
-
updateVmStatus: joi.string().required(),
|
|
279
|
-
deleteVmList: joi.array().required(),
|
|
280
|
-
} );
|
|
281
|
-
|
|
282
|
-
export const vmBulkUpload = {
|
|
283
|
-
body: vmBulkUploadSchema,
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
export const createTemplateSchema = joi.object( {
|
|
287
|
-
clientId: joi.string().required(),
|
|
288
|
-
fixtureLibraryId: joi.string().required(),
|
|
289
|
-
} );
|
|
290
|
-
|
|
291
|
-
export const createTemplate = {
|
|
292
|
-
body: createTemplateSchema,
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
export const templateIdSchema = joi.object( {
|
|
296
|
-
templateId: joi.string().required(),
|
|
297
|
-
} );
|
|
298
|
-
|
|
299
|
-
export const templateId = {
|
|
300
|
-
body: templateIdSchema,
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
export const queryTemplateId = {
|
|
304
|
-
query: templateIdSchema,
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
export const updateFixtureTaskSchema = joi.object( {
|
|
308
|
-
endDate: joi.string().required(),
|
|
309
|
-
clientId: joi.string().required(),
|
|
310
|
-
storeList: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
311
|
-
endTime: joi.string().required(),
|
|
312
|
-
geoFencing: joi.boolean().required(),
|
|
313
|
-
} );
|
|
314
|
-
|
|
315
|
-
export const updateFixtureTask = {
|
|
316
|
-
body: updateFixtureTaskSchema,
|
|
317
|
-
};
|
|
318
92
|
|
|
@@ -29,6 +29,4 @@ scriptRouter
|
|
|
29
29
|
.post( '/downloadPlanoImages', scriptController.downloadPlanoImage )
|
|
30
30
|
.post( '/getVideoUrls', scriptController.getVideoLinks )
|
|
31
31
|
.post( '/updateExcelPlanogram', scriptController.updateExcelPlanogram )
|
|
32
|
-
.post( '/recorrectTaskData', scriptController.recorrectTaskData )
|
|
33
|
-
.post( '/migrateCrest', scriptController.migrateCrestv1 )
|
|
34
|
-
;
|
|
32
|
+
.post( '/recorrectTaskData', scriptController.recorrectTaskData );
|
|
@@ -43,8 +43,4 @@ storeBuilderRouter
|
|
|
43
43
|
.post( '/getFixtureBrands', isAllowedSessionHandler, storeBuilderController.getFixtureBrands )
|
|
44
44
|
.post( '/checkPlanoExist', isAllowedSessionHandler, storeBuilderController.checkPlanoExist )
|
|
45
45
|
.post( '/storeLayoutElements', isAllowedSessionHandler, storeBuilderController.storeLayoutElements )
|
|
46
|
-
.post( '/qrScan', storeBuilderController.qrScan )
|
|
47
|
-
.post( '/storeFixturesV2', validate( validateDtos.storeList ), storeBuilderController.storeFixturesv2 )
|
|
48
|
-
.post( '/fixtureShelfDetailsv2', validate( validateDtos.fixtureShelfProduct ), storeBuilderController.fixtureShelfProductv2 )
|
|
49
|
-
.post( '/storeFixturesTaskv2', storeBuilderController.storeFixturesTaskv2 )
|
|
50
|
-
;
|
|
46
|
+
.post( '/qrScan', storeBuilderController.qrScan );
|
|
@@ -11,7 +11,6 @@ storeBuilderTaskRouter
|
|
|
11
11
|
.post( '/uploadImage', isAllowedSessionHandler, taskController.uploadImage )
|
|
12
12
|
.post( '/updateStatus', isAllowedSessionHandler, taskController.updateStatus )
|
|
13
13
|
.post( '/updateAnswers', isAllowedSessionHandler, taskController.updateAnswers )
|
|
14
|
-
.post( '/updateAnswersv2', isAllowedSessionHandler, taskController.updateAnswersv2 )
|
|
15
14
|
.get( '/getFixtureDetails', isAllowedSessionHandler, taskController.getFixtureDetails )
|
|
16
15
|
.get( '/getVmDetails', isAllowedSessionHandler, taskController.getVmDetails )
|
|
17
16
|
.post( '/generateTaskExcel', taskController.generatetaskDetails )
|
|
@@ -8,37 +8,14 @@ export async function findOne( query={}, field={} ) {
|
|
|
8
8
|
return model.fixtureConfigModel.findOne( query, field );
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export async function insertMany( data
|
|
11
|
+
export async function insertMany( data ) {
|
|
12
12
|
return model.fixtureConfigModel.insertMany( data );
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export async function aggregate( query
|
|
15
|
+
export async function aggregate( query ) {
|
|
16
16
|
return model.fixtureConfigModel.aggregate( query );
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export async function updateOne( query
|
|
19
|
+
export async function updateOne( query, record ) {
|
|
20
20
|
return model.fixtureConfigModel.updateOne( query, { $set: record } );
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
export async function count( query = {} ) {
|
|
24
|
-
return model.fixtureConfigModel.countDocuments( query );
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export async function upsertOne( query, record ) {
|
|
28
|
-
return model.fixtureConfigModel.findOneAndUpdate(
|
|
29
|
-
query,
|
|
30
|
-
record,
|
|
31
|
-
{ upsert: true, new: true },
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
export async function create( data = {} ) {
|
|
35
|
-
return model.fixtureConfigModel.create( data );
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export async function deleteOne( query = {} ) {
|
|
39
|
-
return model.fixtureConfigModel.deleteOne( query );
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const findAndSort = async ( query={}, field={}, sort={} ) => {
|
|
43
|
-
return await model.fixtureConfigModel.find( query, field ).sort( sort ).collation( { locale: 'en_US', numericOrdering: true } );
|
|
44
|
-
};
|
|
@@ -6,6 +6,3 @@ export async function find( query={}, field={} ) {
|
|
|
6
6
|
export async function findOne( query={}, field={} ) {
|
|
7
7
|
return model.planoStaticData.findOne( query, field );
|
|
8
8
|
}
|
|
9
|
-
export async function updateOne( query={}, record={} ) {
|
|
10
|
-
return model.planoStaticData.updateOne( query, record, { upsert: true } );
|
|
11
|
-
}
|
|
@@ -7,9 +7,6 @@ export async function create( data ) {
|
|
|
7
7
|
export async function updateOne( query={}, record={} ) {
|
|
8
8
|
return model.planoTaskCompliance.updateOne( query, { $set: record }, { upsert: true } );
|
|
9
9
|
}
|
|
10
|
-
export async function updateOnefilters( query={}, record={}, arrayfilter=[] ) {
|
|
11
|
-
return model.planoTaskCompliance.findOneAndUpdate( query, record, { arrayFilters: arrayfilter, returnDocument: 'after' } );
|
|
12
|
-
}
|
|
13
10
|
|
|
14
11
|
export async function findOne( query={}, field={} ) {
|
|
15
12
|
return model.planoTaskCompliance.findOne( query, field );
|