tango-app-api-store-builder 1.0.0-beta-113 → 1.0.0-beta-115
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 +4 -1
- package/inputjson/layoutverification.json +465 -0
- package/package.json +3 -2
- package/response.json +654 -0
- package/src/controllers/fixtureTemplate.controller.js +475 -0
- package/src/controllers/managePlano.controller.js +572 -0
- package/src/controllers/planoLibrary.controller.js +1418 -0
- package/src/controllers/script.controller.js +1861 -401
- package/src/controllers/storeBuilder.controller.js +665 -289
- package/src/controllers/task.controller.js +176 -59
- package/src/dtos/validation.dtos.js +227 -0
- package/src/routes/fixtureTemplate.routes.js +17 -0
- package/src/routes/managePlano.routes.js +18 -0
- package/src/routes/planoLibrary.routes.js +40 -0
- package/src/routes/script.routes.js +3 -1
- package/src/routes/storeBuilder.routes.js +7 -1
- package/src/routes/task.routes.js +1 -0
- package/src/service/fixtureConfig.service.js +30 -3
- package/src/service/planoLibrary.service.js +37 -0
- package/src/service/planoStaticData.service.js +3 -0
- package/src/service/planoTask.service.js +3 -0
- package/src/service/planoVm.service.js +49 -0
- package/src/service/planoproductCategory.service.js +47 -0
- package/src/service/vmType.service.js +33 -0
|
@@ -4,14 +4,16 @@ 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
|
|
7
|
+
import { logger, fileUpload, signedUrl } 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 * as floorService from '../service/storeBuilder.service.js';
|
|
14
13
|
import mongoose from 'mongoose';
|
|
14
|
+
// const ObjectId = mongoose.Types.ObjectId;
|
|
15
|
+
import * as floorService from '../service/storeBuilder.service.js';
|
|
16
|
+
import * as planoStaticService from '../service/planoStaticData.service.js';
|
|
15
17
|
|
|
16
18
|
dayjs.extend( timeZone );
|
|
17
19
|
|
|
@@ -114,6 +116,18 @@ export async function createTask( req, res ) {
|
|
|
114
116
|
if ( !taskDetails.length ) {
|
|
115
117
|
return res.sendError( 'No data found', 204 );
|
|
116
118
|
}
|
|
119
|
+
let endDate;
|
|
120
|
+
let scheduleEndTime = '11:59 PM';
|
|
121
|
+
let taskConfig = await planoStaticService.findOne( { clientId: req.body.clientId, type: 'task' } );
|
|
122
|
+
if ( taskConfig && !req.body?.endTime ) {
|
|
123
|
+
scheduleEndTime = taskConfig?.dueTime || '11:59 PM';
|
|
124
|
+
req.body.days = taskConfig?.dueDay || 1;
|
|
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' );
|
|
117
131
|
let userEmailList = [ ...new Set( req.body.stores.map( ( ele ) => ele.email ) ) ];
|
|
118
132
|
for ( let mail of userEmailList ) {
|
|
119
133
|
let query = [
|
|
@@ -140,7 +154,7 @@ export async function createTask( req, res ) {
|
|
|
140
154
|
await createUser( userData );
|
|
141
155
|
}
|
|
142
156
|
}
|
|
143
|
-
|
|
157
|
+
endDate = `${endDate} ${scheduleEndTime}`;
|
|
144
158
|
await Promise.all( taskDetails.map( async ( task ) => {
|
|
145
159
|
let splitName = task?.checkListName.split( ' ' );
|
|
146
160
|
splitName.pop();
|
|
@@ -152,11 +166,11 @@ export async function createTask( req, res ) {
|
|
|
152
166
|
checkListName: task.checkListName,
|
|
153
167
|
checkListId: task._id,
|
|
154
168
|
scheduleStartTime: '12:00 AM',
|
|
155
|
-
scheduleEndTime:
|
|
169
|
+
scheduleEndTime: scheduleEndTime,
|
|
156
170
|
scheduleStartTime_iso: dayjs.utc( '12:00 AM', 'hh:mm A' ).format(),
|
|
157
|
-
scheduleEndTime_iso: dayjs
|
|
171
|
+
scheduleEndTime_iso: dayjs.utc( endDate, 'YYYY-MM-DD hh:mm A' ).format(),
|
|
158
172
|
allowedOverTime: false,
|
|
159
|
-
allowedStoreLocation: false,
|
|
173
|
+
allowedStoreLocation: req.body?.geoFencing || false,
|
|
160
174
|
createdBy: task.createdBy,
|
|
161
175
|
createdByName: task.createdByName,
|
|
162
176
|
questionAnswers: [],
|
|
@@ -228,8 +242,8 @@ export async function createTask( req, res ) {
|
|
|
228
242
|
let taskData = { ...data };
|
|
229
243
|
if ( floorDetails.length > 1 ) {
|
|
230
244
|
taskData.checkListName = taskData.checkListName +' - '+ floorDetails[i].floorName;
|
|
231
|
-
taskData.floorId = floorDetails[i]._id;
|
|
232
245
|
}
|
|
246
|
+
taskData.floorId = floorDetails[i]._id;
|
|
233
247
|
taskData.store_id = store.storeId;
|
|
234
248
|
taskData.storeName = store.storeName;
|
|
235
249
|
taskData.userId = userDetails._id;
|
|
@@ -510,9 +524,35 @@ export async function updateAnswers( req, res ) {
|
|
|
510
524
|
};
|
|
511
525
|
|
|
512
526
|
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 );
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
527
|
+
return res.sendSuccess( 'Fixture details updated successfully' );
|
|
528
|
+
} catch ( e ) {
|
|
529
|
+
logger.error( { functionName: 'updateAnswers', error: e } );
|
|
530
|
+
return res.sendError( e, 500 );
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
export async function updateAnswersv2( req, res ) {
|
|
534
|
+
try {
|
|
535
|
+
let taskDetails = await processedService.findOne( { _id: new mongoose.Types.ObjectId( req.body.taskId ) } );
|
|
536
|
+
console.log( taskDetails );
|
|
537
|
+
if ( !taskDetails ) {
|
|
538
|
+
return res.sendError( 'No data found', 204 );
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
let data = {
|
|
542
|
+
fixtureId: req.body.fixtureId,
|
|
543
|
+
answers: req.body.answers,
|
|
544
|
+
status: req.body.status,
|
|
545
|
+
planoId: req.body.planoId,
|
|
546
|
+
floorId: req.body.floorId,
|
|
547
|
+
type: req.body.type,
|
|
548
|
+
date_iso: new Date( dayjs().format( 'YYYY-MM-DD' ) ),
|
|
549
|
+
taskId: req.body.taskId,
|
|
550
|
+
storeName: req.body?.storeName,
|
|
551
|
+
storeId: req.body?.storeId,
|
|
552
|
+
};
|
|
553
|
+
console.log( data );
|
|
554
|
+
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 );
|
|
555
|
+
|
|
516
556
|
return res.sendSuccess( 'Fixture details updated successfully' );
|
|
517
557
|
} catch ( e ) {
|
|
518
558
|
logger.error( { functionName: 'updateAnswers', error: e } );
|
|
@@ -629,11 +669,51 @@ export async function generatetaskDetails( req, res ) {
|
|
|
629
669
|
date_iso: { $gte: new Date( req.body.fromDate ), $lte: new Date( req.body.toDate ) },
|
|
630
670
|
isPlano: true,
|
|
631
671
|
planoType: 'layout',
|
|
672
|
+
...( req.body?.store?.length ) ? { storeName: { $in: req.body.store } } :{},
|
|
673
|
+
userEmail: { $nin: [ 'sandeep.pal@yopmail.com', 'balaji@tangotech.co.in', 'gowri@tangotech.co.in', 'gowri@yopmail.com' ] },
|
|
632
674
|
},
|
|
633
675
|
},
|
|
676
|
+
// {
|
|
677
|
+
// $lookup: {
|
|
678
|
+
// from: '$planogram',
|
|
679
|
+
// let: { plano: '$planoId' },
|
|
680
|
+
// pipeline: [
|
|
681
|
+
// {
|
|
682
|
+
// $match: {
|
|
683
|
+
// $expr: {
|
|
684
|
+
// $and: {
|
|
685
|
+
// $eq: [ '$_id', '$$plano' ],
|
|
686
|
+
// },
|
|
687
|
+
// },
|
|
688
|
+
// },
|
|
689
|
+
// },
|
|
690
|
+
// ],
|
|
691
|
+
// as: 'planogram',
|
|
692
|
+
// },
|
|
693
|
+
// },
|
|
694
|
+
// {
|
|
695
|
+
// $lookup: {
|
|
696
|
+
// from: 'checklistassignconfigs',
|
|
697
|
+
// let: { storeId: '$store_id', email: '$userEmail' },
|
|
698
|
+
// pipeline: [
|
|
699
|
+
// {
|
|
700
|
+
// $match: {
|
|
701
|
+
// $expr: {
|
|
702
|
+
// $and: [
|
|
703
|
+
// // { $eq: [ '$checkListId', new ObjectId( '6789e3c7a5683c58215ec089' ) ] },
|
|
704
|
+
// { $eq: [ '$store_id', '$$storeId' ] },
|
|
705
|
+
// { $eq: [ '$userEmail', '$$email' ] },
|
|
706
|
+
// ],
|
|
707
|
+
// },
|
|
708
|
+
// },
|
|
709
|
+
// },
|
|
710
|
+
// ],
|
|
711
|
+
// as: 'assignUser',
|
|
712
|
+
// },
|
|
713
|
+
// },
|
|
634
714
|
{
|
|
635
715
|
$project: {
|
|
636
|
-
_id:
|
|
716
|
+
_id: 1,
|
|
637
717
|
storeName: 1,
|
|
638
718
|
store_id: 1,
|
|
639
719
|
userEmail: 1,
|
|
@@ -643,7 +723,7 @@ export async function generatetaskDetails( req, res ) {
|
|
|
643
723
|
storeStatus: {
|
|
644
724
|
$cond: {
|
|
645
725
|
if: { $eq: [ '$checklistStatus', 'submit' ] },
|
|
646
|
-
then: '
|
|
726
|
+
then: '',
|
|
647
727
|
else: '',
|
|
648
728
|
|
|
649
729
|
},
|
|
@@ -652,51 +732,101 @@ export async function generatetaskDetails( req, res ) {
|
|
|
652
732
|
},
|
|
653
733
|
{
|
|
654
734
|
$group: {
|
|
655
|
-
_id: '$
|
|
735
|
+
_id: '$storeName',
|
|
656
736
|
count: { $sum: 1 },
|
|
657
|
-
|
|
658
|
-
|
|
737
|
+
planoId: { $last: '$planoId' },
|
|
738
|
+
taskId: { $push: '$_id' },
|
|
739
|
+
checklistStatus: { $last: '$checklistStatus' },
|
|
740
|
+
date_string: { $push: '$date_string' },
|
|
659
741
|
},
|
|
660
742
|
},
|
|
661
743
|
{
|
|
662
744
|
$project: {
|
|
663
745
|
_id: 0,
|
|
664
|
-
|
|
746
|
+
taskId: 1,
|
|
747
|
+
planoId: 1,
|
|
665
748
|
checklistStatus: 1,
|
|
666
749
|
count: 1,
|
|
750
|
+
date_string: 1,
|
|
751
|
+
storeName: '$_id',
|
|
667
752
|
},
|
|
668
753
|
},
|
|
669
754
|
];
|
|
670
|
-
console.log( JSON.stringify( query ) );
|
|
671
755
|
let taskDetails = await processedService.aggregate( query );
|
|
672
|
-
|
|
756
|
+
console.log( taskDetails.flatMap( ( ele ) => ele.taskId ) );
|
|
757
|
+
// ...( req.body.store.length ) ? { storeName: { $in: req.body.store } } : {}, taskId: { $in: taskDetails.flatMap( ( ele ) => ele.taskId ) } },
|
|
758
|
+
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 } );
|
|
759
|
+
console.log( processedTaskDetails.length );
|
|
760
|
+
|
|
761
|
+
processedTaskDetails = await Promise.all( processedTaskDetails.map( async ( ele ) => {
|
|
762
|
+
ele = { ...ele.toObject(), storeName: '' };
|
|
763
|
+
if ( ele.planoId ) {
|
|
764
|
+
let planoDetails = await planoService.findOne( { _id: ele.planoId }, { storeName: 1 } );
|
|
765
|
+
console.log( planoDetails );
|
|
766
|
+
if ( planoDetails ) {
|
|
767
|
+
ele.storeName = planoDetails.storeName;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
return ele;
|
|
771
|
+
} ) );
|
|
772
|
+
|
|
673
773
|
processedTaskDetails.forEach( ( item ) => {
|
|
674
|
-
let taskIndex = taskDetails.findIndex( ( taskItem ) => taskItem.checklistStatus ==
|
|
774
|
+
let taskIndex = taskDetails.findIndex( ( taskItem ) => taskItem.checklistStatus =='submit' && taskItem.date_string.includes( item.date_string ) && item.planoId.toString() == taskItem.planoId.toString() );
|
|
775
|
+
console.log( taskIndex, 'index' );
|
|
675
776
|
if ( taskIndex != -1 ) {
|
|
676
|
-
taskDetails[taskIndex].storeStatus = 'No';
|
|
777
|
+
taskDetails[taskIndex].storeStatus = item.status == 'complete' ? 'yes' : 'No';
|
|
677
778
|
}
|
|
678
779
|
} );
|
|
679
780
|
|
|
680
781
|
taskDetails.forEach( ( ele ) => {
|
|
681
782
|
delete ele.planoId;
|
|
682
783
|
} );
|
|
683
|
-
// console.log( taskDetails );
|
|
684
|
-
// let completeStore = [ ...new Set( taskDetails.filter( ( ele ) => ele.checklistStatus.includes( 'submit' ) ).map( ( ele ) => ele.storeName ) ) ];
|
|
685
784
|
|
|
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
|
-
// } ) ) ];
|
|
689
785
|
|
|
690
|
-
|
|
786
|
+
let completeStore = taskDetails.filter( ( ele ) => ele.checklistStatus.includes( 'submit' ) );
|
|
787
|
+
completeStore = completeStore.reduce( ( acc, ele ) => {
|
|
788
|
+
if ( !acc[ele.storeName] ) {
|
|
789
|
+
acc[ele.storeName] = {
|
|
790
|
+
storeName: ele.storeName,
|
|
791
|
+
status: 'submit',
|
|
792
|
+
storeStatus: ele.storeStatus,
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
return acc;
|
|
796
|
+
}, {} );
|
|
797
|
+
|
|
798
|
+
completeStore = Object.values( completeStore );
|
|
799
|
+
|
|
800
|
+
let completeStoreList =completeStore.map( ( item ) => item.storeName );
|
|
801
|
+
|
|
802
|
+
let incompleteStore = taskDetails.filter( ( ele ) => !ele.checklistStatus.includes( 'submit' ) );
|
|
803
|
+
|
|
804
|
+
incompleteStore = incompleteStore.reduce( ( acc, ele ) => {
|
|
805
|
+
if ( !acc[ele.storeName] ) {
|
|
806
|
+
acc[ele.storeName] = {
|
|
807
|
+
storeName: ele.storeName,
|
|
808
|
+
status: ele.checklistStatus[ele.checklistStatus.length - 1],
|
|
809
|
+
storeStatus: ele.storeStatus,
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
return acc;
|
|
813
|
+
}, {} );
|
|
814
|
+
|
|
815
|
+
incompleteStore = Object.values( incompleteStore );
|
|
816
|
+
|
|
817
|
+
incompleteStore = incompleteStore.filter( ( ele ) => !completeStoreList.includes( ele.storeName ) );
|
|
691
818
|
|
|
692
819
|
if ( !taskDetails.length ) {
|
|
693
820
|
return res.sendError( 'No date found', 204 );
|
|
694
821
|
}
|
|
695
822
|
|
|
696
|
-
|
|
823
|
+
let data = [ ...completeStore, ...incompleteStore ];
|
|
824
|
+
let yesCount = completeStore.filter( ( ele ) => ele.storeStatus == 'yes' );
|
|
825
|
+
let noCount = completeStore.filter( ( ele ) => ele.storeStatus == 'No' );
|
|
697
826
|
|
|
698
|
-
|
|
827
|
+
return res.sendSuccess( { count: data.length, completeStore: completeStore.length, incompleteStore: incompleteStore.length, yesCount: yesCount.length, noCount: noCount.length, data } );
|
|
699
828
|
} catch ( e ) {
|
|
829
|
+
console.log( e );
|
|
700
830
|
logger.error( { functioName: 'generatetaskDetails', error: e } );
|
|
701
831
|
return res.sendError( e, 500 );
|
|
702
832
|
}
|
|
@@ -709,22 +839,35 @@ export async function taskSubmitDetails( req, res ) {
|
|
|
709
839
|
$match: {
|
|
710
840
|
date_string: { $gte: req.body.fromDate, $lte: req.body.toDate },
|
|
711
841
|
type: 'layout',
|
|
842
|
+
status: req.body.status,
|
|
843
|
+
},
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
$group: {
|
|
847
|
+
_id: '',
|
|
848
|
+
planoId: { $addToSet: '$planoId' },
|
|
712
849
|
},
|
|
713
850
|
},
|
|
714
851
|
{
|
|
715
852
|
$lookup: {
|
|
716
|
-
from: '
|
|
853
|
+
from: 'processedtasks',
|
|
717
854
|
let: { plano_id: '$planoId' },
|
|
718
855
|
pipeline: [
|
|
719
856
|
{
|
|
720
857
|
$match: {
|
|
721
858
|
$expr: {
|
|
722
859
|
$and: [
|
|
723
|
-
{ $
|
|
860
|
+
{ $in: [ '$planoId', '$$plano_id' ] },
|
|
724
861
|
],
|
|
725
862
|
},
|
|
726
863
|
},
|
|
727
864
|
},
|
|
865
|
+
{
|
|
866
|
+
$group: {
|
|
867
|
+
_id: '$planoId',
|
|
868
|
+
storeName: { $first: '$storeName' },
|
|
869
|
+
},
|
|
870
|
+
},
|
|
728
871
|
{
|
|
729
872
|
$project: {
|
|
730
873
|
storeName: 1,
|
|
@@ -738,41 +881,15 @@ export async function taskSubmitDetails( req, res ) {
|
|
|
738
881
|
{ $unwind: { path: '$planogram', preserveNullAndEmptyArrays: true } },
|
|
739
882
|
{
|
|
740
883
|
$project: {
|
|
884
|
+
_id: 0,
|
|
741
885
|
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,
|
|
767
886
|
},
|
|
768
887
|
},
|
|
769
888
|
];
|
|
770
889
|
|
|
771
890
|
let processedTaskDetails = await planoTaskService.aggregate( query );
|
|
772
|
-
|
|
773
|
-
|
|
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 } );
|
|
891
|
+
processedTaskDetails = processedTaskDetails.map( ( ele ) => ele.storeName );
|
|
892
|
+
return res.sendSuccess( { count: processedTaskDetails.length, data: processedTaskDetails } );
|
|
776
893
|
} catch ( e ) {
|
|
777
894
|
logger.error( { functioName: 'taskSubmitDetails', error: e } );
|
|
778
895
|
return res.sendError( e, 500 );
|
|
@@ -89,4 +89,231 @@ 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
|
+
brandUsedList:joi.array().items(joi.any()).min(0)
|
|
205
|
+
} );
|
|
206
|
+
|
|
207
|
+
export const uploadBrandList = {
|
|
208
|
+
body: uploadBrandListSchema,
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export const fixtureBulkUploadSchema = joi.object( {
|
|
212
|
+
clientId: joi.string().required(),
|
|
213
|
+
fixtureData: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
214
|
+
newFixtureStatus: joi.string().optional(),
|
|
215
|
+
updateFixtureStatus: joi.string().optional(),
|
|
216
|
+
deleteFixtureList: joi.array().items( joi.any() ).min( 0 ),
|
|
217
|
+
} );
|
|
218
|
+
|
|
219
|
+
export const fixtureBulkUpload = {
|
|
220
|
+
body: fixtureBulkUploadSchema,
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export const addUpdateBrandSchema = joi.object( {
|
|
224
|
+
clientId: joi.string().required(),
|
|
225
|
+
brandUsedList: joi.array().items( joi.any() ).min( 0 ).required(),
|
|
226
|
+
brandData: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
227
|
+
} );
|
|
228
|
+
|
|
229
|
+
export const addUpdateBrand = {
|
|
230
|
+
body: addUpdateBrandSchema,
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export const getVmDetailsSchema = joi.object( {
|
|
234
|
+
vmId: joi.string().required(),
|
|
235
|
+
} );
|
|
236
|
+
|
|
237
|
+
export const getVmDetails = {
|
|
238
|
+
query: getVmDetailsSchema,
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
export const deleteVmLibSchema = joi.object( {
|
|
242
|
+
vmId: joi.string().required(),
|
|
243
|
+
} );
|
|
244
|
+
|
|
245
|
+
export const deleteVmLib = {
|
|
246
|
+
body: deleteVmLibSchema,
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
export const addUpdateVmSchema = joi.object( {
|
|
250
|
+
clientId: joi.string().required(),
|
|
251
|
+
vmName: joi.string().required(),
|
|
252
|
+
vmType: joi.string().required(),
|
|
253
|
+
vmBrand: joi.string().required(),
|
|
254
|
+
vmSubBrand: joi.string().optional().allow( '' ),
|
|
255
|
+
vmCategory: joi.string().optional().allow( '' ),
|
|
256
|
+
vmSubCategory: joi.string().optional().allow( '' ),
|
|
257
|
+
vmHeight: joi.object( {
|
|
258
|
+
value: joi.number().required(),
|
|
259
|
+
unit: joi.string().required(),
|
|
260
|
+
} ).required(),
|
|
261
|
+
vmWidth: joi.object( {
|
|
262
|
+
value: joi.number().required(),
|
|
263
|
+
unit: joi.string().required(),
|
|
264
|
+
} ).required(),
|
|
265
|
+
vmImageUrl: joi.string().optional(),
|
|
266
|
+
isDoubleSided: joi.boolean().required(),
|
|
267
|
+
status: joi.string().required(),
|
|
268
|
+
_id: joi.string().optional(),
|
|
269
|
+
} );
|
|
270
|
+
|
|
271
|
+
export const addUpdateVm = {
|
|
272
|
+
body: addUpdateVmSchema,
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
export const vmBulkUploadSchema = joi.object( {
|
|
276
|
+
clientId: joi.string().required(),
|
|
277
|
+
vmData: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
278
|
+
newVmStatus: joi.string().required(),
|
|
279
|
+
updateVmStatus: joi.string().required(),
|
|
280
|
+
deleteVmList: joi.array().required(),
|
|
281
|
+
} );
|
|
282
|
+
|
|
283
|
+
export const vmBulkUpload = {
|
|
284
|
+
body: vmBulkUploadSchema,
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export const createTemplateSchema = joi.object( {
|
|
288
|
+
clientId: joi.string().required(),
|
|
289
|
+
fixtureLibraryId: joi.string().required(),
|
|
290
|
+
} );
|
|
291
|
+
|
|
292
|
+
export const createTemplate = {
|
|
293
|
+
body: createTemplateSchema,
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
export const templateIdSchema = joi.object( {
|
|
297
|
+
templateId: joi.string().required(),
|
|
298
|
+
} );
|
|
299
|
+
|
|
300
|
+
export const templateId = {
|
|
301
|
+
body: templateIdSchema,
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
export const queryTemplateId = {
|
|
305
|
+
query: templateIdSchema,
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
export const updateFixtureTaskSchema = joi.object( {
|
|
309
|
+
endDate: joi.string().required(),
|
|
310
|
+
clientId: joi.string().required(),
|
|
311
|
+
storeList: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
312
|
+
endTime: joi.string().required(),
|
|
313
|
+
geoFencing: joi.boolean().required(),
|
|
314
|
+
} );
|
|
315
|
+
|
|
316
|
+
export const updateFixtureTask = {
|
|
317
|
+
body: updateFixtureTaskSchema,
|
|
318
|
+
};
|
|
92
319
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { validate } from 'tango-app-api-middleware';
|
|
3
|
+
import * as fixtureTemplateController from '../controllers/fixtureTemplate.controller.js';
|
|
4
|
+
import * as validateDtos from '../dtos/validation.dtos.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export const fixtureTemplateRouter = express.Router();
|
|
8
|
+
|
|
9
|
+
fixtureTemplateRouter
|
|
10
|
+
.post( '/createTemplate', validate( validateDtos.createTemplate ), fixtureTemplateController.createTemplate )
|
|
11
|
+
.post( '/updateTemplate/:templateId', fixtureTemplateController.updateTemplate )
|
|
12
|
+
.post( '/deleteTemplate', validate( validateDtos.templateId ), fixtureTemplateController.deleteTemplate )
|
|
13
|
+
.post( '/duplicateTemplate', validate( validateDtos.templateId ), fixtureTemplateController.duplicateTemplate )
|
|
14
|
+
.post( '/getTemplateList', validate( validateDtos.fixtureVMListSchema ), fixtureTemplateController.getTemplateList )
|
|
15
|
+
.get( '/getTemplateDetails', validate( validateDtos.queryTemplateId ), fixtureTemplateController.getTemplateDetails )
|
|
16
|
+
.post( '/updateFixtureTask', validate( validateDtos.updateFixtureTask ), fixtureTemplateController.updateFixtureTask );
|
|
17
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import * as managePlanoController from '../controllers/managePlano.controller.js';
|
|
3
|
+
|
|
4
|
+
import { isAllowedSessionHandler } from 'tango-app-api-middleware';
|
|
5
|
+
|
|
6
|
+
export const managePlanoRouter = express.Router();
|
|
7
|
+
|
|
8
|
+
managePlanoRouter
|
|
9
|
+
.post( '/updateStorePlano', managePlanoController.updateStorePlano )
|
|
10
|
+
.post( '/getplanoFeedback', managePlanoController.getplanoFeedback )
|
|
11
|
+
.post( '/getStoreFixturesfeedback', managePlanoController.getStoreFixturesfeedback )
|
|
12
|
+
.get( '/fixtureList', managePlanoController.fixtureList )
|
|
13
|
+
.get( '/templateList', managePlanoController.templateList )
|
|
14
|
+
.get( '/fixtureBrandsList', managePlanoController.fixtureBrandsList )
|
|
15
|
+
.get( '/fixtureVMList', managePlanoController.fixtureVMList )
|
|
16
|
+
.post( '/updateFixtureStatus', isAllowedSessionHandler, managePlanoController.updateFixtureStatus )
|
|
17
|
+
.post( '/updateStoreFixture', managePlanoController.updateStoreFixture )
|
|
18
|
+
.post( '/updateStoreFixture', managePlanoController.updateStoreFixture );
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
|
|
3
|
+
import * as planoLibraryController from '../controllers/planoLibrary.controller.js';
|
|
4
|
+
import * as validateDtos from '../dtos/validation.dtos.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export const planoLibraryRouter = express.Router();
|
|
8
|
+
|
|
9
|
+
planoLibraryRouter
|
|
10
|
+
.post( '/fixtureBulkUpload', isAllowedSessionHandler, validate( validateDtos.fixtureBulkUpload ), planoLibraryController.fixtureBulkUpload )
|
|
11
|
+
.post( '/createFixture', isAllowedSessionHandler, validate( validateDtos.createFixture ), planoLibraryController.createFixture )
|
|
12
|
+
.post( '/updateFixture/:fixtureId', isAllowedSessionHandler, validate( validateDtos.updateFixture ), planoLibraryController.updateFixture )
|
|
13
|
+
.get( '/fixtureDetails', isAllowedSessionHandler, validate( validateDtos.fixtureId ), planoLibraryController.getFixture )
|
|
14
|
+
.post( '/fixtureList', isAllowedSessionHandler, validate( validateDtos.fixtureVMListSchema ), planoLibraryController.FixtureLibraryList )
|
|
15
|
+
.post( '/duplicateFixture', isAllowedSessionHandler, validate( validateDtos.bodyFixtureId ), planoLibraryController.duplicateFixture )
|
|
16
|
+
.post( '/deleteFixture', isAllowedSessionHandler, validate( validateDtos.bodyFixtureId ), planoLibraryController.deleteFixture )
|
|
17
|
+
.get( '/fixtureSizeList', isAllowedSessionHandler, validate( validateDtos.getClient ), planoLibraryController.getFixLibWidth );
|
|
18
|
+
|
|
19
|
+
planoLibraryRouter
|
|
20
|
+
.post( '/addVmType', isAllowedSessionHandler, validate( validateDtos.addVmType ), planoLibraryController.addVmType )
|
|
21
|
+
.post( '/uploadVmtypeImage/:vmId', isAllowedSessionHandler, planoLibraryController.uploadVmImage )
|
|
22
|
+
.post( '/deleteVmType', isAllowedSessionHandler, planoLibraryController.deleteVmType )
|
|
23
|
+
.get( '/getVmTypeList', isAllowedSessionHandler, validate( validateDtos.getClient ), planoLibraryController.getVmTypeList )
|
|
24
|
+
.post( '/deleteVmTypeImage', isAllowedSessionHandler, validate( validateDtos.deleteVMTypeImage ), planoLibraryController.deletevmTypeImage );
|
|
25
|
+
|
|
26
|
+
planoLibraryRouter
|
|
27
|
+
.post( '/getBrandList', isAllowedSessionHandler, validate( validateDtos.brandDetails ), planoLibraryController.getBrandList )
|
|
28
|
+
.post( '/addUpdateBrand', isAllowedSessionHandler, validate( validateDtos.addUpdateBrand ), planoLibraryController.addUpdateBrandList )
|
|
29
|
+
.post( '/uploadBrandList', isAllowedSessionHandler, validate( validateDtos.uploadBrandList ), planoLibraryController.uploadBrandList )
|
|
30
|
+
.post( '/updateTaskconfig', isAllowedSessionHandler, validate( validateDtos.updateTaskConfig ), planoLibraryController.updateTaskConfig )
|
|
31
|
+
.get( '/getTaskConfig', isAllowedSessionHandler, validate( validateDtos.getClient ), planoLibraryController.getTaskConfig );
|
|
32
|
+
|
|
33
|
+
planoLibraryRouter
|
|
34
|
+
.post( '/addUpdateVm', isAllowedSessionHandler, validate( validateDtos.addUpdateVm ), planoLibraryController.addUpdateVm )
|
|
35
|
+
.post( '/getVmLibList', isAllowedSessionHandler, validate( validateDtos.fixtureVMListSchema ), planoLibraryController.getVmLibList )
|
|
36
|
+
.post( '/duplicateVmLib', isAllowedSessionHandler, validate( validateDtos.deleteVmLib ), planoLibraryController.duplicateVmLib )
|
|
37
|
+
.post( '/deleteVmLib', isAllowedSessionHandler, validate( validateDtos.deleteVmLib ), planoLibraryController.deleteVmLibrary )
|
|
38
|
+
.get( '/getVmDetails', isAllowedSessionHandler, validate( validateDtos.getVmDetails ), planoLibraryController.getVmDetails )
|
|
39
|
+
.post( '/vmBulkUpload', isAllowedSessionHandler, validate( validateDtos.vmBulkUpload ), planoLibraryController.vmBulkUpload );
|
|
40
|
+
|