tango-app-api-client 3.0.9-dev → 3.0.11-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.11-dev",
|
|
4
4
|
"description": "client",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
"lodash": "^4.17.21",
|
|
24
24
|
"mongodb": "^6.3.0",
|
|
25
25
|
"nodemon": "^3.0.3",
|
|
26
|
-
"tango-api-schema": "^2.0.
|
|
27
|
-
"tango-app-api-middleware": "^1.0.
|
|
26
|
+
"tango-api-schema": "^2.0.53",
|
|
27
|
+
"tango-app-api-middleware": "^1.0.39-dev",
|
|
28
28
|
"winston": "^3.11.0",
|
|
29
29
|
"winston-daily-rotate-file": "^5.0.0"
|
|
30
30
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { billingDetailsUpdate, brandInfoUpdate, domainDetailsConfigurationUpdate, featureConfigurationUpdate, getClientData, signatoryDetailsUpdate, ticketConfigurationUpdate, documentsUpdate, getUserData, auditConfigurationUpdate, auditConfigurationGet, CsmUsersGet, OpsUsersGet, userConfigurationUpdate, findClient, aggregateClient, createAuditQueue, findOne, getClientCount, insert, update } from '../service/client.service.js';
|
|
2
|
-
import { checkFileExist, fileUpload, signedUrl, chunkArray, download, logger, getOpenSearchData, insertOpenSearchData } from 'tango-app-api-middleware';
|
|
2
|
+
import { checkFileExist, fileUpload, signedUrl, chunkArray, download, logger, getOpenSearchData, insertOpenSearchData, appConfig } from 'tango-app-api-middleware';
|
|
3
3
|
import { countDocumentsUser, findOneAndUpdateUser, findOneUser, getUserNameEmailById } from '../service/user.service.js';
|
|
4
4
|
import { aggregateStore, countDocumentsStore } from '../service/store.service.js';
|
|
5
5
|
import { aggregateCamera, countDocumentsCamera } from '../service/camera.service.js';
|
|
@@ -102,59 +102,59 @@ export async function clientDetails( req, res ) {
|
|
|
102
102
|
try {
|
|
103
103
|
const client = await getClientData( { id: req.params.id } );
|
|
104
104
|
if ( client ) {
|
|
105
|
-
const isLogoExist = await checkFileExist( { Bucket:
|
|
106
|
-
const isGstCertificateExist = await checkFileExist( { Bucket:
|
|
107
|
-
const isAddressCertificateExist = await checkFileExist( { Bucket:
|
|
108
|
-
const isPanCertificateExist = await checkFileExist( { Bucket:
|
|
109
|
-
const isCinCertificateExist = await checkFileExist( { Bucket:
|
|
110
|
-
const isContractCertificateExist = await checkFileExist( { Bucket:
|
|
111
|
-
const isTermsAndConditionsExist = await checkFileExist( { Bucket:
|
|
105
|
+
const isLogoExist = await checkFileExist( { Bucket: appConfig.cloud.aws.bucket.assets, Key: `${client.clientId}/logo/${client.profileDetails?.logo}` } );
|
|
106
|
+
const isGstCertificateExist = await checkFileExist( { Bucket: appConfig.cloud.aws.bucket.assets, Key: `${client.clientId}/documents/${client.document?.gst?.path}` } );
|
|
107
|
+
const isAddressCertificateExist = await checkFileExist( { Bucket: appConfig.cloud.aws.bucket.assets, Key: `${client.clientId}/documents/${client.document?.addressProof?.path}` } );
|
|
108
|
+
const isPanCertificateExist = await checkFileExist( { Bucket: appConfig.cloud.aws.bucket.assets, Key: `${client.clientId}/documents/${client.document?.pan?.path}` } );
|
|
109
|
+
const isCinCertificateExist = await checkFileExist( { Bucket: appConfig.cloud.aws.bucket.assets, Key: `${client.clientId}/documents/${client.document?.cin?.path}` } );
|
|
110
|
+
const isContractCertificateExist = await checkFileExist( { Bucket: appConfig.cloud.aws.bucket.assets, Key: `documents/contract.pdf` } );
|
|
111
|
+
const isTermsAndConditionsExist = await checkFileExist( { Bucket: appConfig.cloud.aws.bucket.assets, Key: `documents/terms&conditions.pdf` } );
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
if ( isLogoExist ) {
|
|
115
|
-
const signedFilUrl = await signedUrl( { Bucket:
|
|
115
|
+
const signedFilUrl = await signedUrl( { Bucket: appConfig.cloud.aws.bucket.assets, file_path: `${client.clientId}/logo/${client.profileDetails?.logo}` } );
|
|
116
116
|
client.profileDetails.logo = signedFilUrl;
|
|
117
117
|
} else {
|
|
118
118
|
client.profileDetails.logo = '';
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
if ( isGstCertificateExist ) {
|
|
122
|
-
const signedFilUrl = await signedUrl( { Bucket:
|
|
122
|
+
const signedFilUrl = await signedUrl( { Bucket: appConfig.cloud.aws.bucket.assets, file_path: `${client.clientId}/documents/${client.document?.gst?.path}` } );
|
|
123
123
|
client.document.gst.path = signedFilUrl;
|
|
124
124
|
} else {
|
|
125
125
|
client.document.gst.path = '';
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
if ( isAddressCertificateExist ) {
|
|
129
|
-
const signedFilUrl = await signedUrl( { Bucket:
|
|
129
|
+
const signedFilUrl = await signedUrl( { Bucket: appConfig.cloud.aws.bucket.assets, file_path: `${client.clientId}/documents/${client.document?.addressProof?.path}` } );
|
|
130
130
|
client.document.addressProof.path = signedFilUrl;
|
|
131
131
|
} else {
|
|
132
132
|
client.document.addressProof.path = '';
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
if ( isPanCertificateExist ) {
|
|
136
|
-
const signedFilUrl = await signedUrl( { Bucket:
|
|
136
|
+
const signedFilUrl = await signedUrl( { Bucket: appConfig.cloud.aws.bucket.assets, file_path: `${client.clientId}/documents/${client.document?.pan?.path}` } );
|
|
137
137
|
client.document.pan.path = signedFilUrl;
|
|
138
138
|
} else {
|
|
139
139
|
client.document.pan.path = '';
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
if ( isCinCertificateExist ) {
|
|
143
|
-
const signedFilUrl = await signedUrl( { Bucket:
|
|
143
|
+
const signedFilUrl = await signedUrl( { Bucket: appConfig.cloud.aws.bucket.assets, file_path: `${client.clientId}/documents/${client.document?.cin?.path}` } );
|
|
144
144
|
client.document.cin.path = signedFilUrl;
|
|
145
145
|
} else {
|
|
146
146
|
client.document.cin.path = '';
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
if ( isContractCertificateExist ) {
|
|
150
|
-
const signedFilUrl = await signedUrl( { Bucket:
|
|
150
|
+
const signedFilUrl = await signedUrl( { Bucket: appConfig.cloud.aws.bucket.assets, file_path: `documents/contract.pdf` } );
|
|
151
151
|
client._doc.document.contract = signedFilUrl;
|
|
152
152
|
} else {
|
|
153
153
|
client._doc.document.contract = '';
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
if ( isTermsAndConditionsExist ) {
|
|
157
|
-
const signedFilUrl = await signedUrl( { Bucket:
|
|
157
|
+
const signedFilUrl = await signedUrl( { Bucket: appConfig.cloud.aws.bucket.assets, file_path: `documents/terms&conditions.pdf` } );
|
|
158
158
|
client._doc.document.termsAndconditions = signedFilUrl;
|
|
159
159
|
} else {
|
|
160
160
|
client._doc.document.termsAndconditions = '';
|
|
@@ -226,7 +226,7 @@ export async function updateBrandInfo( req, res ) {
|
|
|
226
226
|
|
|
227
227
|
if ( req.files?.logo ) {
|
|
228
228
|
const uploadDataParams = {
|
|
229
|
-
Bucket:
|
|
229
|
+
Bucket: appConfig.cloud.aws.bucket.assets,
|
|
230
230
|
Key: `${req.params.id}/logo/`,
|
|
231
231
|
fileName: `brandLogo.${req.files.logo.name.split( '.' )[1]}`,
|
|
232
232
|
ContentType: req.files.logo.mimetype,
|
|
@@ -279,7 +279,7 @@ export async function updateBillingDetails( req, res ) {
|
|
|
279
279
|
|
|
280
280
|
if ( req.files?.gstCertificate ) {
|
|
281
281
|
const uploadDataParams = {
|
|
282
|
-
Bucket:
|
|
282
|
+
Bucket: appConfig.cloud.aws.bucket.assets,
|
|
283
283
|
Key: `${req.params.id}/documents/`,
|
|
284
284
|
fileName: `gstCertificate.${req.files.gstCertificate.name.split( '.' )[1]}`,
|
|
285
285
|
ContentType: req.files.gstCertificate.mimetype,
|
|
@@ -498,7 +498,7 @@ export async function updateDocuments( req, res ) {
|
|
|
498
498
|
|
|
499
499
|
if ( req.files?.addressDoc ) {
|
|
500
500
|
const uploadDataParams = {
|
|
501
|
-
Bucket:
|
|
501
|
+
Bucket: appConfig.cloud.aws.bucket.assets,
|
|
502
502
|
Key: `${req.params.id}/documents/`,
|
|
503
503
|
fileName: `addressCertificate.${req.files.addressDoc.name.split( '.' )[1]}`,
|
|
504
504
|
ContentType: req.files.addressDoc.mimetype,
|
|
@@ -511,7 +511,7 @@ export async function updateDocuments( req, res ) {
|
|
|
511
511
|
}
|
|
512
512
|
if ( req.files?.gstDoc ) {
|
|
513
513
|
const uploadDataParams = {
|
|
514
|
-
Bucket:
|
|
514
|
+
Bucket: appConfig.cloud.aws.bucket.assets,
|
|
515
515
|
Key: `${req.params.id}/documents/`,
|
|
516
516
|
fileName: `gstCertificate.${req.files.gstDoc.name.split( '.' )[1]}`,
|
|
517
517
|
ContentType: req.files.gstDoc.mimetype,
|
|
@@ -524,7 +524,7 @@ export async function updateDocuments( req, res ) {
|
|
|
524
524
|
}
|
|
525
525
|
if ( req.files?.panDoc ) {
|
|
526
526
|
const uploadDataParams = {
|
|
527
|
-
Bucket:
|
|
527
|
+
Bucket: appConfig.cloud.aws.bucket.assets,
|
|
528
528
|
Key: `${req.params.id}/documents/`,
|
|
529
529
|
fileName: `panCertificate.${req.files.panDoc.name.split( '.' )[1]}`,
|
|
530
530
|
ContentType: req.files.panDoc.mimetype,
|
|
@@ -537,7 +537,7 @@ export async function updateDocuments( req, res ) {
|
|
|
537
537
|
}
|
|
538
538
|
if ( req.files?.cinDoc ) {
|
|
539
539
|
const uploadDataParams = {
|
|
540
|
-
Bucket:
|
|
540
|
+
Bucket: appConfig.cloud.aws.bucket.assets,
|
|
541
541
|
Key: `${req.params.id}/documents/`,
|
|
542
542
|
fileName: `cinCertificate.${req.files.cinDoc.name.split( '.' )[1]}`,
|
|
543
543
|
ContentType: req.files.cinDoc.mimetype,
|
|
@@ -593,9 +593,9 @@ export async function getAuditConfiguration( req, res ) {
|
|
|
593
593
|
try {
|
|
594
594
|
const auditConfig = await auditConfigurationGet( { storeId: req.params?.id } );
|
|
595
595
|
if ( auditConfig ) {
|
|
596
|
-
const isDocExist = await checkFileExist( { Bucket:
|
|
596
|
+
const isDocExist = await checkFileExist( { Bucket: appConfig.cloud.aws.bucket.assets, Key: `templates/audit_bulk_update.xlsx` } );
|
|
597
597
|
if ( isDocExist ) {
|
|
598
|
-
const signedFilUrl = await signedUrl( { Bucket:
|
|
598
|
+
const signedFilUrl = await signedUrl( { Bucket: appConfig.cloud.aws.bucket.assets, file_path: `templates/audit_bulk_update.xlsx` } );
|
|
599
599
|
auditConfig._doc.templateUrl = signedFilUrl;
|
|
600
600
|
} else {
|
|
601
601
|
auditConfig._doc.templateUrl = '';
|
|
@@ -755,8 +755,8 @@ export async function clientList( req, res ) {
|
|
|
755
755
|
}
|
|
756
756
|
return list;
|
|
757
757
|
} );
|
|
758
|
-
const
|
|
759
|
-
clientList.flat();
|
|
758
|
+
const clientListResult = await Promise.all( promises );
|
|
759
|
+
const clientList= clientListResult.flat();
|
|
760
760
|
const storeQuery = [
|
|
761
761
|
{
|
|
762
762
|
$match: {
|
|
@@ -812,19 +812,19 @@ export async function clientList( req, res ) {
|
|
|
812
812
|
const list = [];
|
|
813
813
|
for ( let i = 0; i < chunk.length; i++ ) {
|
|
814
814
|
list.push( {
|
|
815
|
-
'client Name': chunk[i]
|
|
816
|
-
'client Id': chunk[i]
|
|
817
|
-
'Active Store': chunk[i]
|
|
818
|
-
'Active Camera': chunk[i]
|
|
819
|
-
'Payment Status': chunk[i]
|
|
820
|
-
'Subs Plan': chunk[i]
|
|
821
|
-
'Status': chunk[i]
|
|
815
|
+
'client Name': chunk[i]?.clientName,
|
|
816
|
+
'client Id': chunk[i]?.clientId,
|
|
817
|
+
'Active Store': chunk[i]?.activeStoreCount || 0,
|
|
818
|
+
'Active Camera': chunk[i]?.activeCameraCount && chunk[i]?.activeCameraCount!=undefined? chunk[i]?.activeCameraCount: 0,
|
|
819
|
+
'Payment Status': chunk[i]?.paymentStatus,
|
|
820
|
+
'Subs Plan': chunk[i]?.subscriptionType,
|
|
821
|
+
'Status': chunk[i]?.status,
|
|
822
822
|
} );
|
|
823
823
|
}
|
|
824
824
|
return list;
|
|
825
825
|
} );
|
|
826
|
-
const
|
|
827
|
-
exportResult.flat();
|
|
826
|
+
const temp = await Promise.all( promises );
|
|
827
|
+
const exportResult = temp.flat();
|
|
828
828
|
await download( exportResult, res );
|
|
829
829
|
return;
|
|
830
830
|
}
|