tango-app-api-store-builder 1.0.0-beta-98 → 1.0.0-beta-99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -4
- package/package.json +2 -3
- package/src/controllers/script.controller.js +397 -1725
- package/src/controllers/storeBuilder.controller.js +318 -526
- package/src/controllers/task.controller.js +52 -131
- package/src/dtos/validation.dtos.js +0 -218
- package/src/routes/script.routes.js +1 -3
- package/src/routes/storeBuilder.routes.js +1 -5
- package/src/routes/task.routes.js +0 -1
- package/src/service/fixtureConfig.service.js +3 -26
- package/src/service/planoStaticData.service.js +0 -3
- package/inputjson/layoutverification.json +0 -111
- package/response.json +0 -647
- package/src/controllers/fixtureTemplate.controller.js +0 -451
- package/src/controllers/managePlano.controller.js +0 -131
- package/src/controllers/planoLibrary.controller.js +0 -1313
- package/src/routes/fixtureTemplate.routes.js +0 -17
- package/src/routes/managePlano.routes.js +0 -12
- package/src/routes/planoLibrary.routes.js +0 -40
- package/src/service/planoLibrary.service.js +0 -37
- package/src/service/planoVm.service.js +0 -49
- package/src/service/planoproductCategory.service.js +0 -39
- package/src/service/vmType.service.js +0 -33
|
@@ -4,16 +4,14 @@ import * as storeService from '../service/store.service.js';
|
|
|
4
4
|
import * as processedChecklistService from '../service/processedchecklist.service.js';
|
|
5
5
|
import * as userService from '../service/user.service.js';
|
|
6
6
|
import dayjs from 'dayjs';
|
|
7
|
-
import { logger, fileUpload, signedUrl } from 'tango-app-api-middleware';
|
|
7
|
+
import { logger, fileUpload, signedUrl, download } from 'tango-app-api-middleware';
|
|
8
8
|
import * as planoTaskService from '../service/planoTask.service.js';
|
|
9
9
|
import * as planoService from '../service/planogram.service.js';
|
|
10
10
|
import * as checklistService from '../service/checklist.service.js';
|
|
11
11
|
import timeZone from 'dayjs/plugin/timezone.js';
|
|
12
12
|
import * as planoProductService from '../service/planoProduct.service.js';
|
|
13
|
-
import mongoose from 'mongoose';
|
|
14
|
-
const ObjectId = mongoose.Types.ObjectId;
|
|
15
13
|
import * as floorService from '../service/storeBuilder.service.js';
|
|
16
|
-
import
|
|
14
|
+
import mongoose from 'mongoose';
|
|
17
15
|
|
|
18
16
|
dayjs.extend( timeZone );
|
|
19
17
|
|
|
@@ -116,18 +114,6 @@ export async function createTask( req, res ) {
|
|
|
116
114
|
if ( !taskDetails.length ) {
|
|
117
115
|
return res.sendError( 'No data found', 204 );
|
|
118
116
|
}
|
|
119
|
-
let endDate;
|
|
120
|
-
let scheduleEndTime = '11:59 PM';
|
|
121
|
-
let taskConfig = await planoStaticService.findOne( { clientId: req.body.clientId } );
|
|
122
|
-
if ( taskConfig && !req.body?.endTime ) {
|
|
123
|
-
scheduleEndTime = taskConfig.dueTime;
|
|
124
|
-
req.body.days = taskConfig?.dueDay || 0;
|
|
125
|
-
req.body.geoFencing = taskConfig?.allowedStoreLocation || false;
|
|
126
|
-
}
|
|
127
|
-
if ( req.body?.endTime ) {
|
|
128
|
-
scheduleEndTime = req.body.endTime;
|
|
129
|
-
}
|
|
130
|
-
endDate = dayjs().add( req.body.days, 'day' ).format( 'YYYY-MM-DD' );
|
|
131
117
|
let userEmailList = [ ...new Set( req.body.stores.map( ( ele ) => ele.email ) ) ];
|
|
132
118
|
for ( let mail of userEmailList ) {
|
|
133
119
|
let query = [
|
|
@@ -154,7 +140,7 @@ export async function createTask( req, res ) {
|
|
|
154
140
|
await createUser( userData );
|
|
155
141
|
}
|
|
156
142
|
}
|
|
157
|
-
endDate =
|
|
143
|
+
let endDate = dayjs().add( req.body.days, 'day' ).format( 'YYYY-MM-DD' );
|
|
158
144
|
await Promise.all( taskDetails.map( async ( task ) => {
|
|
159
145
|
let splitName = task?.checkListName.split( ' ' );
|
|
160
146
|
splitName.pop();
|
|
@@ -166,11 +152,11 @@ export async function createTask( req, res ) {
|
|
|
166
152
|
checkListName: task.checkListName,
|
|
167
153
|
checkListId: task._id,
|
|
168
154
|
scheduleStartTime: '12:00 AM',
|
|
169
|
-
scheduleEndTime:
|
|
155
|
+
scheduleEndTime: '11:59 PM',
|
|
170
156
|
scheduleStartTime_iso: dayjs.utc( '12:00 AM', 'hh:mm A' ).format(),
|
|
171
|
-
scheduleEndTime_iso: dayjs.utc(
|
|
157
|
+
scheduleEndTime_iso: dayjs( endDate ).utc( '11:59 PM', 'hh:mm A' ).format(),
|
|
172
158
|
allowedOverTime: false,
|
|
173
|
-
allowedStoreLocation:
|
|
159
|
+
allowedStoreLocation: false,
|
|
174
160
|
createdBy: task.createdBy,
|
|
175
161
|
createdByName: task.createdByName,
|
|
176
162
|
questionAnswers: [],
|
|
@@ -533,30 +519,6 @@ export async function updateAnswers( req, res ) {
|
|
|
533
519
|
return res.sendError( e, 500 );
|
|
534
520
|
}
|
|
535
521
|
}
|
|
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
|
-
}
|
|
560
522
|
|
|
561
523
|
export async function getFixtureDetails( req, res ) {
|
|
562
524
|
try {
|
|
@@ -667,33 +629,11 @@ export async function generatetaskDetails( req, res ) {
|
|
|
667
629
|
date_iso: { $gte: new Date( req.body.fromDate ), $lte: new Date( req.body.toDate ) },
|
|
668
630
|
isPlano: true,
|
|
669
631
|
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',
|
|
692
632
|
},
|
|
693
633
|
},
|
|
694
634
|
{
|
|
695
635
|
$project: {
|
|
696
|
-
_id:
|
|
636
|
+
_id: 0,
|
|
697
637
|
storeName: 1,
|
|
698
638
|
store_id: 1,
|
|
699
639
|
userEmail: 1,
|
|
@@ -703,7 +643,7 @@ export async function generatetaskDetails( req, res ) {
|
|
|
703
643
|
storeStatus: {
|
|
704
644
|
$cond: {
|
|
705
645
|
if: { $eq: [ '$checklistStatus', 'submit' ] },
|
|
706
|
-
then: '',
|
|
646
|
+
then: 'Yes',
|
|
707
647
|
else: '',
|
|
708
648
|
|
|
709
649
|
},
|
|
@@ -712,83 +652,51 @@ export async function generatetaskDetails( req, res ) {
|
|
|
712
652
|
},
|
|
713
653
|
{
|
|
714
654
|
$group: {
|
|
715
|
-
_id: '$
|
|
655
|
+
_id: '$store_id',
|
|
716
656
|
count: { $sum: 1 },
|
|
717
657
|
storeName: { $first: '$storeName' },
|
|
718
|
-
taskId: { $last: '$_id' },
|
|
719
658
|
checklistStatus: { $push: '$checklistStatus' },
|
|
720
|
-
date_string: { $push: '$date_string' },
|
|
721
659
|
},
|
|
722
660
|
},
|
|
723
661
|
{
|
|
724
662
|
$project: {
|
|
725
663
|
_id: 0,
|
|
726
|
-
taskId: 1,
|
|
727
664
|
storeName: 1,
|
|
728
665
|
checklistStatus: 1,
|
|
729
666
|
count: 1,
|
|
730
|
-
date_string: 1,
|
|
731
|
-
planoId: '$_id',
|
|
732
667
|
},
|
|
733
668
|
},
|
|
734
669
|
];
|
|
670
|
+
console.log( JSON.stringify( query ) );
|
|
735
671
|
let taskDetails = await processedService.aggregate( query );
|
|
736
|
-
|
|
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 } );
|
|
672
|
+
let processedTaskDetails = await planoTaskService.find( { date_string: { $gte: req.body.fromDate, $lte: req.body.toDate }, type: 'layout', status: 'incomplete' } );
|
|
738
673
|
processedTaskDetails.forEach( ( item ) => {
|
|
739
|
-
let taskIndex = taskDetails.findIndex( ( taskItem ) => taskItem.checklistStatus
|
|
674
|
+
let taskIndex = taskDetails.findIndex( ( taskItem ) => taskItem.checklistStatus == 'submit' && item.date_string == taskItem.date_string && item.planoId.toString() == taskItem.planoId.toString() );
|
|
740
675
|
if ( taskIndex != -1 ) {
|
|
741
|
-
taskDetails[taskIndex].storeStatus =
|
|
676
|
+
taskDetails[taskIndex].storeStatus = 'No';
|
|
742
677
|
}
|
|
743
678
|
} );
|
|
744
679
|
|
|
745
680
|
taskDetails.forEach( ( ele ) => {
|
|
746
681
|
delete ele.planoId;
|
|
747
682
|
} );
|
|
683
|
+
// console.log( taskDetails );
|
|
684
|
+
// let completeStore = [ ...new Set( taskDetails.filter( ( ele ) => ele.checklistStatus.includes( 'submit' ) ).map( ( ele ) => ele.storeName ) ) ];
|
|
748
685
|
|
|
686
|
+
// let incompleteStore = [ ...new Set( taskDetails.filter( ( ele ) => !ele.checklistStatus.includes( 'submit' ) ).map( ( ele ) => {
|
|
687
|
+
// return { storeName: ele.storeName, checklistStatus: ele.checklistStatus[ele.checklistStatus.length-1] };
|
|
688
|
+
// } ) ) ];
|
|
749
689
|
|
|
750
|
-
|
|
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 ) );
|
|
690
|
+
// incompleteStore = incompleteStore.filter( ( ele ) => !completeStore.includes( ele ) );
|
|
782
691
|
|
|
783
692
|
if ( !taskDetails.length ) {
|
|
784
693
|
return res.sendError( 'No date found', 204 );
|
|
785
694
|
}
|
|
786
695
|
|
|
787
|
-
|
|
696
|
+
// return res.sendSuccess( { completeCount: completeStore.length, store: completeStore, incompleteStore: incompleteStore, incompleteStoreCount: incompleteStore.length } );
|
|
788
697
|
|
|
789
|
-
|
|
698
|
+
await download( taskDetails, res );
|
|
790
699
|
} catch ( e ) {
|
|
791
|
-
console.log( e );
|
|
792
700
|
logger.error( { functioName: 'generatetaskDetails', error: e } );
|
|
793
701
|
return res.sendError( e, 500 );
|
|
794
702
|
}
|
|
@@ -801,35 +709,22 @@ export async function taskSubmitDetails( req, res ) {
|
|
|
801
709
|
$match: {
|
|
802
710
|
date_string: { $gte: req.body.fromDate, $lte: req.body.toDate },
|
|
803
711
|
type: 'layout',
|
|
804
|
-
status: req.body.status,
|
|
805
|
-
},
|
|
806
|
-
},
|
|
807
|
-
{
|
|
808
|
-
$group: {
|
|
809
|
-
_id: '',
|
|
810
|
-
planoId: { $addToSet: '$planoId' },
|
|
811
712
|
},
|
|
812
713
|
},
|
|
813
714
|
{
|
|
814
715
|
$lookup: {
|
|
815
|
-
from: '
|
|
716
|
+
from: 'planograms',
|
|
816
717
|
let: { plano_id: '$planoId' },
|
|
817
718
|
pipeline: [
|
|
818
719
|
{
|
|
819
720
|
$match: {
|
|
820
721
|
$expr: {
|
|
821
722
|
$and: [
|
|
822
|
-
{ $
|
|
723
|
+
{ $eq: [ '$_id', '$$plano_id' ] },
|
|
823
724
|
],
|
|
824
725
|
},
|
|
825
726
|
},
|
|
826
727
|
},
|
|
827
|
-
{
|
|
828
|
-
$group: {
|
|
829
|
-
_id: '$planoId',
|
|
830
|
-
storeName: { $first: '$storeName' },
|
|
831
|
-
},
|
|
832
|
-
},
|
|
833
728
|
{
|
|
834
729
|
$project: {
|
|
835
730
|
storeName: 1,
|
|
@@ -843,15 +738,41 @@ export async function taskSubmitDetails( req, res ) {
|
|
|
843
738
|
{ $unwind: { path: '$planogram', preserveNullAndEmptyArrays: true } },
|
|
844
739
|
{
|
|
845
740
|
$project: {
|
|
846
|
-
_id: 0,
|
|
847
741
|
storeName: '$planogram.storeName',
|
|
742
|
+
answers: 1,
|
|
743
|
+
type: 1,
|
|
744
|
+
status: 1,
|
|
745
|
+
planoId: 1,
|
|
746
|
+
floorId: 1,
|
|
747
|
+
},
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
$group: {
|
|
751
|
+
_id: '$planoId',
|
|
752
|
+
storeName: { $first: '$storeName' },
|
|
753
|
+
answers: { $last: '$answers' },
|
|
754
|
+
type: { $last: '$type' },
|
|
755
|
+
status: { $last: '$status' },
|
|
756
|
+
floorId: { $last: '$floorId' },
|
|
757
|
+
},
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
$project: {
|
|
761
|
+
storeName: 1,
|
|
762
|
+
answers: 1,
|
|
763
|
+
type: 1,
|
|
764
|
+
status: 1,
|
|
765
|
+
planoId: '$_id',
|
|
766
|
+
floorId: 1,
|
|
848
767
|
},
|
|
849
768
|
},
|
|
850
769
|
];
|
|
851
770
|
|
|
852
771
|
let processedTaskDetails = await planoTaskService.aggregate( query );
|
|
853
|
-
|
|
854
|
-
|
|
772
|
+
let completeStore = [ ...new Set( processedTaskDetails.filter( ( ele ) => ele.status == 'complete' ).map( ( ele ) => ele.storeName ) ) ];
|
|
773
|
+
let incompleteStore = [ ...new Set( processedTaskDetails.filter( ( ele ) => ele.status == 'incomplete' ).map( ( ele ) => ele.storeName ) ) ];
|
|
774
|
+
incompleteStore = incompleteStore.filter( ( ele ) => !completeStore.includes( ele ) );
|
|
775
|
+
return res.sendSuccess( { complete: { count: completeStore.length, storeList: completeStore }, incompleteStore: { count: incompleteStore.length, storeList: incompleteStore }, data: processedTaskDetails } );
|
|
855
776
|
} catch ( e ) {
|
|
856
777
|
logger.error( { functioName: 'taskSubmitDetails', error: e } );
|
|
857
778
|
return res.sendError( e, 500 );
|
|
@@ -89,222 +89,4 @@ export const updateStatus = {
|
|
|
89
89
|
body: updateStatusSchema,
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
export const createFixtureSchema = joi.object( {
|
|
93
|
-
fixtureCategory: joi.string().required(),
|
|
94
|
-
fixtureType: joi.string().required(),
|
|
95
|
-
clientId: joi.string().required(),
|
|
96
|
-
} );
|
|
97
|
-
|
|
98
|
-
export const createFixture = {
|
|
99
|
-
body: createFixtureSchema,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export const updateFixtureSchema = joi.object( {
|
|
103
|
-
fixtureWidth: joi.object().optional(),
|
|
104
|
-
fixtureHeight: joi.object().optional(),
|
|
105
|
-
fixtureCategory: joi.string().optional(),
|
|
106
|
-
fixtureLength: joi.object().optional(),
|
|
107
|
-
header: joi.object().optional(),
|
|
108
|
-
footer: joi.object().optional(),
|
|
109
|
-
shelfConfig: joi.array().optional(),
|
|
110
|
-
status: joi.string().required(),
|
|
111
|
-
fixtureCapacity: joi.number().required(),
|
|
112
|
-
isBodyEnabled: joi.boolean().required(),
|
|
113
|
-
} );
|
|
114
|
-
|
|
115
|
-
export const fixtureIdSchema = joi.object( {
|
|
116
|
-
fixtureId: joi.string().required(),
|
|
117
|
-
} );
|
|
118
|
-
|
|
119
|
-
export const fixtureId ={
|
|
120
|
-
query: fixtureIdSchema,
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export const bodyFixtureId = {
|
|
124
|
-
body: fixtureIdSchema,
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export const updateFixture = {
|
|
128
|
-
body: updateFixtureSchema,
|
|
129
|
-
params: fixtureIdSchema,
|
|
130
|
-
};
|
|
131
|
-
export const fixtureVMListSchema = joi.object( {
|
|
132
|
-
clientId: joi.string().required(),
|
|
133
|
-
limit: joi.number().required(),
|
|
134
|
-
offset: joi.number().required(),
|
|
135
|
-
sortColumnName: joi.string().required().allow( '' ),
|
|
136
|
-
sortBy: joi.number().required().allow( '' ),
|
|
137
|
-
searchValue: joi.string().required().allow( '' ),
|
|
138
|
-
filter: joi.object( {
|
|
139
|
-
status: joi.array().items( joi.any() ).min( 0 ),
|
|
140
|
-
type: joi.array().items( joi.any() ).min( 0 ),
|
|
141
|
-
size: joi.array().items( joi.any() ).min( 0 ).optional(),
|
|
142
|
-
brand: joi.array().items( joi.any() ).min( 0 ).optional(),
|
|
143
|
-
category: joi.array().items( joi.any() ).min( 0 ).optional(),
|
|
144
|
-
subCategory: joi.array().items( joi.any() ).min( 0 ).optional(),
|
|
145
|
-
} ).required(),
|
|
146
|
-
export: joi.boolean().required(),
|
|
147
|
-
emptyDownload: joi.boolean().required(),
|
|
148
|
-
} );
|
|
149
|
-
|
|
150
|
-
export const fixtureList = {
|
|
151
|
-
body: fixtureVMListSchema,
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
export const addVmTypeSchema = joi.object( {
|
|
155
|
-
clientId: joi.string().required(),
|
|
156
|
-
vmData: joi.array().items( joi.any() ).min( 1 ).required(),
|
|
157
|
-
} );
|
|
158
|
-
|
|
159
|
-
export const addVmType = {
|
|
160
|
-
body: addVmTypeSchema,
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export const getClientSchema = joi.object( {
|
|
164
|
-
clientId: joi.string().required(),
|
|
165
|
-
} );
|
|
166
|
-
|
|
167
|
-
export const getClient = {
|
|
168
|
-
query: getClientSchema,
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export const 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
|
-
};
|
|
310
92
|
|
|
@@ -29,6 +29,4 @@ scriptRouter
|
|
|
29
29
|
.post( '/downloadPlanoImages', scriptController.downloadPlanoImage )
|
|
30
30
|
.post( '/getVideoUrls', scriptController.getVideoLinks )
|
|
31
31
|
.post( '/updateExcelPlanogram', scriptController.updateExcelPlanogram )
|
|
32
|
-
.post( '/recorrectTaskData', scriptController.recorrectTaskData )
|
|
33
|
-
.post( '/migrateCrest', scriptController.migrateCrestv1 )
|
|
34
|
-
;
|
|
32
|
+
.post( '/recorrectTaskData', scriptController.recorrectTaskData );
|
|
@@ -43,8 +43,4 @@ storeBuilderRouter
|
|
|
43
43
|
.post( '/getFixtureBrands', isAllowedSessionHandler, storeBuilderController.getFixtureBrands )
|
|
44
44
|
.post( '/checkPlanoExist', isAllowedSessionHandler, storeBuilderController.checkPlanoExist )
|
|
45
45
|
.post( '/storeLayoutElements', isAllowedSessionHandler, storeBuilderController.storeLayoutElements )
|
|
46
|
-
.post( '/qrScan', storeBuilderController.qrScan )
|
|
47
|
-
.post( '/storeFixturesV2', validate( validateDtos.storeList ), storeBuilderController.storeFixturesv2 )
|
|
48
|
-
.post( '/fixtureShelfDetailsv2', validate( validateDtos.fixtureShelfProduct ), storeBuilderController.fixtureShelfProductv2 )
|
|
49
|
-
.post( '/storeFixturesTaskv2', storeBuilderController.storeFixturesTaskv2 )
|
|
50
|
-
;
|
|
46
|
+
.post( '/qrScan', storeBuilderController.qrScan );
|
|
@@ -11,7 +11,6 @@ storeBuilderTaskRouter
|
|
|
11
11
|
.post( '/uploadImage', isAllowedSessionHandler, taskController.uploadImage )
|
|
12
12
|
.post( '/updateStatus', isAllowedSessionHandler, taskController.updateStatus )
|
|
13
13
|
.post( '/updateAnswers', isAllowedSessionHandler, taskController.updateAnswers )
|
|
14
|
-
.post( '/updateAnswersv2', isAllowedSessionHandler, taskController.updateAnswersv2 )
|
|
15
14
|
.get( '/getFixtureDetails', isAllowedSessionHandler, taskController.getFixtureDetails )
|
|
16
15
|
.get( '/getVmDetails', isAllowedSessionHandler, taskController.getVmDetails )
|
|
17
16
|
.post( '/generateTaskExcel', taskController.generatetaskDetails )
|
|
@@ -8,37 +8,14 @@ export async function findOne( query={}, field={} ) {
|
|
|
8
8
|
return model.fixtureConfigModel.findOne( query, field );
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export async function insertMany( data
|
|
11
|
+
export async function insertMany( data ) {
|
|
12
12
|
return model.fixtureConfigModel.insertMany( data );
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export async function aggregate( query
|
|
15
|
+
export async function aggregate( query ) {
|
|
16
16
|
return model.fixtureConfigModel.aggregate( query );
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export async function updateOne( query
|
|
19
|
+
export async function updateOne( query, record ) {
|
|
20
20
|
return model.fixtureConfigModel.updateOne( query, { $set: record } );
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
export async function count( query = {} ) {
|
|
24
|
-
return model.fixtureConfigModel.countDocuments( query );
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export async function upsertOne( query, record ) {
|
|
28
|
-
return model.fixtureConfigModel.findOneAndUpdate(
|
|
29
|
-
query,
|
|
30
|
-
record,
|
|
31
|
-
{ upsert: true, new: true },
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
export async function create( data = {} ) {
|
|
35
|
-
return model.fixtureConfigModel.create( data );
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export async function deleteOne( query = {} ) {
|
|
39
|
-
return model.fixtureConfigModel.deleteOne( query );
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const findAndSort = async ( query={}, field={}, sort={} ) => {
|
|
43
|
-
return await model.fixtureConfigModel.find( query, field ).sort( sort ).collation( { locale: 'en_US', numericOrdering: true } );
|
|
44
|
-
};
|
|
@@ -6,6 +6,3 @@ export async function find( query={}, field={} ) {
|
|
|
6
6
|
export async function findOne( query={}, field={} ) {
|
|
7
7
|
return model.planoStaticData.findOne( query, field );
|
|
8
8
|
}
|
|
9
|
-
export async function updateOne( query={}, record={} ) {
|
|
10
|
-
return model.planoStaticData.updateOne( query, record, { upsert: true } );
|
|
11
|
-
}
|