tango-app-api-client 3.1.8 → 3.1.10
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.1.
|
|
3
|
+
"version": "3.1.10",
|
|
4
4
|
"description": "client",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"mongodb": "^6.3.0",
|
|
26
26
|
"nodemon": "^3.0.3",
|
|
27
27
|
"swagger-ui-express": "^5.0.0",
|
|
28
|
-
"tango-api-schema": "^2.0.
|
|
28
|
+
"tango-api-schema": "^2.0.89",
|
|
29
29
|
"tango-app-api-middleware": "^3.1.7",
|
|
30
30
|
"winston": "^3.11.0",
|
|
31
31
|
"winston-daily-rotate-file": "^5.0.0"
|
|
@@ -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,
|
|
@@ -176,10 +176,9 @@ export async function create( req, res ) {
|
|
|
176
176
|
'role': 'storesuperadmin',
|
|
177
177
|
};
|
|
178
178
|
|
|
179
|
-
|
|
180
179
|
await postApi( `${appConfig.url.oldapidomain}/oldBrandAdd`, oldBrandInsertData );
|
|
181
180
|
|
|
182
|
-
await postApi( `${appConfig.url.oldapidomain}/
|
|
181
|
+
await postApi( `${appConfig.url.oldapidomain}/oldDefaultRoleInsert`, oldDefaultRolesInsertData );
|
|
183
182
|
|
|
184
183
|
|
|
185
184
|
if ( insertClient ) {
|
|
@@ -197,7 +196,7 @@ export async function create( req, res ) {
|
|
|
197
196
|
}
|
|
198
197
|
} catch ( error ) {
|
|
199
198
|
logger.info( { error: error, message: req.body, function: 'create' } );
|
|
200
|
-
return res.sendError(
|
|
199
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
201
200
|
}
|
|
202
201
|
}
|
|
203
202
|
|
|
@@ -225,7 +224,7 @@ export async function changeStatus( req, res, next ) {
|
|
|
225
224
|
};
|
|
226
225
|
const result = await update( query, record );
|
|
227
226
|
if ( result.matchedCount == 0 ) {
|
|
228
|
-
res.sendError( 'Not Found', 204 );
|
|
227
|
+
res.sendError( 'Data Not Found', 204 );
|
|
229
228
|
}
|
|
230
229
|
if ( inputData.status == 'approved' ) {
|
|
231
230
|
return next();
|
|
@@ -234,7 +233,7 @@ export async function changeStatus( req, res, next ) {
|
|
|
234
233
|
}
|
|
235
234
|
} catch ( error ) {
|
|
236
235
|
logger.info( { error: error, message: req.body, function: 'changeStatus' } );
|
|
237
|
-
return res.sendError(
|
|
236
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
238
237
|
}
|
|
239
238
|
}
|
|
240
239
|
|
|
@@ -296,7 +295,7 @@ export async function getClients( req, res ) {
|
|
|
296
295
|
return res.sendSuccess( { result: result } );
|
|
297
296
|
} catch ( error ) {
|
|
298
297
|
logger.error( { error: error, function: 'getClients' } );
|
|
299
|
-
return res.sendError(
|
|
298
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
300
299
|
}
|
|
301
300
|
}
|
|
302
301
|
|
|
@@ -413,7 +412,7 @@ export async function detailedAllClientCount( req, res ) {
|
|
|
413
412
|
return res.sendSuccess( { result: result } );
|
|
414
413
|
} catch ( error ) {
|
|
415
414
|
logger.error( { error: error, function: 'detailedAllClientCount' } );
|
|
416
|
-
return res.sendError(
|
|
415
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
417
416
|
}
|
|
418
417
|
}
|
|
419
418
|
|
|
@@ -514,7 +513,7 @@ export async function updateBrandInfo( req, res ) {
|
|
|
514
513
|
}
|
|
515
514
|
} catch ( error ) {
|
|
516
515
|
logger.error( { error: error, message: req.params, function: 'updateBrandInfo' } );
|
|
517
|
-
return res.sendError(
|
|
516
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
518
517
|
}
|
|
519
518
|
}
|
|
520
519
|
|
|
@@ -565,7 +564,7 @@ export async function updateBillingDetails( req, res ) {
|
|
|
565
564
|
}
|
|
566
565
|
} catch ( error ) {
|
|
567
566
|
logger.error( { error: error, message: req.params, function: 'updateBillingDetails' } );
|
|
568
|
-
return res.sendError(
|
|
567
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
569
568
|
}
|
|
570
569
|
}
|
|
571
570
|
|
|
@@ -601,7 +600,7 @@ export async function updateSignatoryDetails( req, res ) {
|
|
|
601
600
|
}
|
|
602
601
|
} catch ( error ) {
|
|
603
602
|
logger.error( { error: error, message: req.params, function: 'updateSignatoryDetails' } );
|
|
604
|
-
return res.sendError(
|
|
603
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
605
604
|
}
|
|
606
605
|
}
|
|
607
606
|
|
|
@@ -640,7 +639,7 @@ export async function updateTicketConfiguration( req, res ) {
|
|
|
640
639
|
}
|
|
641
640
|
} catch ( error ) {
|
|
642
641
|
logger.error( { error: error, message: req.params, function: 'updateTicketConfiguration' } );
|
|
643
|
-
return res.sendError(
|
|
642
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
644
643
|
}
|
|
645
644
|
}
|
|
646
645
|
|
|
@@ -725,7 +724,7 @@ export async function updateFeatureConfiguration( req, res ) {
|
|
|
725
724
|
}
|
|
726
725
|
} catch ( error ) {
|
|
727
726
|
logger.error( { error: error, message: req.params, function: 'updateTicketConfiguration' } );
|
|
728
|
-
return res.sendError(
|
|
727
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
729
728
|
}
|
|
730
729
|
}
|
|
731
730
|
|
|
@@ -764,7 +763,7 @@ export async function domainDetailsConfiguration( req, res ) {
|
|
|
764
763
|
}
|
|
765
764
|
} catch ( error ) {
|
|
766
765
|
logger.error( { error: error, message: req.params, function: 'domainDetailsConfiguration' } );
|
|
767
|
-
return res.sendError(
|
|
766
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
768
767
|
}
|
|
769
768
|
}
|
|
770
769
|
|
|
@@ -778,7 +777,7 @@ export async function userConfiguration( req, res ) {
|
|
|
778
777
|
}
|
|
779
778
|
} catch ( error ) {
|
|
780
779
|
logger.error( { error: error, message: req.params, function: 'userConfiguration' } );
|
|
781
|
-
return res.sendError(
|
|
780
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
782
781
|
}
|
|
783
782
|
}
|
|
784
783
|
|
|
@@ -875,7 +874,7 @@ export async function updateDocuments( req, res ) {
|
|
|
875
874
|
}
|
|
876
875
|
} catch ( error ) {
|
|
877
876
|
logger.error( { error: error, message: req.params, function: 'updateBillingDetails' } );
|
|
878
|
-
return res.sendError(
|
|
877
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
879
878
|
}
|
|
880
879
|
}
|
|
881
880
|
|
|
@@ -892,11 +891,11 @@ export async function getAuditConfiguration( req, res ) {
|
|
|
892
891
|
}
|
|
893
892
|
res.sendSuccess( auditConfig );
|
|
894
893
|
} else {
|
|
895
|
-
res.sendError(
|
|
894
|
+
res.sendError( 'Store not Found', 404 );
|
|
896
895
|
}
|
|
897
896
|
} catch ( error ) {
|
|
898
897
|
logger.error( { error: error, message: req.params, function: 'getAuditConfiguration' } );
|
|
899
|
-
return res.sendError(
|
|
898
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
900
899
|
}
|
|
901
900
|
}
|
|
902
901
|
|
|
@@ -937,7 +936,7 @@ export async function auditConfiguration( req, res ) {
|
|
|
937
936
|
res.sendSuccess( { result: 'Updated Successfully' } );
|
|
938
937
|
} catch ( error ) {
|
|
939
938
|
logger.error( { error: error, message: req.params, function: 'auditConfiguration' } );
|
|
940
|
-
return res.sendError(
|
|
939
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
941
940
|
}
|
|
942
941
|
}
|
|
943
942
|
|
|
@@ -951,7 +950,7 @@ export async function getCsmUsers( req, res ) {
|
|
|
951
950
|
if ( users?.length ) {
|
|
952
951
|
res.sendSuccess( users );
|
|
953
952
|
} else {
|
|
954
|
-
res.sendError( 'No
|
|
953
|
+
res.sendError( 'No Users Found', 404 );
|
|
955
954
|
}
|
|
956
955
|
} catch ( error ) {
|
|
957
956
|
logger.error( { error: error, message: req.params, function: 'getAuditConfiguration' } );
|
|
@@ -963,6 +962,37 @@ export async function clientList( req, res ) {
|
|
|
963
962
|
let clientQuery = [];
|
|
964
963
|
const limit = inputData.limit || 10;
|
|
965
964
|
const skip = inputData.offset ? ( inputData.offset - 1 ) * limit : 0;
|
|
965
|
+
logger.info( { message: req?.user?.role } );
|
|
966
|
+
if ( req?.user?.role !== 'superadmin' ) {
|
|
967
|
+
const query = [
|
|
968
|
+
{
|
|
969
|
+
$match: {
|
|
970
|
+
userEmail: { $eq: req?.user?.email },
|
|
971
|
+
userType: 'tango',
|
|
972
|
+
|
|
973
|
+
},
|
|
974
|
+
}, {
|
|
975
|
+
|
|
976
|
+
$group: {
|
|
977
|
+
_id: null,
|
|
978
|
+
clientList: { $push: '$assignedValue' },
|
|
979
|
+
},
|
|
980
|
+
},
|
|
981
|
+
];
|
|
982
|
+
const clientIdList = await aggregateUserAssignedStore( query );
|
|
983
|
+
logger.info( { message: clientIdList, value: 'clientIdList' } );
|
|
984
|
+
if ( clientIdList.length ==0 ) {
|
|
985
|
+
return res.sendError( 'No Data Found', 204 );
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
clientQuery.push(
|
|
989
|
+
{
|
|
990
|
+
$match: {
|
|
991
|
+
clientId: { $in: clientIdList[0].clientList },
|
|
992
|
+
},
|
|
993
|
+
},
|
|
994
|
+
);
|
|
995
|
+
}
|
|
966
996
|
if ( inputData.filterByPaymentStatus ) {
|
|
967
997
|
clientQuery.push(
|
|
968
998
|
{
|
|
@@ -1027,7 +1057,7 @@ export async function clientList( req, res ) {
|
|
|
1027
1057
|
|
|
1028
1058
|
const clientCount = await aggregateClient( clientQuery );
|
|
1029
1059
|
if ( clientCount.length == 0 ) {
|
|
1030
|
-
return res.sendError(
|
|
1060
|
+
return res.sendError( 'No Data Found', 204 );
|
|
1031
1061
|
}
|
|
1032
1062
|
|
|
1033
1063
|
if ( inputData.sortColumName ) {
|
|
@@ -1231,7 +1261,7 @@ export async function clientList( req, res ) {
|
|
|
1231
1261
|
return res.sendSuccess( { result: sortedResult, count: clientCount.length } );
|
|
1232
1262
|
} catch ( error ) {
|
|
1233
1263
|
logger.error( { error: error, function: 'clientList' } );
|
|
1234
|
-
return res.sendError(
|
|
1264
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
1235
1265
|
}
|
|
1236
1266
|
}
|
|
1237
1267
|
|
|
@@ -1245,7 +1275,7 @@ export async function getOpsUsers( req, res ) {
|
|
|
1245
1275
|
}
|
|
1246
1276
|
} catch ( error ) {
|
|
1247
1277
|
logger.error( { error: error, message: req.params, function: 'getOpsUsers' } );
|
|
1248
|
-
return res.sendError(
|
|
1278
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
1249
1279
|
}
|
|
1250
1280
|
}
|
|
1251
1281
|
|
|
@@ -1269,8 +1299,6 @@ export async function detailedClientCount( req, res ) {
|
|
|
1269
1299
|
|
|
1270
1300
|
if ( isLogoExist ) {
|
|
1271
1301
|
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
1302
|
result['logo'] = signedFilUrl;
|
|
1275
1303
|
} else {
|
|
1276
1304
|
result['logo'] = '';
|
|
@@ -1282,7 +1310,7 @@ export async function detailedClientCount( req, res ) {
|
|
|
1282
1310
|
return res.sendSuccess( { result: result } );
|
|
1283
1311
|
} catch ( error ) {
|
|
1284
1312
|
logger.error( { error: error, function: 'detailedClientCount' } );
|
|
1285
|
-
return res.sendError(
|
|
1313
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
1286
1314
|
}
|
|
1287
1315
|
}
|
|
1288
1316
|
|
|
@@ -1338,7 +1366,7 @@ export async function getActivityLogs( req, res ) {
|
|
|
1338
1366
|
}
|
|
1339
1367
|
} catch ( error ) {
|
|
1340
1368
|
logger.error( { error: error, message: req.body, function: 'getActivityLogs' } );
|
|
1341
|
-
return res.sendError(
|
|
1369
|
+
return res.sendError( 'Internal Server Error', 500 );
|
|
1342
1370
|
}
|
|
1343
1371
|
}
|
|
1344
1372
|
|
|
@@ -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
|
}
|