tango-app-api-client 3.0.38-dev → 3.0.40-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.
|
|
3
|
+
"version": "3.0.40-dev",
|
|
4
4
|
"description": "client",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,8 +25,8 @@
|
|
|
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.
|
|
29
|
-
"tango-app-api-middleware": "^3.1.
|
|
28
|
+
"tango-api-schema": "^2.0.93",
|
|
29
|
+
"tango-app-api-middleware": "^3.1.9",
|
|
30
30
|
"winston": "^3.11.0",
|
|
31
31
|
"winston-daily-rotate-file": "^5.0.0"
|
|
32
32
|
},
|
|
@@ -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 ) {
|
|
@@ -383,9 +382,18 @@ export async function detailedAllClientCount( req, res ) {
|
|
|
383
382
|
{
|
|
384
383
|
$project: {
|
|
385
384
|
activeClient: { $cond: [ { $eq: [ '$status', 'active' ] }, 1, 0 ] },
|
|
386
|
-
paidClient: { $cond: [ { $
|
|
387
|
-
|
|
388
|
-
|
|
385
|
+
paidClient: { $cond: [ { $and: [
|
|
386
|
+
{ $eq: [ '$status', 'active' ] },
|
|
387
|
+
{ $in: [ '$planDetails.paymentStatus', [ 'paid', 'unbilled', 'due' ] ] },
|
|
388
|
+
] }, 1, 0 ] },
|
|
389
|
+
trialClient: { $cond: [ { $and: [
|
|
390
|
+
{ $eq: [ '$status', 'active' ] },
|
|
391
|
+
{ $eq: [ '$planDetails.paymentStatus', 'trial' ] },
|
|
392
|
+
] }, 1, 0 ] },
|
|
393
|
+
|
|
394
|
+
freeClient: { $cond: [ { $and: [
|
|
395
|
+
{ $eq: [ '$status', 'active' ] }, { $eq: [ '$planDetails.paymentStatus', 'free' ] },
|
|
396
|
+
] }, 1, 0 ] },
|
|
389
397
|
holdClient: { $cond: [ { $eq: [ '$status', 'hold' ] }, 1, 0 ] },
|
|
390
398
|
suspendClient: { $cond: [ { $eq: [ '$status', 'suspended' ] }, 1, 0 ] },
|
|
391
399
|
deactiveClient: { $cond: [ { $eq: [ '$status', 'deactive' ] }, 1, 0 ] },
|
|
@@ -405,11 +413,30 @@ export async function detailedAllClientCount( req, res ) {
|
|
|
405
413
|
|
|
406
414
|
},
|
|
407
415
|
},
|
|
416
|
+
{
|
|
417
|
+
$project: {
|
|
418
|
+
_id: 0,
|
|
419
|
+
totalCount: 1,
|
|
420
|
+
activeClient: 1,
|
|
421
|
+
paidClient: 1,
|
|
422
|
+
trialClient: 1,
|
|
423
|
+
freeClient: 1,
|
|
424
|
+
holdClient: 1,
|
|
425
|
+
suspendClient: 1,
|
|
426
|
+
deactiveClient: 1,
|
|
427
|
+
activeStoresCount: { $ifNull: [ 0, 0 ] },
|
|
428
|
+
activeCameraCount: { $ifNull: [ 0, 0 ] },
|
|
429
|
+
},
|
|
430
|
+
},
|
|
408
431
|
];
|
|
409
432
|
const result = await aggregateClient( query );
|
|
410
|
-
|
|
433
|
+
const activeStores = await countDocumentsStore( { status: 'active' } );
|
|
434
|
+
const activeCameras = await countDocumentsCamera( { isUp: true, isActivated: true } );
|
|
435
|
+
if ( result.length == 0 ) {
|
|
411
436
|
return res.sendError( 'No Data Found', 204 );
|
|
412
437
|
}
|
|
438
|
+
result[0].activeStoresCount = activeStores;
|
|
439
|
+
result[0].activeCameraCount = activeCameras;
|
|
413
440
|
return res.sendSuccess( { result: result } );
|
|
414
441
|
} catch ( error ) {
|
|
415
442
|
logger.error( { error: error, function: 'detailedAllClientCount' } );
|
|
@@ -995,6 +1022,10 @@ export async function clientList( req, res ) {
|
|
|
995
1022
|
);
|
|
996
1023
|
}
|
|
997
1024
|
if ( inputData.filterByPaymentStatus ) {
|
|
1025
|
+
if ( inputData.filterByPaymentStatus.includes( 'paid' ) ) {
|
|
1026
|
+
inputData.filterByPaymentStatus.push( ...[ 'unbilled', 'due' ] );
|
|
1027
|
+
}
|
|
1028
|
+
|
|
998
1029
|
clientQuery.push(
|
|
999
1030
|
{
|
|
1000
1031
|
$match: {
|
package/src/docs/client.docs.js
CHANGED
|
@@ -40,14 +40,6 @@ export const clientDocs = {
|
|
|
40
40
|
description: 'Get list of clients',
|
|
41
41
|
operationId: 'get-clients',
|
|
42
42
|
parameters: [
|
|
43
|
-
{
|
|
44
|
-
in: 'path',
|
|
45
|
-
name: 'id',
|
|
46
|
-
required: true,
|
|
47
|
-
schema: {
|
|
48
|
-
type: 'string',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
43
|
],
|
|
52
44
|
responses: {
|
|
53
45
|
200: { description: 'Success' },
|
|
@@ -455,14 +447,6 @@ export const clientDocs = {
|
|
|
455
447
|
description: 'Get toatal info about overall clients',
|
|
456
448
|
operationId: 'detailed-all-client-count',
|
|
457
449
|
parameters: [
|
|
458
|
-
{
|
|
459
|
-
in: 'path',
|
|
460
|
-
name: 'id',
|
|
461
|
-
required: true,
|
|
462
|
-
schema: {
|
|
463
|
-
type: 'string',
|
|
464
|
-
},
|
|
465
|
-
},
|
|
466
450
|
],
|
|
467
451
|
responses: {
|
|
468
452
|
200: { description: 'Success' },
|
|
@@ -28,23 +28,25 @@ export function findClient( query, field ) {
|
|
|
28
28
|
export async function createAuditQueue( queueName ) {
|
|
29
29
|
try {
|
|
30
30
|
const isExist = await getQueueUrl( `${queueName}${appConfig.cloud.aws.sqs.queueType}` );
|
|
31
|
+
logger.info( { message: isExist, function: 'createAuditQueue-isExist' } );
|
|
31
32
|
if ( isExist.statusCode ) {
|
|
32
33
|
const addQueue = await createQueue( `${queueName}${appConfig.cloud.aws.sqs.queueType}` );
|
|
34
|
+
logger.info( { message: addQueue.QueueUrl, function: 'addQueue.QueueUrl' } );
|
|
33
35
|
if ( addQueue.QueueUrl ) {
|
|
34
36
|
logger.info(
|
|
35
37
|
'Queueue Created'
|
|
36
38
|
, { queueName: addQueue.QueueUrl, addQueue },
|
|
37
39
|
);
|
|
38
40
|
} else {
|
|
39
|
-
logger.error( { error: 'Queue creation failed', function: 'createAuditQueue' } );
|
|
41
|
+
logger.error( { error: 'Queue creation failed', function: 'createAuditQueue-failed' } );
|
|
40
42
|
}
|
|
41
43
|
} else {
|
|
42
|
-
logger.error( { error: 'Queue already exisit', message: queueName, function: 'createAuditQueue' } );
|
|
44
|
+
logger.error( { error: 'Queue already exisit', message: queueName, function: 'createAuditQueue-alreday exist' } );
|
|
43
45
|
}
|
|
44
46
|
return true;
|
|
45
47
|
} catch ( error ) {
|
|
46
48
|
logger.error( { error: error, message: queueName, function: 'createAuditQueue' } );
|
|
47
|
-
return
|
|
49
|
+
return res.sendError( `Queue Doesn't create`, 500 );
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
|