tango-app-api-client 3.6.5-vms.16 → 3.6.5-vms.17

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-client",
3
- "version": "3.6.5-vms.16",
3
+ "version": "3.6.5-vms.17",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -3129,11 +3129,11 @@ export async function createStoreRequest( req, res ) {
3129
3129
  const upsertRecord = await updateOneUpsertVmsStoreRequest( { storeId: inputData?.storeId, dateString: inputData?.dateString }, record );
3130
3130
  logger.info( { upsertRecord } );
3131
3131
  if ( upsertRecord?.upsertedCount === 1 ) {
3132
- return res.sendSuccess( 'The Request has been sent Successfully' );
3132
+ return res.sendTemp( 'The Request has been sent Successfully' );
3133
3133
  } else if ( upsertRecord?.matchedCount === 1 && upsertRecord?.modifiedCount === 1 ) {
3134
- return res.sendSuccess( 'The Request has been updated Successfully' );
3134
+ return res.sendTemp( 'The Request has been updated Successfully' );
3135
3135
  } else if ( upsertRecord?.matchedCount === 1 && upsertRecord?.modifiedCount === 0 ) {
3136
- return res.sendSuccess( 'The Request already exists and nothing to update' );
3136
+ return res.sendTemp( 'The Request already exists and nothing to update' );
3137
3137
  } else {
3138
3138
  return res.sendError( 'Internal Server Error', 500 );
3139
3139
  }
@@ -112,13 +112,10 @@ export async function getAuditFile( req, res ) {
112
112
  address: '$storeProfile.address',
113
113
  };
114
114
  const storeDetails = await findOneStore( storeQuery, storeFields );
115
- let docId = `${inputData.storeId}_${inputData.Date}_footfall-directory-tagging`;
116
- if ( inputData.tickettype === 'internal' ) {
117
- docId = `${inputData.storeId}_${inputData.Date}_internal_footfall-directory-tagging`;
118
- }
115
+ let docId = `${inputData.storeId}_${inputData.Date}_internal_footfall-directory-tagging`;
119
116
  console.log( '🚀 ~ getAuditFile ~ docId:draft', docId );
120
- const existinginternalDoc = await getOpenSearchById( openSearch.footfallDirectory, docId );
121
- let ticketSource = existinginternalDoc?.body?._source;
117
+ const existingDoc = await getOpenSearchById( openSearch.footfallDirectory, docId );
118
+ const ticketSource = existingDoc?.body?._source;
122
119
  const currentTime = new Date();
123
120
  const updatePayload = {
124
121
  doc: {
@@ -132,24 +129,7 @@ export async function getAuditFile( req, res ) {
132
129
  };
133
130
  console.log( '🚀 ~ getAuditFile ~ updatePayload:', updatePayload );
134
131
  console.log( '🚀 ~ getAuditFile ~ ticketSource:', ticketSource );
135
- if ( ticketSource && inputData.tickettype === 'store' ) {
136
- ticketSource.mappingInfo.map( ( data ) => {
137
- if ( data.type === 'tangoreview' ) {
138
- data.status = 'In-Progress';
139
- }
140
- } );
141
- ticketSource.createdByRole = req?.user?.role || '';
142
- ticketSource.createdByEmail = req?.user?.email || '';
143
- ticketSource.createdByUserName = req?.user?.userName || '';
144
- ticketSource.createdByUserId = req?.user?._id || '';
145
- console.log( '🚀 ~ getAuditFile ~ ticketSource:', ticketSource );
146
- await updateOpenSearchData(
147
- openSearch.footfallDirectory,
148
- docId,
149
- { doc: ticketSource },
150
-
151
- );
152
- } else if ( ticketSource && inputData.tickettype === 'internal' ) {
132
+ if ( ticketSource ) {
153
133
  await updateOpenSearchData(
154
134
  openSearch.footfallDirectory,
155
135
  docId,
@@ -204,13 +184,10 @@ export async function getAuditFile( req, res ) {
204
184
  console.log( openSearch.vmsAudit );
205
185
  let list = inputData.nextId ? await scrollResponse( inputData.nextId ) : await searchOpenSearchData( openSearch.vmsAudit, query );
206
186
 
207
- let docId = `${inputData.storeId}_${inputData.Date}_footfall-directory-tagging`;
208
- if ( inputData.tickettype === 'internal' ) {
209
- docId = `${inputData.storeId}_${inputData.Date}_internal_footfall-directory-tagging`;
210
- }
211
- console.log( '🚀 ~ getAuditFile ~ docId:draft', docId );
212
- const existinginternalDoc = await getOpenSearchById( openSearch.footfallDirectory, docId );
213
- let ticketSource = existinginternalDoc?.body?._source;
187
+ let docId = `${inputData.storeId}_${inputData.Date}_internal_footfall-directory-tagging`;
188
+ console.log( '🚀 ~ getAuditFile ~ docId:1', docId );
189
+ const existingDoc = await getOpenSearchById( openSearch.footfallDirectory, docId );
190
+ const ticketSource = existingDoc?.body?._source;
214
191
  const currentTime = new Date();
215
192
  const updatePayload = {
216
193
  doc: {
@@ -224,24 +201,7 @@ export async function getAuditFile( req, res ) {
224
201
  };
225
202
  console.log( '🚀 ~ getAuditFile ~ updatePayload:', updatePayload );
226
203
  console.log( '🚀 ~ getAuditFile ~ ticketSource:', ticketSource );
227
- if ( ticketSource && inputData.tickettype != 'internal' ) {
228
- ticketSource.mappingInfo.map( ( data ) => {
229
- if ( data.type === 'tangoreview' ) {
230
- data.status = 'In-Progress';
231
- console.log( '🚀 ~ getAuditFile ~ data.status:', data.status );
232
- }
233
- } );
234
- ticketSource.createdByRole = req?.user?.role || '';
235
- ticketSource.createdByEmail = req?.user?.email || '';
236
- ticketSource.createdByUserName = req?.user?.userName || '';
237
- ticketSource.createdByUserId = req?.user?._id || '';
238
- console.log( '🚀 ~ getAuditFile ~ ticketSource:', ticketSource );
239
- await updateOpenSearchData(
240
- openSearch.footfallDirectory,
241
- docId,
242
- { doc: ticketSource },
243
- );
244
- } else if ( ticketSource && inputData.tickettype === 'internal' ) {
204
+ if ( ticketSource ) {
245
205
  await updateOpenSearchData(
246
206
  openSearch.footfallDirectory,
247
207
  docId,
@@ -439,9 +399,6 @@ export async function reAssignAudit( req, res ) {
439
399
  const openSearch = JSON.parse( process.env.OPENSEARCH );
440
400
  let inputData = req.body;
441
401
  let docId = `${inputData.storeId}_${inputData.dateString}_internal_footfall-directory-tagging`;
442
- if ( inputData.tickettype ==='store' ) {
443
- docId = `${inputData.storeId}_${inputData.dateString}_footfall-directory-tagging`;
444
- }
445
402
  console.log( '🚀 ~ getAuditFile ~ docId:draft', docId );
446
403
  const existingDoc = await getOpenSearchById( openSearch.footfallDirectory, docId );
447
404
  const ticketSource = existingDoc?.body?._source;
@@ -467,9 +424,8 @@ export async function reAssignAudit( req, res ) {
467
424
  );
468
425
  }
469
426
 
470
- console.log( '🚀 ~ reAssignAudit ~ inputData.dateString:', inputData.dateString );
471
427
  await updatemanyvmsUserAudit(
472
- { auditStatus: { $ne: 'completed' }, storeId: inputData.storeId, fileDate: inputData.dateString },
428
+ { auditStatus: { $ne: 'completed', storeId: inputData.storeId, fileDate: inputData.dateString } },
473
429
  { status: 'skipped' } );
474
430
 
475
431
 
@@ -12,7 +12,6 @@ export const getFileSchema = joi.object( {
12
12
  storeId: joi.string().required(),
13
13
  Date: joi.string().required(),
14
14
  count: joi.string().required(),
15
- tickettype: joi.string().required(),
16
15
  } );
17
16
 
18
17