tango-app-api-infra 3.8.5 → 3.8.7
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
|
@@ -439,7 +439,7 @@ export async function getTickets( req, res ) {
|
|
|
439
439
|
const skip = inputData.offset == 0 ? 0 : ( inputData.offset - 1 ) * limit || 0;
|
|
440
440
|
inputData.storeId = inputData.storeId.split( ',' ); // convert strig to array
|
|
441
441
|
logger.info( { inputData: inputData, limit: limit, skip: skip } );
|
|
442
|
-
let source = [ 'storeId', 'dateString', 'ticketName', 'footfallCount', 'employeeCount', 'houseKeepingCount', 'duplicateCount', 'junkCount', 'junkACCount', 'comments', 'employee', 'houseKeeping', 'junk', 'duplicateImages', 'ticketId', 'clientId', 'storeName', 'createdAt', 'updatedAt', 'userName', 'email', 'role', 'status', 'employeeStatus', 'houseKeepingStatus', 'duplicateStatus','junkStatus', 'houseKeepingACCount', 'houseKeepingCount', 'employeeCount', 'employeeACCount', 'duplicateCount', 'duplicateACCount', 'approverRole', 'approverUserName', 'approverEmail' ];
|
|
442
|
+
let source = [ 'storeId', 'dateString', 'ticketName', 'footfallCount', 'employeeCount', 'houseKeepingCount', 'duplicateCount', 'junkCount', 'junkACCount', 'comments', 'employee', 'houseKeeping', 'junk', 'duplicateImages', 'ticketId', 'clientId', 'storeName', 'createdAt', 'updatedAt', 'userName', 'email', 'role', 'status', 'employeeStatus', 'houseKeepingStatus', 'duplicateStatus', 'junkStatus', 'houseKeepingACCount', 'houseKeepingCount', 'employeeCount', 'employeeACCount', 'duplicateCount', 'duplicateACCount', 'approverRole', 'approverUserName', 'approverEmail' ];
|
|
443
443
|
let filter = [
|
|
444
444
|
|
|
445
445
|
{
|
|
@@ -741,8 +741,9 @@ export async function updateTicketStatus( data, openSearch, temp, user ) {
|
|
|
741
741
|
duplicateStatus,
|
|
742
742
|
employeeStatus,
|
|
743
743
|
houseKeepingStatus,
|
|
744
|
+
junkStatus,
|
|
744
745
|
} = data;
|
|
745
|
-
const statusList = [ duplicateStatus, employeeStatus, houseKeepingStatus ];
|
|
746
|
+
const statusList = [ duplicateStatus, employeeStatus, houseKeepingStatus, junkStatus ];
|
|
746
747
|
// Filter out undefined/null statuses
|
|
747
748
|
const existingStatuses = statusList.filter( ( status ) => status != null );
|
|
748
749
|
|
|
@@ -762,7 +763,6 @@ export async function updateTicketStatus( data, openSearch, temp, user ) {
|
|
|
762
763
|
let bulkBody = [];
|
|
763
764
|
if ( data?.duplicateImages?.length > 0 ) {
|
|
764
765
|
updateData.duplicateImages = await mergeDuplicateImagesWithUncheck( getExistingOne?.body?._source?.duplicateImages, data?.duplicateImages, data?.duplicateStatus );
|
|
765
|
-
logger.info( { updateData: updateData, existeg: getExistingOne?.body?._source?.duplicateImages, sttaus: data?.duplicateStatus } );
|
|
766
766
|
await updateOpenSearchData( openSearch.footfallDirectory, _id, { doc: updateData } );
|
|
767
767
|
for ( let duplicate of updateData?.duplicateImages ) {
|
|
768
768
|
bulkBody.push(
|
|
@@ -816,6 +816,27 @@ export async function updateTicketStatus( data, openSearch, temp, user ) {
|
|
|
816
816
|
}
|
|
817
817
|
await updateOpenSearchData( openSearch.footfallDirectory, _id, { doc: { houseKeepingACCount: tempId?.length || 0 } } );
|
|
818
818
|
}
|
|
819
|
+
|
|
820
|
+
if ( data?.junk?.length > 0 ) {
|
|
821
|
+
const updateJunk = updateEmployeeCheckFlags(
|
|
822
|
+
source?.junk,
|
|
823
|
+
updateData?.junk,
|
|
824
|
+
data.junkStatus,
|
|
825
|
+
);
|
|
826
|
+
updateData.junk = updateJunk;
|
|
827
|
+
|
|
828
|
+
await updateOpenSearchData( openSearch.footfallDirectory, _id, { doc: updateData } );
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
for ( let junk of updateData?.junk ) {
|
|
832
|
+
junk.isChecked == true ? tempId.push( { tempId: junk.tempId, timeRange: junk.timeRange } ) : null;
|
|
833
|
+
bulkBody.push(
|
|
834
|
+
{ update: { _index: openSearch.revop, _id: `${storeId}_${dateString}_${junk.timeRange}_${junk.tempId}` } },
|
|
835
|
+
{ doc: { isChecked: junk.isChecked, status: junk?.isChecked == true? 'approved':'rejected' } },
|
|
836
|
+
);
|
|
837
|
+
}
|
|
838
|
+
await updateOpenSearchData( openSearch.footfallDirectory, _id, { doc: { junkACCount: tempId?.length || 0 } } );
|
|
839
|
+
}
|
|
819
840
|
temp.push( storeId );
|
|
820
841
|
if ( bulkBody.length > 0 ) {
|
|
821
842
|
const res = await bulkUpdate( bulkBody );
|
|
@@ -835,7 +856,6 @@ export async function updateTicketStatus( data, openSearch, temp, user ) {
|
|
|
835
856
|
const getStoreType = await countDocumnetsCamera( query );
|
|
836
857
|
let getUpdateExistingOne = await getOpenSearchById( openSearch.footfallDirectory, _id );
|
|
837
858
|
const tempIdList = await extractCheckedTempIds( getUpdateExistingOne?.body );
|
|
838
|
-
logger.info( { tempIdList: tempIdList } );
|
|
839
859
|
const isSendMessge = await sendSqsMessage( data, tempIdList, getStoreType, storeId );
|
|
840
860
|
if ( isSendMessge ==true ) {
|
|
841
861
|
return true; // res.sendSuccess( 'Ticket has been updated successfully' );
|
|
@@ -287,6 +287,7 @@ export const updateStatusSchemea =Joi.object().keys( {
|
|
|
287
287
|
duplicateACCount: Joi.number().optional(),
|
|
288
288
|
employeeACCount: Joi.number().optional(),
|
|
289
289
|
houseKeepingACCount: Joi.number().optional(),
|
|
290
|
+
junkACCount: Joi.number().optional(),
|
|
290
291
|
comments: Joi.string().optional().allow( '' ),
|
|
291
292
|
duplicateImages: Joi.array().items(
|
|
292
293
|
Joi.object( {
|
|
@@ -329,6 +330,17 @@ export const updateStatusSchemea =Joi.object().keys( {
|
|
|
329
330
|
selected: Joi.boolean().optional(),
|
|
330
331
|
|
|
331
332
|
} ) ).optional(),
|
|
333
|
+
junk: Joi.array().items( Joi.object( {
|
|
334
|
+
tempId: Joi.number().required(),
|
|
335
|
+
filePath: Joi.string().required(),
|
|
336
|
+
entryTime: Joi.string().required(),
|
|
337
|
+
exitTime: Joi.string().required(),
|
|
338
|
+
timeRange: Joi.string().required(),
|
|
339
|
+
isChecked: Joi.boolean().required(),
|
|
340
|
+
selected: Joi.boolean().optional(),
|
|
341
|
+
|
|
342
|
+
} ) ).optional(),
|
|
343
|
+
junkStatus: Joi.string().optional(),
|
|
332
344
|
duplicateStatus: Joi.string().optional(),
|
|
333
345
|
employeeStatus: Joi.string().optional(),
|
|
334
346
|
houseKeepingStatus: Joi.string().optional(),
|