tango-app-api-store-builder 1.0.0-beta-103 → 1.0.0-beta-105
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 +210 -0
- package/package.json +3 -2
- package/response.json +647 -0
- package/src/controllers/fixtureTemplate.controller.js +451 -0
- package/src/controllers/managePlano.controller.js +311 -0
- package/src/controllers/planoLibrary.controller.js +1313 -0
- package/src/controllers/script.controller.js +1791 -403
- package/src/controllers/storeBuilder.controller.js +526 -318
- package/src/controllers/task.controller.js +133 -52
- package/src/dtos/validation.dtos.js +218 -0
- package/src/routes/fixtureTemplate.routes.js +17 -0
- package/src/routes/managePlano.routes.js +15 -0
- package/src/routes/planoLibrary.routes.js +40 -0
- package/src/routes/script.routes.js +3 -1
- package/src/routes/storeBuilder.routes.js +5 -1
- package/src/routes/task.routes.js +1 -0
- package/src/service/fixtureConfig.service.js +33 -4
- 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 +39 -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 } );
|
|
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' );
|
|
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: [],
|
|
@@ -236,6 +250,7 @@ export async function createTask( req, res ) {
|
|
|
236
250
|
taskData.userName = userDetails.userName;
|
|
237
251
|
taskData.userEmail = userDetails.email;
|
|
238
252
|
taskData.planoId = planoDetails?._id;
|
|
253
|
+
console.log( taskData );
|
|
239
254
|
for ( let i=0; i<req.body.days; i++ ) {
|
|
240
255
|
let currDate = dayjs().add( i, 'day' );
|
|
241
256
|
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() };
|
|
@@ -519,6 +534,31 @@ export async function updateAnswers( req, res ) {
|
|
|
519
534
|
return res.sendError( e, 500 );
|
|
520
535
|
}
|
|
521
536
|
}
|
|
537
|
+
export async function updateAnswersv2( req, res ) {
|
|
538
|
+
try {
|
|
539
|
+
let taskDetails = await processedService.findOne( { date_string: dayjs().format( 'YYYY-MM-DD' ), userId: req.user._id, isPlano: true, planoType: 'layout' } );
|
|
540
|
+
console.log( taskDetails );
|
|
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: taskDetails?._id,
|
|
550
|
+
storeName: taskDetails?.storeName,
|
|
551
|
+
storeId: taskDetails?.store_id,
|
|
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
|
+
|
|
556
|
+
return res.sendSuccess( 'Fixture details updated successfully' );
|
|
557
|
+
} catch ( e ) {
|
|
558
|
+
logger.error( { functionName: 'updateAnswers', error: e } );
|
|
559
|
+
return res.sendError( e, 500 );
|
|
560
|
+
}
|
|
561
|
+
}
|
|
522
562
|
|
|
523
563
|
export async function getFixtureDetails( req, res ) {
|
|
524
564
|
try {
|
|
@@ -629,11 +669,33 @@ 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' ] },
|
|
674
|
+
},
|
|
675
|
+
},
|
|
676
|
+
{
|
|
677
|
+
$lookup: {
|
|
678
|
+
from: 'checklistassignconfigs',
|
|
679
|
+
let: { storeId: '$store_id', email: '$userEmail' },
|
|
680
|
+
pipeline: [
|
|
681
|
+
{
|
|
682
|
+
$match: {
|
|
683
|
+
$expr: {
|
|
684
|
+
$and: [
|
|
685
|
+
{ $eq: [ '$checkListId', new ObjectId( '6789e3c7a5683c58215ec089' ) ] },
|
|
686
|
+
{ $eq: [ '$store_id', '$$storeId' ] },
|
|
687
|
+
{ $eq: [ '$userEmail', '$$email' ] },
|
|
688
|
+
],
|
|
689
|
+
},
|
|
690
|
+
},
|
|
691
|
+
},
|
|
692
|
+
],
|
|
693
|
+
as: 'assignUser',
|
|
632
694
|
},
|
|
633
695
|
},
|
|
634
696
|
{
|
|
635
697
|
$project: {
|
|
636
|
-
_id:
|
|
698
|
+
_id: 1,
|
|
637
699
|
storeName: 1,
|
|
638
700
|
store_id: 1,
|
|
639
701
|
userEmail: 1,
|
|
@@ -643,7 +705,7 @@ export async function generatetaskDetails( req, res ) {
|
|
|
643
705
|
storeStatus: {
|
|
644
706
|
$cond: {
|
|
645
707
|
if: { $eq: [ '$checklistStatus', 'submit' ] },
|
|
646
|
-
then: '
|
|
708
|
+
then: '',
|
|
647
709
|
else: '',
|
|
648
710
|
|
|
649
711
|
},
|
|
@@ -652,51 +714,83 @@ export async function generatetaskDetails( req, res ) {
|
|
|
652
714
|
},
|
|
653
715
|
{
|
|
654
716
|
$group: {
|
|
655
|
-
_id: '$
|
|
717
|
+
_id: '$planoId',
|
|
656
718
|
count: { $sum: 1 },
|
|
657
719
|
storeName: { $first: '$storeName' },
|
|
720
|
+
taskId: { $last: '$_id' },
|
|
658
721
|
checklistStatus: { $push: '$checklistStatus' },
|
|
722
|
+
date_string: { $push: '$date_string' },
|
|
659
723
|
},
|
|
660
724
|
},
|
|
661
725
|
{
|
|
662
726
|
$project: {
|
|
663
727
|
_id: 0,
|
|
728
|
+
taskId: 1,
|
|
664
729
|
storeName: 1,
|
|
665
730
|
checklistStatus: 1,
|
|
666
731
|
count: 1,
|
|
732
|
+
date_string: 1,
|
|
733
|
+
planoId: '$_id',
|
|
667
734
|
},
|
|
668
735
|
},
|
|
669
736
|
];
|
|
670
|
-
console.log( JSON.stringify( query ) );
|
|
671
737
|
let taskDetails = await processedService.aggregate( query );
|
|
672
|
-
|
|
738
|
+
console.log( taskDetails.map( ( ele ) => ele.taskId ) );
|
|
739
|
+
let processedTaskDetails = await planoTaskService.find( { date_string: { $gte: req.body.fromDate, $lte: req.body.toDate }, type: 'layout', ...( req.body.store.length ) ? { storeName: { $in: req.body.store } } : {}, taskId: { $in: taskDetails.map( ( ele ) => ele.taskId ) } }, { status: 1, planoId: 1, date_string: 1, _id: 0, taskId: 1 } );
|
|
673
740
|
processedTaskDetails.forEach( ( item ) => {
|
|
674
|
-
let taskIndex = taskDetails.findIndex( ( taskItem ) => taskItem.checklistStatus
|
|
741
|
+
let taskIndex = taskDetails.findIndex( ( taskItem ) => taskItem.checklistStatus.includes( 'submit' ) && taskItem.date_string.includes( item.date_string ) && item.planoId.toString() == taskItem.planoId.toString() );
|
|
675
742
|
if ( taskIndex != -1 ) {
|
|
676
|
-
taskDetails[taskIndex].storeStatus = 'No';
|
|
743
|
+
taskDetails[taskIndex].storeStatus = item.status == 'complete' ? 'yes' : 'No';
|
|
677
744
|
}
|
|
678
745
|
} );
|
|
679
746
|
|
|
680
747
|
taskDetails.forEach( ( ele ) => {
|
|
681
748
|
delete ele.planoId;
|
|
682
749
|
} );
|
|
683
|
-
// console.log( taskDetails );
|
|
684
|
-
// let completeStore = [ ...new Set( taskDetails.filter( ( ele ) => ele.checklistStatus.includes( 'submit' ) ).map( ( ele ) => ele.storeName ) ) ];
|
|
685
750
|
|
|
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
751
|
|
|
690
|
-
|
|
752
|
+
let completeStore = taskDetails.filter( ( ele ) => ele.checklistStatus.includes( 'submit' ) );
|
|
753
|
+
completeStore = completeStore.reduce( ( acc, ele ) => {
|
|
754
|
+
if ( !acc[ele.storeName] ) {
|
|
755
|
+
acc[ele.storeName] = {
|
|
756
|
+
storeName: ele.storeName,
|
|
757
|
+
status: 'submit',
|
|
758
|
+
storeStatus: ele.storeStatus,
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
return acc;
|
|
762
|
+
}, {} );
|
|
763
|
+
|
|
764
|
+
completeStore = Object.values( completeStore );
|
|
765
|
+
|
|
766
|
+
let completeStoreList =completeStore.map( ( item ) => item.storeName );
|
|
767
|
+
|
|
768
|
+
let incompleteStore = taskDetails.filter( ( ele ) => !ele.checklistStatus.includes( 'submit' ) );
|
|
769
|
+
|
|
770
|
+
incompleteStore = incompleteStore.reduce( ( acc, ele ) => {
|
|
771
|
+
if ( !acc[ele.storeName] ) {
|
|
772
|
+
acc[ele.storeName] = {
|
|
773
|
+
storeName: ele.storeName,
|
|
774
|
+
status: ele.checklistStatus[ele.checklistStatus.length - 1],
|
|
775
|
+
storeStatus: ele.storeStatus,
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
return acc;
|
|
779
|
+
}, {} );
|
|
780
|
+
|
|
781
|
+
incompleteStore = Object.values( incompleteStore );
|
|
782
|
+
|
|
783
|
+
incompleteStore = incompleteStore.filter( ( ele ) => !completeStoreList.includes( ele.storeName ) );
|
|
691
784
|
|
|
692
785
|
if ( !taskDetails.length ) {
|
|
693
786
|
return res.sendError( 'No date found', 204 );
|
|
694
787
|
}
|
|
695
788
|
|
|
696
|
-
|
|
789
|
+
let data = [ ...completeStore, ...incompleteStore ];
|
|
697
790
|
|
|
698
|
-
|
|
791
|
+
return res.sendSuccess( { count: data.length, completeStore: completeStore.length, incompleteStore: incompleteStore.length, data } );
|
|
699
792
|
} catch ( e ) {
|
|
793
|
+
console.log( e );
|
|
700
794
|
logger.error( { functioName: 'generatetaskDetails', error: e } );
|
|
701
795
|
return res.sendError( e, 500 );
|
|
702
796
|
}
|
|
@@ -709,22 +803,35 @@ export async function taskSubmitDetails( req, res ) {
|
|
|
709
803
|
$match: {
|
|
710
804
|
date_string: { $gte: req.body.fromDate, $lte: req.body.toDate },
|
|
711
805
|
type: 'layout',
|
|
806
|
+
status: req.body.status,
|
|
807
|
+
},
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
$group: {
|
|
811
|
+
_id: '',
|
|
812
|
+
planoId: { $addToSet: '$planoId' },
|
|
712
813
|
},
|
|
713
814
|
},
|
|
714
815
|
{
|
|
715
816
|
$lookup: {
|
|
716
|
-
from: '
|
|
817
|
+
from: 'processedtasks',
|
|
717
818
|
let: { plano_id: '$planoId' },
|
|
718
819
|
pipeline: [
|
|
719
820
|
{
|
|
720
821
|
$match: {
|
|
721
822
|
$expr: {
|
|
722
823
|
$and: [
|
|
723
|
-
{ $
|
|
824
|
+
{ $in: [ '$planoId', '$$plano_id' ] },
|
|
724
825
|
],
|
|
725
826
|
},
|
|
726
827
|
},
|
|
727
828
|
},
|
|
829
|
+
{
|
|
830
|
+
$group: {
|
|
831
|
+
_id: '$planoId',
|
|
832
|
+
storeName: { $first: '$storeName' },
|
|
833
|
+
},
|
|
834
|
+
},
|
|
728
835
|
{
|
|
729
836
|
$project: {
|
|
730
837
|
storeName: 1,
|
|
@@ -738,41 +845,15 @@ export async function taskSubmitDetails( req, res ) {
|
|
|
738
845
|
{ $unwind: { path: '$planogram', preserveNullAndEmptyArrays: true } },
|
|
739
846
|
{
|
|
740
847
|
$project: {
|
|
848
|
+
_id: 0,
|
|
741
849
|
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
850
|
},
|
|
768
851
|
},
|
|
769
852
|
];
|
|
770
853
|
|
|
771
854
|
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 } );
|
|
855
|
+
processedTaskDetails = processedTaskDetails.map( ( ele ) => ele.storeName );
|
|
856
|
+
return res.sendSuccess( { count: processedTaskDetails.length, data: processedTaskDetails } );
|
|
776
857
|
} catch ( e ) {
|
|
777
858
|
logger.error( { functioName: 'taskSubmitDetails', error: e } );
|
|
778
859
|
return res.sendError( e, 500 );
|
|
@@ -89,4 +89,222 @@ 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 deleteVMTypeImageSchema = joi.object( {
|
|
172
|
+
vmId: joi.string().required(),
|
|
173
|
+
index: joi.number().required(),
|
|
174
|
+
} );
|
|
175
|
+
|
|
176
|
+
export const deleteVMTypeImage = {
|
|
177
|
+
body: getClientSchema,
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export const updateTaskConfigSchema = joi.object( {
|
|
181
|
+
clientId: joi.string().required(),
|
|
182
|
+
dueDay: joi.number().required(),
|
|
183
|
+
dueTime: joi.string().required(),
|
|
184
|
+
allowedStoreLocation: joi.boolean().required(),
|
|
185
|
+
} );
|
|
186
|
+
|
|
187
|
+
export const updateTaskConfig = {
|
|
188
|
+
body: updateTaskConfigSchema,
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export const uploadBrandListSchema = joi.object( {
|
|
192
|
+
clientId: joi.string().required(),
|
|
193
|
+
brandData: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
194
|
+
} );
|
|
195
|
+
|
|
196
|
+
export const uploadBrandList = {
|
|
197
|
+
body: uploadBrandListSchema,
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export const fixtureBulkUploadSchema = joi.object( {
|
|
201
|
+
clientId: joi.string().required(),
|
|
202
|
+
fixtureData: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
203
|
+
newFixtureStatus: joi.string().optional(),
|
|
204
|
+
updateFixtureStatus: joi.string().optional(),
|
|
205
|
+
deleteFixtureList: joi.array().items( joi.any() ).min( 0 ),
|
|
206
|
+
} );
|
|
207
|
+
|
|
208
|
+
export const fixtureBulkUpload = {
|
|
209
|
+
body: fixtureBulkUploadSchema,
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export const addUpdateBrandSchema = joi.object( {
|
|
213
|
+
clientId: joi.string().required(),
|
|
214
|
+
brandId: joi.string().optional(),
|
|
215
|
+
brandName: joi.string().required(),
|
|
216
|
+
subCategory: joi.array().items( joi.any() ).min( 0 ).required(),
|
|
217
|
+
category: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
218
|
+
} );
|
|
219
|
+
|
|
220
|
+
export const addUpdateBrand = {
|
|
221
|
+
body: addUpdateBrandSchema,
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export const getVmDetailsSchema = joi.object( {
|
|
225
|
+
vmId: joi.string().required(),
|
|
226
|
+
} );
|
|
227
|
+
|
|
228
|
+
export const getVmDetails = {
|
|
229
|
+
query: getVmDetailsSchema,
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export const deleteVmLibSchema = joi.object( {
|
|
233
|
+
vmId: joi.string().required(),
|
|
234
|
+
} );
|
|
235
|
+
|
|
236
|
+
export const deleteVmLib = {
|
|
237
|
+
body: deleteVmLibSchema,
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export const addUpdateVmSchema = joi.object( {
|
|
241
|
+
clientId: joi.string().required(),
|
|
242
|
+
vmName: joi.string().required(),
|
|
243
|
+
vmType: joi.string().required(),
|
|
244
|
+
vmBrand: joi.string().required(),
|
|
245
|
+
vmSubBrand: joi.string().optional().allow( '' ),
|
|
246
|
+
vmCategory: joi.string().optional().allow( '' ),
|
|
247
|
+
vmSubCategory: joi.string().optional().allow( '' ),
|
|
248
|
+
vmHeight: joi.object( {
|
|
249
|
+
value: joi.number().required(),
|
|
250
|
+
unit: joi.string().required(),
|
|
251
|
+
} ).required(),
|
|
252
|
+
vmWidth: joi.object( {
|
|
253
|
+
value: joi.number().required(),
|
|
254
|
+
unit: joi.string().required(),
|
|
255
|
+
} ).required(),
|
|
256
|
+
vmImageUrl: joi.string().optional(),
|
|
257
|
+
isDoubleSided: joi.boolean().required(),
|
|
258
|
+
status: joi.string().required(),
|
|
259
|
+
_id: joi.string().optional(),
|
|
260
|
+
} );
|
|
261
|
+
|
|
262
|
+
export const addUpdateVm = {
|
|
263
|
+
body: addUpdateVmSchema,
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
export const vmBulkUploadSchema = joi.object( {
|
|
267
|
+
clientId: joi.string().required(),
|
|
268
|
+
vmData: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
269
|
+
newVmStatus: joi.string().required(),
|
|
270
|
+
updateVmStatus: joi.string().required(),
|
|
271
|
+
deleteVmList: joi.array().required(),
|
|
272
|
+
} );
|
|
273
|
+
|
|
274
|
+
export const vmBulkUpload = {
|
|
275
|
+
body: vmBulkUploadSchema,
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
export const createTemplateSchema = joi.object( {
|
|
279
|
+
clientId: joi.string().required(),
|
|
280
|
+
fixtureLibraryId: joi.string().required(),
|
|
281
|
+
} );
|
|
282
|
+
|
|
283
|
+
export const createTemplate = {
|
|
284
|
+
body: createTemplateSchema,
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export const templateIdSchema = joi.object( {
|
|
288
|
+
templateId: joi.string().required(),
|
|
289
|
+
} );
|
|
290
|
+
|
|
291
|
+
export const templateId = {
|
|
292
|
+
body: templateIdSchema,
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
export const queryTemplateId = {
|
|
296
|
+
query: templateIdSchema,
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
export const updateFixtureTaskSchema = joi.object( {
|
|
300
|
+
endDate: joi.string().required(),
|
|
301
|
+
clientId: joi.string().required(),
|
|
302
|
+
storeList: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
303
|
+
endTime: joi.string().required(),
|
|
304
|
+
geoFencing: joi.boolean().required(),
|
|
305
|
+
} );
|
|
306
|
+
|
|
307
|
+
export const updateFixtureTask = {
|
|
308
|
+
body: updateFixtureTaskSchema,
|
|
309
|
+
};
|
|
92
310
|
|
|
@@ -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,15 @@
|
|
|
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
|
+
.post( '/updateFixtureStatus', isAllowedSessionHandler, managePlanoController.updateFixtureStatus );
|
|
@@ -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
|
+
.get( '/getBrandList', isAllowedSessionHandler, validate( validateDtos.getClient ), 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
|
+
|
|
@@ -29,4 +29,6 @@ scriptRouter
|
|
|
29
29
|
.post( '/downloadPlanoImages', scriptController.downloadPlanoImage )
|
|
30
30
|
.post( '/getVideoUrls', scriptController.getVideoLinks )
|
|
31
31
|
.post( '/updateExcelPlanogram', scriptController.updateExcelPlanogram )
|
|
32
|
-
.post( '/recorrectTaskData', scriptController.recorrectTaskData )
|
|
32
|
+
.post( '/recorrectTaskData', scriptController.recorrectTaskData )
|
|
33
|
+
.post( '/migrateCrest', scriptController.migrateCrestv1 )
|
|
34
|
+
;
|
|
@@ -43,4 +43,8 @@ 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 )
|
|
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
|
+
;
|
|
@@ -11,6 +11,7 @@ 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 )
|
|
14
15
|
.get( '/getFixtureDetails', isAllowedSessionHandler, taskController.getFixtureDetails )
|
|
15
16
|
.get( '/getVmDetails', isAllowedSessionHandler, taskController.getVmDetails )
|
|
16
17
|
.post( '/generateTaskExcel', taskController.generatetaskDetails )
|