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