tango-app-api-audit 3.4.20 → 3.4.22

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-audit",
3
- "version": "3.4.20",
3
+ "version": "3.4.22",
4
4
  "description": "audit & audit metrics apis",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -874,18 +874,10 @@ export async function workSpace( req, res ) {
874
874
  },
875
875
  },
876
876
  },
877
- // {
878
- // $group: {
879
- // _id: { clientId: '$clientId', storeId: '$storeId' },
880
- // clientId: { $first: '$clientId' },
881
- // completedStoresCount: { $sum: '$completed' },
882
- // },
883
- // },
884
877
  {
885
878
  $group: {
886
879
  _id: '$clientId',
887
880
  clientId: { $first: '$clientId' },
888
- // completedStoresCount: { $first: '$completedStoresCount' },
889
881
  completedStoresCount: { $sum: '$completed' },
890
882
  },
891
883
  },
@@ -979,6 +971,31 @@ export async function workSpace( req, res ) {
979
971
  },
980
972
  ];
981
973
 
974
+ // const userDrafted = [
975
+ // {
976
+ // $match: {
977
+ // $and: [
978
+ // { clientId: { $in: clientList } },
979
+ // { userId: { $eq: req.user._id } },
980
+ // { auditStatus: { $eq: true } },
981
+ // { moduleType: { $eq: inputData.moduleType } },
982
+ // { createdAt: { $gte: new Date( dayjs( fileDate ).format( 'YYYY-MM-DD' ) ) } },
983
+ // { createdAt: { $lte: dateRange.end } },
984
+ // ],
985
+ // },
986
+ // },
987
+ // {
988
+ // $limit: 1,
989
+ // },
990
+ // {
991
+ // $project: {
992
+ // clienId: 1,
993
+ // auditStatus: 1,
994
+ // },
995
+ // },
996
+
997
+ // ];
998
+
982
999
  const userAsignAudit = [
983
1000
  {
984
1001
  $match: {
@@ -1035,6 +1052,9 @@ export async function workSpace( req, res ) {
1035
1052
  const userIncompleteFilesCount = await aggregateUserAudit(
1036
1053
  userIncompleteFiles,
1037
1054
  );
1055
+ // const userDraftedCount = await aggregateUserAudit(
1056
+ // userDrafted,
1057
+ // );
1038
1058
  const userAsignAuditCount = await aggregateAssignAudit( userAsignAudit );
1039
1059
  const completedStoresCount = await aggregateStoreAudit( completedStores );
1040
1060
  const clientAssignedCount = await aggregateAssignAudit( clientAssign );
@@ -1082,6 +1102,7 @@ export async function workSpace( req, res ) {
1082
1102
  queueName: merge[i].queueName,
1083
1103
  isDraft: merge[i]?.isDrafted || false,
1084
1104
  isEnable:
1105
+ // userDraftedCount.length > 0 && !merge[i].isDrafted? 0:
1085
1106
  Number( pending ) > 0 ||
1086
1107
  merge[i].isDrafted ||
1087
1108
  ( merge[i].userAsignedCount && merge[i].userAsignedCount > 0 ) ||
@@ -4784,6 +4805,42 @@ export async function auditViewLogs( req, res ) {
4784
4805
  },
4785
4806
  };
4786
4807
  break;
4808
+ case 'hygiene':
4809
+ logsQuery = {
4810
+ 'size': 100,
4811
+ 'query': {
4812
+ 'bool': {
4813
+ 'must': [
4814
+ {
4815
+ 'term': {
4816
+ 'logData.fileDate.keyword': inputData.fileDate,
4817
+ },
4818
+ },
4819
+ {
4820
+ 'term': {
4821
+ 'logData.storeId.keyword': inputData.storeId,
4822
+ },
4823
+ },
4824
+ {
4825
+ 'term': {
4826
+ 'logData.moduleType.keyword': inputData.moduleType,
4827
+ },
4828
+ },
4829
+ {
4830
+ 'term': {
4831
+ 'logData.zoneName.keyword': inputData.zoneName,
4832
+ },
4833
+ },
4834
+ {
4835
+ 'terms': {
4836
+ 'logSubType.keyword': [ 'auditDone', 'reTrigger' ],
4837
+ },
4838
+ },
4839
+ ],
4840
+ },
4841
+ },
4842
+ };
4843
+ break;
4787
4844
  case 'camera-angle-change':
4788
4845
  logsQuery = {
4789
4846
  'size': 100,