tango-app-api-client 3.0.42-dev → 3.0.44-dev

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.0.42-dev",
3
+ "version": "3.0.44-dev",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "nodemon": "^3.0.3",
27
27
  "swagger-ui-express": "^5.0.0",
28
28
  "tango-app-api-middleware": "^1.0.72-test",
29
- "tango-api-schema": "^2.0.93",
29
+ "tango-api-schema": "^2.0.103",
30
30
  "winston": "^3.11.0",
31
31
  "winston-daily-rotate-file": "^5.0.0"
32
32
  },
@@ -180,6 +180,41 @@ export async function create( req, res ) {
180
180
 
181
181
  await postApi( `${appConfig.url.oldapidomain}/oldDefaultRoleInsert`, oldDefaultRolesInsertData );
182
182
 
183
+ const logObj = {
184
+ clientId: insertedClientRecord.clientId,
185
+ userName: req.user?.userName,
186
+ email: req.user?.email,
187
+ date: new Date(),
188
+ logType: 'brandDetails',
189
+ logSubType: 'brandApproval',
190
+ changes: [ insertedClientRecord.clientName ],
191
+ eventType: 'approve',
192
+ };
193
+
194
+ await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
195
+
196
+ for ( let index = 0; index < leadRecord?.planDetails?.product?.length; index++ ) {
197
+ const logObj = {
198
+ userName: req.user?.userName,
199
+ email: req.user?.email,
200
+ clientId: insertedClientRecord.clientId,
201
+ clientNotification: false,
202
+ adminNotification: true,
203
+ logSubType: 'startTrial',
204
+ description: 'Subscription - Your 14 Days free trial has been started',
205
+ title: 'Subscription',
206
+ alertCta: [],
207
+ markasRead: false,
208
+ logType: 'subscription',
209
+ showPushNotification: true,
210
+ date: new Date(),
211
+ changes: [ `${convertTitleCase( leadRecord?.planDetails?.product[index] )} trial started` ],
212
+ eventType: '',
213
+ };
214
+
215
+ await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
216
+ }
217
+
183
218
 
184
219
  if ( insertClient ) {
185
220
  const userRecord = {
@@ -200,6 +235,13 @@ export async function create( req, res ) {
200
235
  }
201
236
  }
202
237
 
238
+ function convertTitleCase( data ) {
239
+ let [ firstWord, secondWord ] = data.replace( /([a-z])([A-Z])/g, '$1 $2' ).split( ' ' );
240
+ firstWord = firstWord.charAt( 0 ).toUpperCase() + firstWord.slice( 1 );
241
+ data = firstWord + ' ' + secondWord;
242
+ return data;
243
+ }
244
+
203
245
  export const sendEmail = ( data ) => {
204
246
  try {
205
247
  const attachments = null;
@@ -977,9 +1019,7 @@ export async function auditConfiguration( req, res ) {
977
1019
  logObj.changes = [ `Audit config bulk` ];
978
1020
  }
979
1021
 
980
- if ( updateKeys.length ) {
981
- await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
982
- }
1022
+ await insertOpenSearchData( appConfig.opensearch.activityLog, logObj );
983
1023
 
984
1024
  res.sendSuccess( { result: 'Updated Successfully' } );
985
1025
  } catch ( error ) {