tango-app-api-client 3.1.8 → 3.1.9
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
|
@@ -44,7 +44,7 @@ export async function create( req, res ) {
|
|
|
44
44
|
};
|
|
45
45
|
const user = await findOneUser( userQuery );
|
|
46
46
|
if ( !user ) {
|
|
47
|
-
return res.sendError(
|
|
47
|
+
return res.sendError( `User doesn't exist`, 500 );
|
|
48
48
|
}
|
|
49
49
|
const data = {
|
|
50
50
|
email: leadRecord?.corporateEmail,
|
|
@@ -197,7 +197,7 @@ export async function create( req, res ) {
|
|
|
197
197
|
}
|
|
198
198
|
} catch ( error ) {
|
|
199
199
|
logger.info( { error: error, message: req.body, function: 'create' } );
|
|
200
|
-
return res.sendError(
|
|
200
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -225,7 +225,7 @@ export async function changeStatus( req, res, next ) {
|
|
|
225
225
|
};
|
|
226
226
|
const result = await update( query, record );
|
|
227
227
|
if ( result.matchedCount == 0 ) {
|
|
228
|
-
res.sendError( 'Not Found', 204 );
|
|
228
|
+
res.sendError( 'Data Not Found', 204 );
|
|
229
229
|
}
|
|
230
230
|
if ( inputData.status == 'approved' ) {
|
|
231
231
|
return next();
|
|
@@ -234,7 +234,7 @@ export async function changeStatus( req, res, next ) {
|
|
|
234
234
|
}
|
|
235
235
|
} catch ( error ) {
|
|
236
236
|
logger.info( { error: error, message: req.body, function: 'changeStatus' } );
|
|
237
|
-
return res.sendError(
|
|
237
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -296,7 +296,7 @@ export async function getClients( req, res ) {
|
|
|
296
296
|
return res.sendSuccess( { result: result } );
|
|
297
297
|
} catch ( error ) {
|
|
298
298
|
logger.error( { error: error, function: 'getClients' } );
|
|
299
|
-
return res.sendError(
|
|
299
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
|
|
@@ -413,7 +413,7 @@ export async function detailedAllClientCount( req, res ) {
|
|
|
413
413
|
return res.sendSuccess( { result: result } );
|
|
414
414
|
} catch ( error ) {
|
|
415
415
|
logger.error( { error: error, function: 'detailedAllClientCount' } );
|
|
416
|
-
return res.sendError(
|
|
416
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
|
|
@@ -514,7 +514,7 @@ export async function updateBrandInfo( req, res ) {
|
|
|
514
514
|
}
|
|
515
515
|
} catch ( error ) {
|
|
516
516
|
logger.error( { error: error, message: req.params, function: 'updateBrandInfo' } );
|
|
517
|
-
return res.sendError(
|
|
517
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
520
|
|
|
@@ -565,7 +565,7 @@ export async function updateBillingDetails( req, res ) {
|
|
|
565
565
|
}
|
|
566
566
|
} catch ( error ) {
|
|
567
567
|
logger.error( { error: error, message: req.params, function: 'updateBillingDetails' } );
|
|
568
|
-
return res.sendError(
|
|
568
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
571
|
|
|
@@ -601,7 +601,7 @@ export async function updateSignatoryDetails( req, res ) {
|
|
|
601
601
|
}
|
|
602
602
|
} catch ( error ) {
|
|
603
603
|
logger.error( { error: error, message: req.params, function: 'updateSignatoryDetails' } );
|
|
604
|
-
return res.sendError(
|
|
604
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
607
|
|
|
@@ -640,7 +640,7 @@ export async function updateTicketConfiguration( req, res ) {
|
|
|
640
640
|
}
|
|
641
641
|
} catch ( error ) {
|
|
642
642
|
logger.error( { error: error, message: req.params, function: 'updateTicketConfiguration' } );
|
|
643
|
-
return res.sendError(
|
|
643
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
644
644
|
}
|
|
645
645
|
}
|
|
646
646
|
|
|
@@ -725,7 +725,7 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
725
725
|
}
|
|
726
726
|
} catch ( error ) {
|
|
727
727
|
logger.error( { error: error, message: req.params, function: 'updateTicketConfiguration' } );
|
|
728
|
-
return res.sendError(
|
|
728
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
731
|
|
|
@@ -764,7 +764,7 @@ export async function domainDetailsConfiguration( req, res ) {
|
|
|
764
764
|
}
|
|
765
765
|
} catch ( error ) {
|
|
766
766
|
logger.error( { error: error, message: req.params, function: 'domainDetailsConfiguration' } );
|
|
767
|
-
return res.sendError(
|
|
767
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
770
|
|
|
@@ -778,7 +778,7 @@ export async function userConfiguration( req, res ) {
|
|
|
778
778
|
}
|
|
779
779
|
} catch ( error ) {
|
|
780
780
|
logger.error( { error: error, message: req.params, function: 'userConfiguration' } );
|
|
781
|
-
return res.sendError(
|
|
781
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
782
782
|
}
|
|
783
783
|
}
|
|
784
784
|
|
|
@@ -875,7 +875,7 @@ export async function updateDocuments( req, res ) {
|
|
|
875
875
|
}
|
|
876
876
|
} catch ( error ) {
|
|
877
877
|
logger.error( { error: error, message: req.params, function: 'updateBillingDetails' } );
|
|
878
|
-
return res.sendError(
|
|
878
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
879
879
|
}
|
|
880
880
|
}
|
|
881
881
|
|
|
@@ -892,11 +892,11 @@ export async function getAuditConfiguration( req, res ) {
|
|
|
892
892
|
}
|
|
893
893
|
res.sendSuccess( auditConfig );
|
|
894
894
|
} else {
|
|
895
|
-
res.sendError(
|
|
895
|
+
res.sendError( 'Store not Found', 404 );
|
|
896
896
|
}
|
|
897
897
|
} catch ( error ) {
|
|
898
898
|
logger.error( { error: error, message: req.params, function: 'getAuditConfiguration' } );
|
|
899
|
-
return res.sendError(
|
|
899
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
900
900
|
}
|
|
901
901
|
}
|
|
902
902
|
|
|
@@ -937,7 +937,7 @@ export async function auditConfiguration( req, res ) {
|
|
|
937
937
|
res.sendSuccess( { result: 'Updated Successfully' } );
|
|
938
938
|
} catch ( error ) {
|
|
939
939
|
logger.error( { error: error, message: req.params, function: 'auditConfiguration' } );
|
|
940
|
-
return res.sendError(
|
|
940
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
941
941
|
}
|
|
942
942
|
}
|
|
943
943
|
|
|
@@ -951,7 +951,7 @@ export async function getCsmUsers( req, res ) {
|
|
|
951
951
|
if ( users?.length ) {
|
|
952
952
|
res.sendSuccess( users );
|
|
953
953
|
} else {
|
|
954
|
-
res.sendError( 'No
|
|
954
|
+
res.sendError( 'No Users Found', 404 );
|
|
955
955
|
}
|
|
956
956
|
} catch ( error ) {
|
|
957
957
|
logger.error( { error: error, message: req.params, function: 'getAuditConfiguration' } );
|
|
@@ -963,6 +963,37 @@ export async function clientList( req, res ) {
|
|
|
963
963
|
let clientQuery = [];
|
|
964
964
|
const limit = inputData.limit || 10;
|
|
965
965
|
const skip = inputData.offset ? ( inputData.offset - 1 ) * limit : 0;
|
|
966
|
+
logger.info( { message: req?.user?.role } );
|
|
967
|
+
if ( req?.user?.role !== 'superadmin' ) {
|
|
968
|
+
const query = [
|
|
969
|
+
{
|
|
970
|
+
$match: {
|
|
971
|
+
userEmail: { $eq: req?.user?.email },
|
|
972
|
+
userType: 'tango',
|
|
973
|
+
|
|
974
|
+
},
|
|
975
|
+
}, {
|
|
976
|
+
|
|
977
|
+
$group: {
|
|
978
|
+
_id: null,
|
|
979
|
+
clientList: { $push: '$assignedValue' },
|
|
980
|
+
},
|
|
981
|
+
},
|
|
982
|
+
];
|
|
983
|
+
const clientIdList = await aggregateUserAssignedStore( query );
|
|
984
|
+
logger.info( { message: clientIdList, value: 'clientIdList' } );
|
|
985
|
+
if ( clientIdList.length ==0 ) {
|
|
986
|
+
return res.sendError( 'No Data Found', 204 );
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
clientQuery.push(
|
|
990
|
+
{
|
|
991
|
+
$match: {
|
|
992
|
+
clientId: { $in: clientIdList[0].clientList },
|
|
993
|
+
},
|
|
994
|
+
},
|
|
995
|
+
);
|
|
996
|
+
}
|
|
966
997
|
if ( inputData.filterByPaymentStatus ) {
|
|
967
998
|
clientQuery.push(
|
|
968
999
|
{
|
|
@@ -1027,7 +1058,7 @@ export async function clientList( req, res ) {
|
|
|
1027
1058
|
|
|
1028
1059
|
const clientCount = await aggregateClient( clientQuery );
|
|
1029
1060
|
if ( clientCount.length == 0 ) {
|
|
1030
|
-
return res.sendError(
|
|
1061
|
+
return res.sendError( 'No Data Found', 204 );
|
|
1031
1062
|
}
|
|
1032
1063
|
|
|
1033
1064
|
if ( inputData.sortColumName ) {
|
|
@@ -1231,7 +1262,7 @@ export async function clientList( req, res ) {
|
|
|
1231
1262
|
return res.sendSuccess( { result: sortedResult, count: clientCount.length } );
|
|
1232
1263
|
} catch ( error ) {
|
|
1233
1264
|
logger.error( { error: error, function: 'clientList' } );
|
|
1234
|
-
return res.sendError(
|
|
1265
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
1235
1266
|
}
|
|
1236
1267
|
}
|
|
1237
1268
|
|
|
@@ -1245,7 +1276,7 @@ export async function getOpsUsers( req, res ) {
|
|
|
1245
1276
|
}
|
|
1246
1277
|
} catch ( error ) {
|
|
1247
1278
|
logger.error( { error: error, message: req.params, function: 'getOpsUsers' } );
|
|
1248
|
-
return res.sendError(
|
|
1279
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
1249
1280
|
}
|
|
1250
1281
|
}
|
|
1251
1282
|
|
|
@@ -1269,8 +1300,6 @@ export async function detailedClientCount( req, res ) {
|
|
|
1269
1300
|
|
|
1270
1301
|
if ( isLogoExist ) {
|
|
1271
1302
|
const signedFilUrl = await signedUrl( { Bucket: appConfig.cloud.aws.bucket.assets, file_path: `${client.clientId}/logo/${client.profileDetails?.logo}` } );
|
|
1272
|
-
logger.info( { signedFilUrl: signedFilUrl, data: 'signedFilUrl' } );
|
|
1273
|
-
|
|
1274
1303
|
result['logo'] = signedFilUrl;
|
|
1275
1304
|
} else {
|
|
1276
1305
|
result['logo'] = '';
|
|
@@ -1282,7 +1311,7 @@ export async function detailedClientCount( req, res ) {
|
|
|
1282
1311
|
return res.sendSuccess( { result: result } );
|
|
1283
1312
|
} catch ( error ) {
|
|
1284
1313
|
logger.error( { error: error, function: 'detailedClientCount' } );
|
|
1285
|
-
return res.sendError(
|
|
1314
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
1286
1315
|
}
|
|
1287
1316
|
}
|
|
1288
1317
|
|
|
@@ -1338,7 +1367,7 @@ export async function getActivityLogs( req, res ) {
|
|
|
1338
1367
|
}
|
|
1339
1368
|
} catch ( error ) {
|
|
1340
1369
|
logger.error( { error: error, message: req.body, function: 'getActivityLogs' } );
|
|
1341
|
-
return res.sendError(
|
|
1370
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
1342
1371
|
}
|
|
1343
1372
|
}
|
|
1344
1373
|
|
|
@@ -6,12 +6,12 @@ export async function isclientNameExists( req, res, next ) {
|
|
|
6
6
|
const inputData = req.body;
|
|
7
7
|
const client = await model.clientModel.findOne( { clientName: inputData?.clientName } );
|
|
8
8
|
if ( client ) {
|
|
9
|
-
return res.sendError( '
|
|
9
|
+
return res.sendError( 'ClientName is Exists', 403 );
|
|
10
10
|
}
|
|
11
11
|
return next();
|
|
12
12
|
} catch ( error ) {
|
|
13
13
|
logger.error( { error: error, message: req.body, function: 'isclientNameExists' } );
|
|
14
|
-
return res.sendError(
|
|
14
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -23,13 +23,13 @@ export async function isclientIdExists( req, res, next ) {
|
|
|
23
23
|
};
|
|
24
24
|
const client = await findOneClient( query );
|
|
25
25
|
if ( !client ) {
|
|
26
|
-
return res.sendError(
|
|
26
|
+
return res.sendError( `Client doesn't Exists`, 204 );
|
|
27
27
|
}
|
|
28
28
|
req.query.clientName = client.clientName;
|
|
29
29
|
req.query.userId = client.userId;
|
|
30
30
|
return next();
|
|
31
31
|
} catch ( error ) {
|
|
32
32
|
logger.error( { error: error, function: 'isclientIdExists' } );
|
|
33
|
-
return res.sendError(
|
|
33
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
34
34
|
}
|
|
35
35
|
}
|