tango-app-api-trax 3.7.23 → 3.7.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-trax",
3
- "version": "3.7.23",
3
+ "version": "3.7.25",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -43,6 +43,9 @@ export async function storeList( req, res ) {
43
43
  );
44
44
 
45
45
  let storeIdList = userChecklist.map( ( item ) => item.store_id );
46
+ if ( req.body?.assignedStores?.length ) {
47
+ storeIdList = [ ...storeIdList, ...req.body.assignedStores ];
48
+ }
46
49
  let storeStatus = await storeService.find( { storeId: { $in: storeIdList }, status: 'active', clientId: req.user.clientId }, { storeId: 1, storeName: 1 } );
47
50
  if ( storeStatus.length ) {
48
51
  storeStatus = storeStatus.map( ( item ) => {
@@ -64,6 +67,8 @@ export async function storeListv1( req, res ) {
64
67
  }
65
68
  let userChecklist = await processedchecklist.find( { userId: req.user._id, userEmail: req.user.email, date_string: dayjs( req.query.date ).format( 'YYYY-MM-DD' ) }, { store_id: 1, storeName: 1 } );
66
69
 
70
+ console.log( req.user );
71
+
67
72
  let fromDate = new Date( req.query.date );
68
73
  let toDate = new Date( req.query.date );
69
74
  toDate.setDate( toDate.getDate() + 1 );
@@ -81,6 +86,9 @@ export async function storeListv1( req, res ) {
81
86
  );
82
87
 
83
88
  let storeIdList = allStores.map( ( item ) => item.store_id );
89
+ if ( req.body.assignedStores.length ) {
90
+ storeIdList = [ ...storeIdList, ...req.body.assignedStores ];
91
+ }
84
92
  let storeStatus = await storeService.find( { storeId: { $in: storeIdList }, status: 'active' }, { storeId: 1, storeName: 1 } );
85
93
  if ( storeStatus.length ) {
86
94
  storeStatus = storeStatus.map( ( item ) => {
@@ -172,7 +180,7 @@ export async function startChecklist( req, res ) {
172
180
  let currentDate = currentDateTime.format( 'hh:mm A' );
173
181
  let updatedscheduleEndTimeISO = dayjs( getBeforeChecklist?.[0]?.scheduleStartTime_iso ).format( 'hh:mm A' );
174
182
  if ( getBeforeChecklist[0]?.client_id == '458' && dayjs.utc( currentDate, 'hh:mm A' ).isBefore( dayjs.utc( updatedscheduleEndTimeISO, 'hh:mm A' ) ) ) {
175
- return res.sendError( `Checklist will be start ${getBeforeChecklist?.[0]?.scheduleStartTime}`, 422 );
183
+ return res.sendError( `Checklist will start at ${getBeforeChecklist?.[0]?.scheduleStartTime}`, 422 );
176
184
  }
177
185
  updateData.checklistStatus = 'inprogress';
178
186
  updateData.startMobileTime = requestData?.currentTime;
@@ -1,13 +1,13 @@
1
1
  import express from 'express';
2
2
  import * as mobileController from '../controllers/mobileTrax.controller.js';
3
- import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
3
+ import { isAllowedSessionHandler, validate, getAssinedStore } from 'tango-app-api-middleware';
4
4
  import { dashboardValidation, mobileChecklistValidation, startValidation } from '../dtos/validation.dtos.js';
5
5
 
6
6
  export const mobileRouter = express.Router();
7
7
 
8
8
  mobileRouter
9
- .get( '/storeList', isAllowedSessionHandler, mobileController.storeList )
10
- .get( '/storeListv1', isAllowedSessionHandler, mobileController.storeListv1 )
9
+ .get( '/storeList', isAllowedSessionHandler, getAssinedStore, mobileController.storeList )
10
+ .get( '/storeListv1', isAllowedSessionHandler, getAssinedStore, mobileController.storeListv1 )
11
11
  .post( '/startCheckList', isAllowedSessionHandler, validate( startValidation ), mobileController.startChecklist )
12
12
  .post( '/startTask', isAllowedSessionHandler, validate( startValidation ), mobileController.startTask )
13
13
  .post( '/submitCheckList', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobilechecklistQuestionValidator, mobileController.sopMobilechecklistMultiSectionFormatter, mobileController.submitChecklist )