tango-app-api-report 3.3.7-beta.0 → 3.4.0-beta.0

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-report",
3
- "version": "3.3.7-beta.0",
3
+ "version": "3.4.0-beta.0",
4
4
  "description": "report",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -85,11 +85,21 @@ export async function updateReport( req, res ) {
85
85
  _id: req.params?.id,
86
86
  } );
87
87
 
88
- const user = await getUserNameEmailById( req.userId );
89
-
88
+ const user = req.user;
89
+ const oldData={
90
+ ReportName: previousReport?.fileName,
91
+ FileType: previousReport?.fileType,
92
+ ReceiversEmail: previousReport?.email.join( ', ' ),
93
+ };
94
+ const newData={
95
+ ReportName: postReport?.fileName,
96
+ FileType: postReport?.fileType,
97
+ ReceiversEmail: postReport?.email.join( ', ' ),
98
+ };
90
99
  const logObj = {
91
100
  clientId: req.body?.clientId,
92
101
  userName: user?.userName,
102
+ userId: user?._id,
93
103
  email: user?.email,
94
104
  date: new Date(),
95
105
  logType: 'configuration',
@@ -99,12 +109,12 @@ export async function updateReport( req, res ) {
99
109
  showTo: [ 'tango' ],
100
110
  current: postReport,
101
111
  previous: previousReport,
102
-
112
+ oldData: oldData,
113
+ newData: newData,
103
114
  };
104
-
105
115
  await insertOpenSearchData( openSearch.activityLog, logObj );
106
116
  if ( updateAck ) {
107
- res.sendSuccess( { result: 'Updated Successfully' } );
117
+ return res.sendSuccess( { result: 'Updated Successfully' } );
108
118
  }
109
119
  } catch ( error ) {
110
120
  logger.error( { error: error, message: req.params, function: 'updateReport' } );
@@ -291,7 +301,6 @@ export async function generateReport( req, res ) {
291
301
  logType: 'report',
292
302
  logSubType: 'generateReport',
293
303
  logData: {
294
- // clientName: req.report?.clientName,
295
304
  fileDate: inputData.fileDate.split( '-' ).reverse().join( '-' ),
296
305
  reportName: req.report?.reportConfigs?.reportName,
297
306
  clientId: inputData.clientId,