tango-app-api-store-builder 1.0.0-beta-102 → 1.0.0-beta-104
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 +260 -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 +132 -52
- package/src/dtos/validation.dtos.js +218 -0
- package/src/routes/fixtureTemplate.routes.js +17 -0
- package/src/routes/managePlano.routes.js +14 -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 +32 -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 +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: [],
|
|
@@ -519,6 +533,31 @@ export async function updateAnswers( req, res ) {
|
|
|
519
533
|
return res.sendError( e, 500 );
|
|
520
534
|
}
|
|
521
535
|
}
|
|
536
|
+
export async function updateAnswersv2( req, res ) {
|
|
537
|
+
try {
|
|
538
|
+
let taskDetails = await processedService.findOne( { date_string: dayjs().format( 'YYYY-MM-DD' ), userId: req.user._id, isPlano: true, planoType: 'layout' } );
|
|
539
|
+
console.log( taskDetails );
|
|
540
|
+
let data = {
|
|
541
|
+
fixtureId: req.body.fixtureId,
|
|
542
|
+
answers: req.body.answers,
|
|
543
|
+
status: req.body.status,
|
|
544
|
+
planoId: req.body.planoId,
|
|
545
|
+
floorId: req.body.floorId,
|
|
546
|
+
type: req.body.type,
|
|
547
|
+
date_iso: new Date( dayjs().format( 'YYYY-MM-DD' ) ),
|
|
548
|
+
taskId: taskDetails?._id,
|
|
549
|
+
storeName: taskDetails?.storeName,
|
|
550
|
+
storeId: taskDetails?.store_id,
|
|
551
|
+
};
|
|
552
|
+
console.log( data );
|
|
553
|
+
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 );
|
|
554
|
+
|
|
555
|
+
return res.sendSuccess( 'Fixture details updated successfully' );
|
|
556
|
+
} catch ( e ) {
|
|
557
|
+
logger.error( { functionName: 'updateAnswers', error: e } );
|
|
558
|
+
return res.sendError( e, 500 );
|
|
559
|
+
}
|
|
560
|
+
}
|
|
522
561
|
|
|
523
562
|
export async function getFixtureDetails( req, res ) {
|
|
524
563
|
try {
|
|
@@ -629,11 +668,33 @@ export async function generatetaskDetails( req, res ) {
|
|
|
629
668
|
date_iso: { $gte: new Date( req.body.fromDate ), $lte: new Date( req.body.toDate ) },
|
|
630
669
|
isPlano: true,
|
|
631
670
|
planoType: 'layout',
|
|
671
|
+
...( req.body?.store?.length ) ? { storeName: { $in: req.body.store } } :{},
|
|
672
|
+
userEmail: { $nin: [ 'sandeep.pal@yopmail.com', 'balaji@tangotech.co.in', 'gowri@tangotech.co.in', 'gowri@yopmail.com' ] },
|
|
673
|
+
},
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
$lookup: {
|
|
677
|
+
from: 'checklistassignconfigs',
|
|
678
|
+
let: { storeId: '$store_id', email: '$userEmail' },
|
|
679
|
+
pipeline: [
|
|
680
|
+
{
|
|
681
|
+
$match: {
|
|
682
|
+
$expr: {
|
|
683
|
+
$and: [
|
|
684
|
+
{ $eq: [ '$checkListId', new ObjectId( '6789e3c7a5683c58215ec089' ) ] },
|
|
685
|
+
{ $eq: [ '$store_id', '$$storeId' ] },
|
|
686
|
+
{ $eq: [ '$userEmail', '$$email' ] },
|
|
687
|
+
],
|
|
688
|
+
},
|
|
689
|
+
},
|
|
690
|
+
},
|
|
691
|
+
],
|
|
692
|
+
as: 'assignUser',
|
|
632
693
|
},
|
|
633
694
|
},
|
|
634
695
|
{
|
|
635
696
|
$project: {
|
|
636
|
-
_id:
|
|
697
|
+
_id: 1,
|
|
637
698
|
storeName: 1,
|
|
638
699
|
store_id: 1,
|
|
639
700
|
userEmail: 1,
|
|
@@ -643,7 +704,7 @@ export async function generatetaskDetails( req, res ) {
|
|
|
643
704
|
storeStatus: {
|
|
644
705
|
$cond: {
|
|
645
706
|
if: { $eq: [ '$checklistStatus', 'submit' ] },
|
|
646
|
-
then: '
|
|
707
|
+
then: '',
|
|
647
708
|
else: '',
|
|
648
709
|
|
|
649
710
|
},
|
|
@@ -652,51 +713,83 @@ export async function generatetaskDetails( req, res ) {
|
|
|
652
713
|
},
|
|
653
714
|
{
|
|
654
715
|
$group: {
|
|
655
|
-
_id: '$
|
|
716
|
+
_id: '$planoId',
|
|
656
717
|
count: { $sum: 1 },
|
|
657
718
|
storeName: { $first: '$storeName' },
|
|
719
|
+
taskId: { $last: '$_id' },
|
|
658
720
|
checklistStatus: { $push: '$checklistStatus' },
|
|
721
|
+
date_string: { $push: '$date_string' },
|
|
659
722
|
},
|
|
660
723
|
},
|
|
661
724
|
{
|
|
662
725
|
$project: {
|
|
663
726
|
_id: 0,
|
|
727
|
+
taskId: 1,
|
|
664
728
|
storeName: 1,
|
|
665
729
|
checklistStatus: 1,
|
|
666
730
|
count: 1,
|
|
731
|
+
date_string: 1,
|
|
732
|
+
planoId: '$_id',
|
|
667
733
|
},
|
|
668
734
|
},
|
|
669
735
|
];
|
|
670
|
-
console.log( JSON.stringify( query ) );
|
|
671
736
|
let taskDetails = await processedService.aggregate( query );
|
|
672
|
-
|
|
737
|
+
console.log( taskDetails.map( ( ele ) => ele.taskId ) );
|
|
738
|
+
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
739
|
processedTaskDetails.forEach( ( item ) => {
|
|
674
|
-
let taskIndex = taskDetails.findIndex( ( taskItem ) => taskItem.checklistStatus
|
|
740
|
+
let taskIndex = taskDetails.findIndex( ( taskItem ) => taskItem.checklistStatus.includes( 'submit' ) && taskItem.date_string.includes( item.date_string ) && item.planoId.toString() == taskItem.planoId.toString() );
|
|
675
741
|
if ( taskIndex != -1 ) {
|
|
676
|
-
taskDetails[taskIndex].storeStatus = 'No';
|
|
742
|
+
taskDetails[taskIndex].storeStatus = item.status == 'complete' ? 'yes' : 'No';
|
|
677
743
|
}
|
|
678
744
|
} );
|
|
679
745
|
|
|
680
746
|
taskDetails.forEach( ( ele ) => {
|
|
681
747
|
delete ele.planoId;
|
|
682
748
|
} );
|
|
683
|
-
// console.log( taskDetails );
|
|
684
|
-
// let completeStore = [ ...new Set( taskDetails.filter( ( ele ) => ele.checklistStatus.includes( 'submit' ) ).map( ( ele ) => ele.storeName ) ) ];
|
|
685
749
|
|
|
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
750
|
|
|
690
|
-
|
|
751
|
+
let completeStore = taskDetails.filter( ( ele ) => ele.checklistStatus.includes( 'submit' ) );
|
|
752
|
+
completeStore = completeStore.reduce( ( acc, ele ) => {
|
|
753
|
+
if ( !acc[ele.storeName] ) {
|
|
754
|
+
acc[ele.storeName] = {
|
|
755
|
+
storeName: ele.storeName,
|
|
756
|
+
status: 'submit',
|
|
757
|
+
storeStatus: ele.storeStatus,
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
return acc;
|
|
761
|
+
}, {} );
|
|
762
|
+
|
|
763
|
+
completeStore = Object.values( completeStore );
|
|
764
|
+
|
|
765
|
+
let completeStoreList =completeStore.map( ( item ) => item.storeName );
|
|
766
|
+
|
|
767
|
+
let incompleteStore = taskDetails.filter( ( ele ) => !ele.checklistStatus.includes( 'submit' ) );
|
|
768
|
+
|
|
769
|
+
incompleteStore = incompleteStore.reduce( ( acc, ele ) => {
|
|
770
|
+
if ( !acc[ele.storeName] ) {
|
|
771
|
+
acc[ele.storeName] = {
|
|
772
|
+
storeName: ele.storeName,
|
|
773
|
+
status: ele.checklistStatus[ele.checklistStatus.length - 1],
|
|
774
|
+
storeStatus: ele.storeStatus,
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
return acc;
|
|
778
|
+
}, {} );
|
|
779
|
+
|
|
780
|
+
incompleteStore = Object.values( incompleteStore );
|
|
781
|
+
|
|
782
|
+
incompleteStore = incompleteStore.filter( ( ele ) => !completeStoreList.includes( ele.storeName ) );
|
|
691
783
|
|
|
692
784
|
if ( !taskDetails.length ) {
|
|
693
785
|
return res.sendError( 'No date found', 204 );
|
|
694
786
|
}
|
|
695
787
|
|
|
696
|
-
|
|
788
|
+
let data = [ ...completeStore, ...incompleteStore ];
|
|
697
789
|
|
|
698
|
-
|
|
790
|
+
return res.sendSuccess( { count: data.length, completeStore: completeStore.length, incompleteStore: incompleteStore.length, data } );
|
|
699
791
|
} catch ( e ) {
|
|
792
|
+
console.log( e );
|
|
700
793
|
logger.error( { functioName: 'generatetaskDetails', error: e } );
|
|
701
794
|
return res.sendError( e, 500 );
|
|
702
795
|
}
|
|
@@ -709,22 +802,35 @@ export async function taskSubmitDetails( req, res ) {
|
|
|
709
802
|
$match: {
|
|
710
803
|
date_string: { $gte: req.body.fromDate, $lte: req.body.toDate },
|
|
711
804
|
type: 'layout',
|
|
805
|
+
status: req.body.status,
|
|
806
|
+
},
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
$group: {
|
|
810
|
+
_id: '',
|
|
811
|
+
planoId: { $addToSet: '$planoId' },
|
|
712
812
|
},
|
|
713
813
|
},
|
|
714
814
|
{
|
|
715
815
|
$lookup: {
|
|
716
|
-
from: '
|
|
816
|
+
from: 'processedtasks',
|
|
717
817
|
let: { plano_id: '$planoId' },
|
|
718
818
|
pipeline: [
|
|
719
819
|
{
|
|
720
820
|
$match: {
|
|
721
821
|
$expr: {
|
|
722
822
|
$and: [
|
|
723
|
-
{ $
|
|
823
|
+
{ $in: [ '$planoId', '$$plano_id' ] },
|
|
724
824
|
],
|
|
725
825
|
},
|
|
726
826
|
},
|
|
727
827
|
},
|
|
828
|
+
{
|
|
829
|
+
$group: {
|
|
830
|
+
_id: '$planoId',
|
|
831
|
+
storeName: { $first: '$storeName' },
|
|
832
|
+
},
|
|
833
|
+
},
|
|
728
834
|
{
|
|
729
835
|
$project: {
|
|
730
836
|
storeName: 1,
|
|
@@ -738,41 +844,15 @@ export async function taskSubmitDetails( req, res ) {
|
|
|
738
844
|
{ $unwind: { path: '$planogram', preserveNullAndEmptyArrays: true } },
|
|
739
845
|
{
|
|
740
846
|
$project: {
|
|
847
|
+
_id: 0,
|
|
741
848
|
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
849
|
},
|
|
768
850
|
},
|
|
769
851
|
];
|
|
770
852
|
|
|
771
853
|
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 } );
|
|
854
|
+
processedTaskDetails = processedTaskDetails.map( ( ele ) => ele.storeName );
|
|
855
|
+
return res.sendSuccess( { count: processedTaskDetails.length, data: processedTaskDetails } );
|
|
776
856
|
} catch ( e ) {
|
|
777
857
|
logger.error( { functioName: 'taskSubmitDetails', error: e } );
|
|
778
858
|
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,14 @@
|
|
|
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
|
+
.get( '/fixtureList', managePlanoController.fixtureList )
|
|
12
|
+
.get( '/templateList', managePlanoController.templateList )
|
|
13
|
+
.get( '/fixtureBrandsList', managePlanoController.fixtureBrandsList )
|
|
14
|
+
.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 )
|