tango-app-api-store-builder 1.0.0-beta-40 → 1.0.0-beta-42
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 +3 -1
- package/package.json +4 -3
- package/src/controllers/script.controller.js +827 -0
- package/src/controllers/storeBuilder.controller.js +103 -6
- package/src/controllers/task.controller.js +100 -91
- package/src/routes/script.routes.js +13 -0
- package/src/routes/storeBuilder.routes.js +17 -14
- package/src/service/planoProduct.service.js +4 -0
- package/src/service/processedchecklist.service.js +1 -1
- package/src/service/storeBuilder.service.js +8 -0
- package/src/service/storeFixture.service.js +8 -0
|
@@ -552,7 +552,7 @@ export async function storeFixturesv1( req, res ) {
|
|
|
552
552
|
{ storeId: { $in: req.body.id } },
|
|
553
553
|
],
|
|
554
554
|
},
|
|
555
|
-
{ storeId: 1, storeName: 1, planoId: '$_id', productResolutionLevel: 1, scanType: 1 },
|
|
555
|
+
{ storeId: 1, storeName: 1, planoId: '$_id', productResolutionLevel: 1, scanType: 1, clientId: 1 },
|
|
556
556
|
);
|
|
557
557
|
|
|
558
558
|
if ( !planograms?.length ) return res.sendError( 'No data found', 204 );
|
|
@@ -598,7 +598,7 @@ export async function storeFixturesv1( req, res ) {
|
|
|
598
598
|
date: currentDate,
|
|
599
599
|
} );
|
|
600
600
|
|
|
601
|
-
const shelves = await fixtureShelfService.find( { fixtureId: fixture._id }, { shelfNumber: 1 } );
|
|
601
|
+
const shelves = await fixtureShelfService.find( { fixtureId: fixture._id }, { shelfNumber: 1, sectionName: 1, sectionZone: 1 } );
|
|
602
602
|
|
|
603
603
|
const shelfDetails = await Promise.all(
|
|
604
604
|
shelves.map( async ( shelf ) => {
|
|
@@ -621,9 +621,24 @@ export async function storeFixturesv1( req, res ) {
|
|
|
621
621
|
if ( cvProcessStatus ) {
|
|
622
622
|
fixtureStatus = 'inprogress';
|
|
623
623
|
} else {
|
|
624
|
-
|
|
624
|
+
const missingCount = await planoComplianceService.count( {
|
|
625
|
+
fixtureId: fixture._id,
|
|
626
|
+
compliance: 'missing',
|
|
627
|
+
date: currentDate,
|
|
628
|
+
} );
|
|
629
|
+
fixtureStatus = complianceCount === 0 && !missingCount ? '' : complianceCount === productCount ? 'complete' : 'incomplete';
|
|
625
630
|
}
|
|
626
631
|
|
|
632
|
+
const vms = await planoMappingService.find( { fixtureId: fixture._id, type: 'vm' } );
|
|
633
|
+
|
|
634
|
+
const vmDetails = await Promise.all( vms.map( async ( vm ) => {
|
|
635
|
+
const vmTemplate = await planoProductService.findOne( { _id: vm.toObject().productId } );
|
|
636
|
+
return {
|
|
637
|
+
...vm.toObject(),
|
|
638
|
+
...vmTemplate?.toObject(),
|
|
639
|
+
};
|
|
640
|
+
} ) );
|
|
641
|
+
|
|
627
642
|
return {
|
|
628
643
|
...fixture.toObject(),
|
|
629
644
|
status: fixtureStatus,
|
|
@@ -631,6 +646,7 @@ export async function storeFixturesv1( req, res ) {
|
|
|
631
646
|
productCount: productCount,
|
|
632
647
|
vmCount: vmCount,
|
|
633
648
|
shelfDetails: shelfDetails,
|
|
649
|
+
vms: vmDetails,
|
|
634
650
|
};
|
|
635
651
|
} ),
|
|
636
652
|
);
|
|
@@ -676,7 +692,7 @@ export async function storeFixturesv1( req, res ) {
|
|
|
676
692
|
date: currentDate,
|
|
677
693
|
} );
|
|
678
694
|
|
|
679
|
-
const shelves = await fixtureShelfService.find( { fixtureId: fixture._id }, { shelfNumber: 1 } );
|
|
695
|
+
const shelves = await fixtureShelfService.find( { fixtureId: fixture._id }, { shelfNumber: 1, sectionName: 1, sectionZone: 1 } );
|
|
680
696
|
|
|
681
697
|
const shelfDetails = await Promise.all(
|
|
682
698
|
shelves.map( async ( shelf ) => {
|
|
@@ -699,9 +715,25 @@ export async function storeFixturesv1( req, res ) {
|
|
|
699
715
|
if ( cvProcessStatus ) {
|
|
700
716
|
fixtureStatus = 'inprogress';
|
|
701
717
|
} else {
|
|
702
|
-
|
|
718
|
+
const missingCount = await planoComplianceService.count( {
|
|
719
|
+
fixtureId: fixture._id,
|
|
720
|
+
compliance: 'missing',
|
|
721
|
+
date: currentDate,
|
|
722
|
+
} );
|
|
723
|
+
fixtureStatus = complianceCount === 0 && !missingCount ? '' : complianceCount === productCount ? 'complete' : 'incomplete';
|
|
703
724
|
}
|
|
704
725
|
|
|
726
|
+
const vms = await planoMappingService.find( { fixtureId: fixture._id, type: 'vm' } );
|
|
727
|
+
|
|
728
|
+
const vmDetails = await Promise.all( vms.map( async ( vm ) => {
|
|
729
|
+
const vmTemplate = await planoProductService.findOne( { _id: vm.toObject().productId } );
|
|
730
|
+
|
|
731
|
+
return {
|
|
732
|
+
...vm.toObject(),
|
|
733
|
+
...vmTemplate?.toObject(),
|
|
734
|
+
};
|
|
735
|
+
} ) );
|
|
736
|
+
|
|
705
737
|
return {
|
|
706
738
|
...fixture.toObject(),
|
|
707
739
|
status: fixtureStatus,
|
|
@@ -709,7 +741,7 @@ export async function storeFixturesv1( req, res ) {
|
|
|
709
741
|
productCount: productCount,
|
|
710
742
|
vmCount: vmCount,
|
|
711
743
|
shelfDetails: shelfDetails,
|
|
712
|
-
|
|
744
|
+
vms: vmDetails,
|
|
713
745
|
};
|
|
714
746
|
} ),
|
|
715
747
|
);
|
|
@@ -2348,4 +2380,69 @@ export const fixtureQrUpdate = async ( req, res ) => {
|
|
|
2348
2380
|
}
|
|
2349
2381
|
};
|
|
2350
2382
|
|
|
2383
|
+
export const updateDetailedDistance = async ( req, res ) => {
|
|
2384
|
+
try {
|
|
2385
|
+
const { floorId, elementNumber, elementType, detailedDistance } = req.body;
|
|
2386
|
+
|
|
2387
|
+
if ( !floorId || elementNumber === undefined || !elementType || detailedDistance === undefined ) {
|
|
2388
|
+
return res.sendError( 'Missing required fields', 400 );
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
const floorData = await storeBuilderService.findOne( { '_id': new mongoose.Types.ObjectId( floorId ) } );
|
|
2392
|
+
|
|
2393
|
+
const layoutPolygon = floorData.toObject().layoutPolygon.map( ( element ) => {
|
|
2394
|
+
if ( element.elementType === elementType && element.elementNumber === elementNumber ) {
|
|
2395
|
+
return {
|
|
2396
|
+
...element,
|
|
2397
|
+
detailedDistance: detailedDistance,
|
|
2398
|
+
};
|
|
2399
|
+
} else {
|
|
2400
|
+
return { ...element };
|
|
2401
|
+
}
|
|
2402
|
+
} );
|
|
2403
|
+
|
|
2404
|
+
const updateFloor = await storeBuilderService.updateOne( { '_id': new mongoose.Types.ObjectId( floorId ) }, { layoutPolygon: layoutPolygon } );
|
|
2351
2405
|
|
|
2406
|
+
|
|
2407
|
+
if ( !updateFloor.modifiedCount ) {
|
|
2408
|
+
return res.sendError( 'Floor layout or element not found', 400 );
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
return res.sendSuccess( { message: 'Detailed distance updated successfully', updateFloor } );
|
|
2412
|
+
} catch ( error ) {
|
|
2413
|
+
logger.error( 'updateDetailedDistance =>', error );
|
|
2414
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
2415
|
+
}
|
|
2416
|
+
};
|
|
2417
|
+
|
|
2418
|
+
export const upsertFixtures = async ( req, res ) => {
|
|
2419
|
+
try {
|
|
2420
|
+
const { fixtureId, planoId, floorId, data } = req.body;
|
|
2421
|
+
|
|
2422
|
+
if ( !planoId || !floorId || !data ) {
|
|
2423
|
+
return res.sendError( 'Missing required fields', 400 );
|
|
2424
|
+
}
|
|
2425
|
+
|
|
2426
|
+
const updateData = {
|
|
2427
|
+
planoId: new mongoose.Types.ObjectId( planoId ),
|
|
2428
|
+
floorId: new mongoose.Types.ObjectId( floorId ),
|
|
2429
|
+
...data,
|
|
2430
|
+
};
|
|
2431
|
+
|
|
2432
|
+
let fixture;
|
|
2433
|
+
if ( fixtureId ) {
|
|
2434
|
+
fixture = await storeFixtureService.findOneAndUpdate(
|
|
2435
|
+
{ _id: fixtureId },
|
|
2436
|
+
{ $set: updateData },
|
|
2437
|
+
{ new: true, upsert: true },
|
|
2438
|
+
);
|
|
2439
|
+
} else {
|
|
2440
|
+
fixture = await storeFixtureService.create( updateData );
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
return res.sendSuccess( { message: 'Fixture upserted successfully', fixture } );
|
|
2444
|
+
} catch ( error ) {
|
|
2445
|
+
logger.error( 'upsertFixtures =>', error );
|
|
2446
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
2447
|
+
}
|
|
2448
|
+
};
|
|
@@ -106,117 +106,123 @@ export async function createTask( req, res ) {
|
|
|
106
106
|
if ( !taskDetails.length ) {
|
|
107
107
|
return res.sendError( 'No data found', 204 );
|
|
108
108
|
}
|
|
109
|
+
let endDate = dayjs().add( req.body.days, 'day' ).format( 'YYYY-MM-DD' );
|
|
109
110
|
await Promise.all( taskDetails.map( async ( task ) => {
|
|
110
|
-
let
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
111
|
+
let data = {
|
|
112
|
+
client_id: req.body.clientId,
|
|
113
|
+
date_iso: new Date( dayjs().format( 'YYYY-MM-DD' ) ),
|
|
114
|
+
date_string: dayjs().format( 'YYYY-MM-DD' ),
|
|
115
|
+
sourceCheckList_id: task._id,
|
|
116
|
+
checkListName: task.checkListName,
|
|
117
|
+
checkListId: task._id,
|
|
118
|
+
scheduleStartTime: '12:00 AM',
|
|
119
|
+
scheduleEndTime: '11:59 PM',
|
|
120
|
+
scheduleStartTime_iso: dayjs.utc( '12:00 AM', 'hh:mm A' ).format(),
|
|
121
|
+
scheduleEndTime_iso: dayjs( endDate ).utc( '11:59 PM', 'hh:mm A' ).format(),
|
|
122
|
+
allowedOverTime: false,
|
|
123
|
+
allowedStoreLocation: false,
|
|
124
|
+
createdBy: task.createdBy,
|
|
125
|
+
createdByName: task.createdByName,
|
|
126
|
+
questionAnswers: [],
|
|
127
|
+
isdeleted: false,
|
|
128
|
+
questionCount: 0,
|
|
129
|
+
storeCount: 0,
|
|
130
|
+
locationCount: 0,
|
|
131
|
+
checkListType: 'task',
|
|
132
|
+
country: '',
|
|
133
|
+
store_id: '',
|
|
134
|
+
storeName: '',
|
|
135
|
+
userId: '',
|
|
136
|
+
userName: '',
|
|
137
|
+
userEmail: '',
|
|
138
|
+
checklistStatus: 'open',
|
|
139
|
+
timeFlagStatus: true,
|
|
140
|
+
timeFlag: 0,
|
|
141
|
+
questionFlag: 0,
|
|
142
|
+
mobileDetectionFlag: 0,
|
|
143
|
+
storeOpenCloseFlag: 0,
|
|
144
|
+
reinitiateStatus: false,
|
|
145
|
+
markasread: false,
|
|
146
|
+
uniformDetectionFlag: 0,
|
|
147
|
+
scheduleRepeatedType: 'daily',
|
|
148
|
+
approvalStatus: false,
|
|
149
|
+
approvalEnable: false,
|
|
150
|
+
redoStatus: false,
|
|
151
|
+
isPlano: true,
|
|
152
|
+
type: task.checkListName == 'Product Verification' ? 'product' : task.checkListName == 'Fixture Verification' ? 'fixture' : 'vm',
|
|
153
|
+
};
|
|
154
|
+
let query = [
|
|
155
|
+
{
|
|
156
|
+
$addFields: {
|
|
157
|
+
store: { $toLower: '$storeName' },
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
$match: {
|
|
162
|
+
clientId: req.body.clientId,
|
|
163
|
+
store: { $in: storeList },
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
];
|
|
167
|
+
|
|
168
|
+
let storeDetails = await storeService.aggregate( query );
|
|
169
|
+
if ( req.body.userEmail ) {
|
|
154
170
|
let query = [
|
|
155
171
|
{
|
|
156
172
|
$addFields: {
|
|
157
|
-
|
|
173
|
+
emailLower: { $toLower: '$email' },
|
|
158
174
|
},
|
|
159
175
|
},
|
|
160
176
|
{
|
|
161
177
|
$match: {
|
|
162
178
|
clientId: req.body.clientId,
|
|
163
|
-
|
|
179
|
+
emailLower: req.body.userEmail,
|
|
164
180
|
},
|
|
165
181
|
},
|
|
166
182
|
];
|
|
183
|
+
userDetails = await userService.aggregate( query );
|
|
184
|
+
if ( !userDetails.length ) {
|
|
185
|
+
let userData = {
|
|
186
|
+
clientId: req.body.clientId,
|
|
187
|
+
mobileNumber: '',
|
|
188
|
+
email: req.body.userEmail,
|
|
189
|
+
userName: req.body.userEmail.split( '@' )[0],
|
|
190
|
+
};
|
|
191
|
+
userDetails = await createUser( userData );
|
|
192
|
+
} else {
|
|
193
|
+
userDetails = userDetails[0];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
167
196
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
$match: {
|
|
178
|
-
clientId: req.body.clientId,
|
|
179
|
-
emailLower: req.body.userEmail,
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
];
|
|
183
|
-
userDetails = await userService.aggregate( query );
|
|
184
|
-
if ( !userDetails.length ) {
|
|
197
|
+
await Promise.all( storeDetails.map( async ( store ) => {
|
|
198
|
+
let planoDetails = await planoService.findOne( { storeId: store.storeId } );
|
|
199
|
+
console.log( planoDetails, store.storeId, 'details' );
|
|
200
|
+
if ( !req.body.userEmail ) {
|
|
201
|
+
userDetails = await userService.findOne( { email: store?.spocDetails?.[0]?.email } );
|
|
202
|
+
if ( !userDetails ) {
|
|
185
203
|
let userData = {
|
|
186
204
|
clientId: req.body.clientId,
|
|
187
|
-
mobileNumber:
|
|
188
|
-
email:
|
|
189
|
-
userName:
|
|
205
|
+
mobileNumber: store?.spocDetails?.[0]?.contact,
|
|
206
|
+
email: store?.spocDetails?.[0]?.email,
|
|
207
|
+
userName: store?.spocDetails?.[0]?.name,
|
|
190
208
|
};
|
|
191
209
|
userDetails = await createUser( userData );
|
|
192
|
-
} else {
|
|
193
|
-
userDetails = userDetails[0];
|
|
194
210
|
}
|
|
195
211
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
let taskData = { ...data };
|
|
210
|
-
taskData.store_id = store.storeId;
|
|
211
|
-
taskData.storeName = store.storeName;
|
|
212
|
-
taskData.userId = userDetails._id;
|
|
213
|
-
taskData.userName = userDetails.userName;
|
|
214
|
-
taskData.userEmail = userDetails.email;
|
|
215
|
-
taskData.planoId = planoDetails?.planoId;
|
|
216
|
-
await processedService.create( taskData );
|
|
217
|
-
} ) );
|
|
212
|
+
let taskData = { ...data };
|
|
213
|
+
taskData.store_id = store.storeId;
|
|
214
|
+
taskData.storeName = store.storeName;
|
|
215
|
+
taskData.userId = userDetails._id;
|
|
216
|
+
taskData.userName = userDetails.userName;
|
|
217
|
+
taskData.userEmail = userDetails.email;
|
|
218
|
+
taskData.planoId = planoDetails?._id;
|
|
219
|
+
for ( let i=0; i<req.body.days; i++ ) {
|
|
220
|
+
let currDate = dayjs().add( i, 'day' );
|
|
221
|
+
let insertData = { ...taskData, date_string: currDate.format( 'YYYY-MM-DD' ), date_iso: new Date( currDate.format( 'YYYY-MM-DD' ) ), scheduleStartTime_iso: dayjs.utc( `${currDate.format( 'YYYY-MM-DD' )} 12:00 AM`, 'YYYY-MM-DD hh:mm A' ).format() };
|
|
222
|
+
let response = await processedService.updateOne( { date_string: currDate.format( 'YYYY-MM-DD' ), store_id: insertData.store_id, userEmail: insertData.userEmail, planoId: insertData.planoId, sourceCheckList_id: task._id }, insertData );
|
|
223
|
+
console.log( insertData.store_id, response );
|
|
218
224
|
}
|
|
219
|
-
}
|
|
225
|
+
} ) );
|
|
220
226
|
} ) );
|
|
221
227
|
|
|
222
228
|
return res.sendSuccess( 'Task created successfully' );
|
|
@@ -289,6 +295,9 @@ export async function updateStatus( req, res ) {
|
|
|
289
295
|
return res.sendError( 'No data found', 204 );
|
|
290
296
|
}
|
|
291
297
|
await processedService.updateOne( { _id: req.body.taskId }, { checklistStatus: req.body.status } );
|
|
298
|
+
if ( req.body.status == 'submit' ) {
|
|
299
|
+
await processedService.deleteMany( { _id: req.body.taskId, date_iso: { $gt: new Date( dayjs().format( 'YYYY-MM-DD' ) ) } } );
|
|
300
|
+
}
|
|
292
301
|
return res.sendSuccess( 'Task status updated successfully' );
|
|
293
302
|
} catch ( e ) {
|
|
294
303
|
logger.error( { functionName: 'storeLayout', error: e } );
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
|
|
3
|
+
export const scriptRouter = express.Router();
|
|
4
|
+
import * as scriptController from '../controllers/script.controller.js';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
scriptRouter
|
|
8
|
+
.post( '/getUniqueStoresFromExcel', scriptController.getStoreNames )
|
|
9
|
+
.post( '/bilkInsertFixtureConfig', scriptController.createFixtureConfig )
|
|
10
|
+
.post( '/bulkInsertPlanoData', scriptController.createPlano )
|
|
11
|
+
.post( '/bulkIinsertFloorData', scriptController.createFloors )
|
|
12
|
+
.post( '/bulkIinsertVmTemplateData', scriptController.createVmData )
|
|
13
|
+
.post( '/bulkIinsertFixturesShelvesVmsData', scriptController.createFixturesShelves );
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
|
-
import {
|
|
2
|
+
import { validate } from 'tango-app-api-middleware';
|
|
3
3
|
import * as storeBuilderController from '../controllers/storeBuilder.controller.js';
|
|
4
|
+
// import * as scriptController from '../controllers/script.controller.js';
|
|
4
5
|
import * as validateDtos from '../dtos/validation.dtos.js';
|
|
5
6
|
|
|
7
|
+
|
|
6
8
|
export const storeBuilderRouter = express.Router();
|
|
7
9
|
|
|
8
10
|
storeBuilderRouter
|
|
9
|
-
.post( '/createStoreLayout',
|
|
10
|
-
.post( '/updateStoreLayout',
|
|
11
|
-
.post( '/storeLayoutList',
|
|
12
|
-
.post( '/updateFloor',
|
|
13
|
-
.post( '/uploadBulkStore',
|
|
14
|
-
.post( '/uploadFile',
|
|
11
|
+
.post( '/createStoreLayout', validate( validateDtos.createBuilder ), storeBuilderController.createStoreBuilder )
|
|
12
|
+
.post( '/updateStoreLayout', validate( validateDtos.updateStoreLayout ), storeBuilderController.updateStoreLayout )
|
|
13
|
+
.post( '/storeLayoutList', validate( validateDtos.storeLayoutList ), storeBuilderController.getLayoutList )
|
|
14
|
+
.post( '/updateFloor', validate( validateDtos.updateFloor ), storeBuilderController.updateFloor )
|
|
15
|
+
.post( '/uploadBulkStore', storeBuilderController.uploadBulkStore )
|
|
16
|
+
.post( '/uploadFile', storeBuilderController.uploadFile )
|
|
15
17
|
// .post( '/storeLayout', validate( validateDtos.storeList ), storeBuilderController.storeFixtures )
|
|
16
|
-
.post( '/storeDetails',
|
|
17
|
-
.delete( '/deleteStoreLayout/:id',
|
|
18
|
-
.post( '/removeFile',
|
|
19
|
-
.post( '/deleteFloor',
|
|
20
|
-
.post( '/updateStatus',
|
|
18
|
+
.post( '/storeDetails', validate( validateDtos.storeDetails ), storeBuilderController.getStoreDetails )
|
|
19
|
+
.delete( '/deleteStoreLayout/:id', validate( validateDtos.deleteStoreLayout ), storeBuilderController.deleteStoreLayout )
|
|
20
|
+
.post( '/removeFile', storeBuilderController.deleteFile )
|
|
21
|
+
.post( '/deleteFloor', storeBuilderController.deleteFloor )
|
|
22
|
+
.post( '/updateStatus', validate( validateDtos.updateStatus ), storeBuilderController.updateStatus )
|
|
21
23
|
// .post( '/FixtureShelfDetails', storeBuilderController.fixtureShelfProduct )
|
|
22
24
|
// .post( '/scan', storeBuilderController.scan )
|
|
23
25
|
.post( '/storeLayout', validate( validateDtos.storeList ), storeBuilderController.storeLayout )
|
|
@@ -31,5 +33,6 @@ storeBuilderRouter
|
|
|
31
33
|
.post( '/qrFileUpload', storeBuilderController.qrFileUpload )
|
|
32
34
|
.post( '/updateQrCvProcessRequest', storeBuilderController.updateQrCvProcessRequest )
|
|
33
35
|
.post( '/getQrCvProcessRequest', storeBuilderController.getQrCvProcessRequest )
|
|
34
|
-
.post( '/fixtureQrUpdate', storeBuilderController.fixtureQrUpdate )
|
|
35
|
-
|
|
36
|
+
.post( '/fixtureQrUpdate', storeBuilderController.fixtureQrUpdate )
|
|
37
|
+
.post( '/updateDeatailedDistance', storeBuilderController.updateDetailedDistance )
|
|
38
|
+
.post( '/upsertFixture', storeBuilderController.upsertFixtures );
|
|
@@ -24,3 +24,7 @@ export async function aggregate( query ) {
|
|
|
24
24
|
export async function updateOne( query, record ) {
|
|
25
25
|
return model.planoProductModel.updateOne( query, { $set: record } );
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
export async function create( data ) {
|
|
29
|
+
return model.planoProductModel.create( data );
|
|
30
|
+
}
|
|
@@ -9,7 +9,7 @@ export async function findOne( query = {}, field = {} ) {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export async function updateOne( query = {}, record = {} ) {
|
|
12
|
-
return model.taskProcessedModel.updateOne( query, { $set: record } );
|
|
12
|
+
return model.taskProcessedModel.updateOne( query, { $set: record }, { upsert: true } );
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export async function find( query = {}, field = {} ) {
|
|
@@ -8,6 +8,10 @@ export async function findOne( query={}, field={} ) {
|
|
|
8
8
|
return model.storeLayoutModel.findOne( query, field ).sort( { floorNumber: -1 } );
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export async function findOneAndUpdate( query={}, field={} ) {
|
|
12
|
+
return model.storeLayoutModel.findOneAndUpdate( query, field ).sort( { floorNumber: -1 } );
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
export async function insertMany( data ) {
|
|
12
16
|
return model.storeLayoutModel.insertMany( data );
|
|
13
17
|
}
|
|
@@ -31,3 +35,7 @@ export async function updateOne( query, record ) {
|
|
|
31
35
|
export async function updateMany( query, record ) {
|
|
32
36
|
return model.storeLayoutModel.updateMany( query, { $set: record } );
|
|
33
37
|
}
|
|
38
|
+
|
|
39
|
+
export async function create( data ) {
|
|
40
|
+
return model.storeLayoutModel.create( data );
|
|
41
|
+
}
|
|
@@ -19,3 +19,11 @@ export async function aggregate( query ) {
|
|
|
19
19
|
export async function updateOne( query, record ) {
|
|
20
20
|
return model.storeFixtureModel.updateOne( query, { $set: record } );
|
|
21
21
|
}
|
|
22
|
+
|
|
23
|
+
export async function findOneAndUpdate( query={}, field={} ) {
|
|
24
|
+
return model.storeFixtureModel.findOneAndUpdate( query, field );
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function create( data ) {
|
|
28
|
+
return model.storeFixtureModel.create( data );
|
|
29
|
+
}
|