tango-app-api-client 3.0.15-dev → 3.0.16-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/index.js +2 -1
- package/package.json +4 -2
- package/src/controllers/client.controllers.js +155 -7
- package/src/docs/client.docs.js +520 -0
- package/src/routes/client.routes.js +82 -44
- package/src/service/authentication.service.js +5 -0
- package/src/service/tangoticket.service.js +6 -0
- package/src/service/userAssignedStore.service.js +6 -0
package/index.js
CHANGED
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.16-dev",
|
|
4
4
|
"description": "client",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -20,10 +20,12 @@
|
|
|
20
20
|
"express-fileupload": "^1.4.3",
|
|
21
21
|
"handlebars": "^4.7.8",
|
|
22
22
|
"joi": "^17.12.1",
|
|
23
|
+
"joi-to-swagger": "^6.2.0",
|
|
23
24
|
"lodash": "^4.17.21",
|
|
24
25
|
"mongodb": "^6.3.0",
|
|
25
26
|
"nodemon": "^3.0.3",
|
|
26
|
-
"
|
|
27
|
+
"swagger-ui-express": "^5.0.0",
|
|
28
|
+
"tango-api-schema": "^2.0.64",
|
|
27
29
|
"tango-app-api-middleware": "^1.0.49-dev",
|
|
28
30
|
"winston": "^3.11.0",
|
|
29
31
|
"winston-daily-rotate-file": "^5.0.0"
|
|
@@ -1,10 +1,13 @@
|
|
|
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';
|
|
1
|
+
import { billingDetailsUpdate, brandInfoUpdate, domainDetailsConfigurationUpdate, featureConfigurationUpdate, getClientData, signatoryDetailsUpdate, ticketConfigurationUpdate, documentsUpdate, getUserData, auditConfigurationUpdate, auditConfigurationGet, CsmUsersGet, OpsUsersGet, userConfigurationUpdate, findClient, aggregateClient, createAuditQueue, findOne, getClientCount, insert, update, findOneClient } from '../service/client.service.js';
|
|
2
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
|
-
import { aggregateStore
|
|
4
|
+
import { aggregateStore } from '../service/store.service.js';
|
|
5
5
|
import { aggregateCamera, countDocumentsCamera } from '../service/camera.service.js';
|
|
6
6
|
import _ from 'lodash';
|
|
7
7
|
import { findOneStandaredRole } from '../service/standaredRole.service.js';
|
|
8
|
+
import { aggregateUserAssignedStore } from '../service/userAssignedStore.service.js';
|
|
9
|
+
import { aggregateTickets } from '../service/tangoticket.service.js';
|
|
10
|
+
import { deleteOneAuthentication } from '../service/authentication.service.js';
|
|
8
11
|
|
|
9
12
|
export async function create( req, res ) {
|
|
10
13
|
try {
|
|
@@ -48,7 +51,7 @@ export async function create( req, res ) {
|
|
|
48
51
|
permission: getPermission?.permission,
|
|
49
52
|
clientId: String( tangoId ),
|
|
50
53
|
};
|
|
51
|
-
|
|
54
|
+
await deleteOneAuthentication( { user: user?._id, type: 'retail' } );
|
|
52
55
|
await findOneAndUpdateUser( userQuery, userRecord );
|
|
53
56
|
await createAuditQueue( generatedName );
|
|
54
57
|
return res.sendSuccess( { result: { clientId: String( tangoId ) } } );
|
|
@@ -86,10 +89,58 @@ export async function changeStatus( req, res, next ) {
|
|
|
86
89
|
export async function getClients( req, res ) {
|
|
87
90
|
try {
|
|
88
91
|
const field = { clientName: 1, clientId: 1 };
|
|
89
|
-
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
+
let result =[];
|
|
93
|
+
if ( req?.user?.role === 'superadmin' ) {
|
|
94
|
+
result = await findClient( {}, field );
|
|
95
|
+
} else {
|
|
96
|
+
const clientQuery =[
|
|
97
|
+
{
|
|
98
|
+
$match: {
|
|
99
|
+
userEmail: req?.user?.email,
|
|
100
|
+
assignedType: { $eq: 'client' },
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
$group: {
|
|
105
|
+
_id: null,
|
|
106
|
+
clientId: { $addToSet: '$assignedValue' },
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
$project: {
|
|
111
|
+
_id: 0,
|
|
112
|
+
clientId: 1,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
];
|
|
117
|
+
const clientList = await aggregateUserAssignedStore( clientQuery );
|
|
118
|
+
if ( clientList[0]?.clientId?.length == 0 ) {
|
|
119
|
+
return res.sendSuccess( { result: result } );
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const clientAggregate = [
|
|
123
|
+
{
|
|
124
|
+
$match: {
|
|
125
|
+
$and: [
|
|
126
|
+
{
|
|
127
|
+
clientId: { $in: clientList[0]?.clientId },
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
$project: {
|
|
134
|
+
_id: 0,
|
|
135
|
+
clientId: 1,
|
|
136
|
+
clientName: 1,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
];
|
|
140
|
+
const clients = await aggregateClient( clientAggregate );
|
|
141
|
+
return res.sendSuccess( { result: clients } );
|
|
92
142
|
}
|
|
143
|
+
|
|
93
144
|
return res.sendSuccess( { result: result } );
|
|
94
145
|
} catch ( error ) {
|
|
95
146
|
logger.error( { error: error, function: 'getClients' } );
|
|
@@ -709,6 +760,7 @@ export async function clientList( req, res ) {
|
|
|
709
760
|
clientId: 1,
|
|
710
761
|
subscriptionType: '$planDetails.subscriptionType',
|
|
711
762
|
paymentStatus: '$planDetails.paymentStatus',
|
|
763
|
+
createdAt: 1,
|
|
712
764
|
},
|
|
713
765
|
},
|
|
714
766
|
);
|
|
@@ -726,6 +778,14 @@ export async function clientList( req, res ) {
|
|
|
726
778
|
},
|
|
727
779
|
} );
|
|
728
780
|
}
|
|
781
|
+
|
|
782
|
+
clientQuery.push(
|
|
783
|
+
{
|
|
784
|
+
$sort: {
|
|
785
|
+
createdAt: -1,
|
|
786
|
+
},
|
|
787
|
+
} );
|
|
788
|
+
|
|
729
789
|
const clientCount = await aggregateClient( clientQuery );
|
|
730
790
|
if ( clientCount.length == 0 ) {
|
|
731
791
|
return res.sendError( { error: 'No Data Found' }, 204 );
|
|
@@ -747,6 +807,84 @@ export async function clientList( req, res ) {
|
|
|
747
807
|
);
|
|
748
808
|
}
|
|
749
809
|
const client = await aggregateClient( clientQuery );
|
|
810
|
+
for ( let i=0; i < client?.length; i++ ) {
|
|
811
|
+
const query = [
|
|
812
|
+
{
|
|
813
|
+
$match: {
|
|
814
|
+
'issueType': 'installation',
|
|
815
|
+
'basicDetails.clientId': client[i].clientId,
|
|
816
|
+
},
|
|
817
|
+
},
|
|
818
|
+
{
|
|
819
|
+
$group: {
|
|
820
|
+
_id: null,
|
|
821
|
+
onboarded: {
|
|
822
|
+
$sum: {
|
|
823
|
+
$cond: [
|
|
824
|
+
{ $eq: [ '$status', 'closed' ] },
|
|
825
|
+
1,
|
|
826
|
+
0,
|
|
827
|
+
],
|
|
828
|
+
},
|
|
829
|
+
},
|
|
830
|
+
pending: {
|
|
831
|
+
$sum: {
|
|
832
|
+
$cond: [
|
|
833
|
+
{
|
|
834
|
+
$and: [
|
|
835
|
+
{ $or: [ { $eq: [ '$status', 'open' ] }, { $eq: [ '$status', 'inprogress' ] } ] },
|
|
836
|
+
{ $eq: [ '$ticketDetails.issueStatus', 'notidentified' ] },
|
|
837
|
+
],
|
|
838
|
+
},
|
|
839
|
+
1,
|
|
840
|
+
0,
|
|
841
|
+
],
|
|
842
|
+
},
|
|
843
|
+
},
|
|
844
|
+
failed: {
|
|
845
|
+
$sum: {
|
|
846
|
+
$cond: [
|
|
847
|
+
{
|
|
848
|
+
$and: [
|
|
849
|
+
{ $or: [ { $eq: [ '$status', 'open' ] }, { $eq: [ '$status', 'inprogress' ] } ] },
|
|
850
|
+
{ $eq: [ '$ticketDetails.issueStatus', 'identified' ] },
|
|
851
|
+
],
|
|
852
|
+
},
|
|
853
|
+
1,
|
|
854
|
+
0,
|
|
855
|
+
],
|
|
856
|
+
},
|
|
857
|
+
},
|
|
858
|
+
},
|
|
859
|
+
},
|
|
860
|
+
{
|
|
861
|
+
'$project': {
|
|
862
|
+
'installedStores': { '$ifNull': [ '$onboarded', 0 ] },
|
|
863
|
+
'pendingStores': { '$ifNull': [ '$pending', 0 ] },
|
|
864
|
+
'failedStores': { '$ifNull': [ '$failed', 0 ] },
|
|
865
|
+
},
|
|
866
|
+
},
|
|
867
|
+
];
|
|
868
|
+
const ticket = await aggregateTickets( query );
|
|
869
|
+
|
|
870
|
+
const storesQuery = [
|
|
871
|
+
{
|
|
872
|
+
$match:
|
|
873
|
+
{
|
|
874
|
+
clientId: client[i].clientId,
|
|
875
|
+
},
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
$count:
|
|
879
|
+
'totalStores',
|
|
880
|
+
},
|
|
881
|
+
];
|
|
882
|
+
|
|
883
|
+
const storeCount = await aggregateStore( storesQuery );
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
client[i] = { ...client[i], ...ticket[0], ...storeCount[0] };
|
|
887
|
+
}
|
|
750
888
|
const clientListChunk = await chunkArray( client, 10 );
|
|
751
889
|
const promises = clientListChunk.map( async ( chunk ) => {
|
|
752
890
|
const list = [];
|
|
@@ -862,7 +1000,17 @@ export async function detailedClientCount( req, res ) {
|
|
|
862
1000
|
result['totalCameraCount'] = await countDocumentsCamera( { clientId: inputData.clientId } );
|
|
863
1001
|
result['totalUserCount'] = await countDocumentsUser( { clientId: inputData.clientId, userType: 'client' } );
|
|
864
1002
|
|
|
865
|
-
const
|
|
1003
|
+
const client = await findOneClient( { clientId: inputData.clientId }, { userId: 1, clientId: 1, profileDetails: 1 } );
|
|
1004
|
+
const user = await findOneUser( { _id: client.userId }, { userName: 1, email: 1 } );
|
|
1005
|
+
|
|
1006
|
+
const isLogoExist = await checkFileExist( { Bucket: appConfig.cloud.aws.bucket.assets, Key: `${client.clientId}/logo/${client.profileDetails?.logo}` } );
|
|
1007
|
+
|
|
1008
|
+
if ( isLogoExist ) {
|
|
1009
|
+
const signedFilUrl = await signedUrl( { Bucket: appConfig.cloud.aws.bucket.assets, file_path: `${client.clientId}/logo/${client.profileDetails?.logo}` } );
|
|
1010
|
+
result['logo'] = signedFilUrl;
|
|
1011
|
+
} else {
|
|
1012
|
+
result['logo'] = '';
|
|
1013
|
+
}
|
|
866
1014
|
result['userName'] = user?.userName;
|
|
867
1015
|
result['email'] = user?.email;
|
|
868
1016
|
result['profileCompletion'] = 70;
|
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
import j2s from 'joi-to-swagger';
|
|
2
|
+
|
|
3
|
+
import { activityLogSchema, auditConfigSchemaBody, billingDetailsSchemaBody, brandInfoSchemaBody, clientCreationSchema, clientListSchema, detailedClientCountSchema, documentsSchemaBody, domainDetailsSchemaBody, featureConfigurationSchemaBody, signatoryDetailsSchemaBody, ticketConfigurationSchemaBody, userConfigurationSchemaBody } from '../dtos/client.dtos.js';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export const clientDocs = {
|
|
7
|
+
|
|
8
|
+
'/v3/client/create': {
|
|
9
|
+
post: {
|
|
10
|
+
tags: [ 'Client' ],
|
|
11
|
+
description: 'lead appoved and create a new client',
|
|
12
|
+
operationId: 'create',
|
|
13
|
+
parameters: [ {
|
|
14
|
+
in: 'path',
|
|
15
|
+
name: 'id',
|
|
16
|
+
required: true,
|
|
17
|
+
schema: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
},
|
|
20
|
+
} ],
|
|
21
|
+
requestBody: {
|
|
22
|
+
content: {
|
|
23
|
+
'application/json': {
|
|
24
|
+
schema: j2s( clientCreationSchema ).swagger,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
responses: {
|
|
29
|
+
200: { description: 'Updated successfully' },
|
|
30
|
+
401: { description: 'Unauthorized User' },
|
|
31
|
+
422: { description: 'Field Error' },
|
|
32
|
+
500: { description: 'Server Error' },
|
|
33
|
+
204: { description: 'Not Found' },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
'/v3/client/get-clients': {
|
|
38
|
+
get: {
|
|
39
|
+
tags: [ 'Client' ],
|
|
40
|
+
description: 'Get list of clients',
|
|
41
|
+
operationId: 'get-clients',
|
|
42
|
+
parameters: [
|
|
43
|
+
{
|
|
44
|
+
in: 'path',
|
|
45
|
+
name: 'id',
|
|
46
|
+
required: true,
|
|
47
|
+
schema: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
responses: {
|
|
53
|
+
200: { description: 'Success' },
|
|
54
|
+
401: { description: 'Unauthorized User' },
|
|
55
|
+
422: { description: 'Field Error' },
|
|
56
|
+
500: { description: 'Server Error' },
|
|
57
|
+
204: { description: 'Not Found' },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
'/v3/client/client-details/{id}': {
|
|
62
|
+
get: {
|
|
63
|
+
tags: [ 'Client' ],
|
|
64
|
+
description: 'Get client details by client id',
|
|
65
|
+
operationId: 'get-client-details',
|
|
66
|
+
parameters: [
|
|
67
|
+
{
|
|
68
|
+
in: 'path',
|
|
69
|
+
name: 'id',
|
|
70
|
+
required: true,
|
|
71
|
+
description: 'The ID of the client.',
|
|
72
|
+
schema: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
responses: {
|
|
78
|
+
200: { description: 'Success' },
|
|
79
|
+
401: { description: 'Unauthorized User' },
|
|
80
|
+
422: { description: 'Field Error' },
|
|
81
|
+
500: { description: 'Server Error' },
|
|
82
|
+
204: { description: 'Not Found' },
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
'/v3/client/brand-info/{id}': {
|
|
88
|
+
put: {
|
|
89
|
+
tags: [ 'Client' ],
|
|
90
|
+
description: 'Update brand info settings',
|
|
91
|
+
operationId: 'update-brand-info',
|
|
92
|
+
parameters: [ {
|
|
93
|
+
in: 'path',
|
|
94
|
+
name: 'id',
|
|
95
|
+
required: true,
|
|
96
|
+
description: 'The ID of the client.',
|
|
97
|
+
schema: {
|
|
98
|
+
type: 'string',
|
|
99
|
+
},
|
|
100
|
+
} ],
|
|
101
|
+
requestBody: {
|
|
102
|
+
content: {
|
|
103
|
+
'application/json': {
|
|
104
|
+
schema: j2s( brandInfoSchemaBody ).swagger,
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
responses: {
|
|
109
|
+
200: { description: 'Updated successfully' },
|
|
110
|
+
401: { description: 'Unauthorized User' },
|
|
111
|
+
422: { description: 'Field Error' },
|
|
112
|
+
500: { description: 'Server Error' },
|
|
113
|
+
204: { description: 'Not Found' },
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
'/v3/client/billing-details/{id}': {
|
|
119
|
+
put: {
|
|
120
|
+
tags: [ 'Client' ],
|
|
121
|
+
description: 'Update billing details settings',
|
|
122
|
+
operationId: 'update-billing-details',
|
|
123
|
+
parameters: [ {
|
|
124
|
+
in: 'path',
|
|
125
|
+
name: 'id',
|
|
126
|
+
required: true,
|
|
127
|
+
description: 'The ID of the client.',
|
|
128
|
+
schema: {
|
|
129
|
+
type: 'string',
|
|
130
|
+
},
|
|
131
|
+
} ],
|
|
132
|
+
requestBody: {
|
|
133
|
+
content: {
|
|
134
|
+
'application/json': {
|
|
135
|
+
schema: j2s( billingDetailsSchemaBody ).swagger,
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
responses: {
|
|
140
|
+
200: { description: 'Updated successfully' },
|
|
141
|
+
401: { description: 'Unauthorized User' },
|
|
142
|
+
422: { description: 'Field Error' },
|
|
143
|
+
500: { description: 'Server Error' },
|
|
144
|
+
204: { description: 'Not Found' },
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
'/v3/client/signatory-details/{id}': {
|
|
150
|
+
put: {
|
|
151
|
+
tags: [ 'Client' ],
|
|
152
|
+
description: 'Signatory details settings',
|
|
153
|
+
operationId: 'update-signatory-details',
|
|
154
|
+
parameters: [ {
|
|
155
|
+
in: 'path',
|
|
156
|
+
name: 'id',
|
|
157
|
+
required: true,
|
|
158
|
+
description: 'The ID of the client.',
|
|
159
|
+
schema: {
|
|
160
|
+
type: 'string',
|
|
161
|
+
},
|
|
162
|
+
} ],
|
|
163
|
+
requestBody: {
|
|
164
|
+
content: {
|
|
165
|
+
'application/json': {
|
|
166
|
+
schema: j2s( signatoryDetailsSchemaBody ).swagger,
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
responses: {
|
|
171
|
+
200: { description: 'Updated successfully' },
|
|
172
|
+
401: { description: 'Unauthorized User' },
|
|
173
|
+
422: { description: 'Field Error' },
|
|
174
|
+
500: { description: 'Server Error' },
|
|
175
|
+
204: { description: 'Not Found' },
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
'/v3/client/ticket-configuration/{id}': {
|
|
181
|
+
put: {
|
|
182
|
+
tags: [ 'Client' ],
|
|
183
|
+
description: 'Ticket configuration settings',
|
|
184
|
+
operationId: 'update-ticket-configuration',
|
|
185
|
+
parameters: [ {
|
|
186
|
+
in: 'path',
|
|
187
|
+
name: 'id',
|
|
188
|
+
required: true,
|
|
189
|
+
description: 'The ID of the client.',
|
|
190
|
+
schema: {
|
|
191
|
+
type: 'string',
|
|
192
|
+
},
|
|
193
|
+
} ],
|
|
194
|
+
requestBody: {
|
|
195
|
+
content: {
|
|
196
|
+
'application/json': {
|
|
197
|
+
schema: j2s( ticketConfigurationSchemaBody ).swagger,
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
responses: {
|
|
202
|
+
200: { description: 'Updated successfully' },
|
|
203
|
+
401: { description: 'Unauthorized User' },
|
|
204
|
+
422: { description: 'Field Error' },
|
|
205
|
+
500: { description: 'Server Error' },
|
|
206
|
+
204: { description: 'Not Found' },
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
'/v3/client/feature-configuration/{id}': {
|
|
212
|
+
put: {
|
|
213
|
+
tags: [ 'Client' ],
|
|
214
|
+
description: 'Feature configuration settings',
|
|
215
|
+
operationId: 'update-feature-configuration',
|
|
216
|
+
parameters: [ {
|
|
217
|
+
in: 'path',
|
|
218
|
+
name: 'id',
|
|
219
|
+
required: true,
|
|
220
|
+
description: 'The ID of the client.',
|
|
221
|
+
schema: {
|
|
222
|
+
type: 'string',
|
|
223
|
+
},
|
|
224
|
+
} ],
|
|
225
|
+
requestBody: {
|
|
226
|
+
content: {
|
|
227
|
+
'application/json': {
|
|
228
|
+
schema: j2s( featureConfigurationSchemaBody ).swagger,
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
responses: {
|
|
233
|
+
200: { description: 'Updated successfully' },
|
|
234
|
+
401: { description: 'Unauthorized User' },
|
|
235
|
+
422: { description: 'Field Error' },
|
|
236
|
+
500: { description: 'Server Error' },
|
|
237
|
+
204: { description: 'Not Found' },
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
'/v3/client/domain-details/{id}': {
|
|
243
|
+
put: {
|
|
244
|
+
tags: [ 'Client' ],
|
|
245
|
+
description: 'Domain details settings',
|
|
246
|
+
operationId: 'update-domain-details',
|
|
247
|
+
parameters: [ {
|
|
248
|
+
in: 'path',
|
|
249
|
+
name: 'id',
|
|
250
|
+
required: true,
|
|
251
|
+
description: 'The ID of the client.',
|
|
252
|
+
schema: {
|
|
253
|
+
type: 'string',
|
|
254
|
+
},
|
|
255
|
+
} ],
|
|
256
|
+
requestBody: {
|
|
257
|
+
content: {
|
|
258
|
+
'application/json': {
|
|
259
|
+
schema: j2s( domainDetailsSchemaBody ).swagger,
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
responses: {
|
|
264
|
+
200: { description: 'Updated successfully' },
|
|
265
|
+
401: { description: 'Unauthorized User' },
|
|
266
|
+
422: { description: 'Field Error' },
|
|
267
|
+
500: { description: 'Server Error' },
|
|
268
|
+
204: { description: 'Not Found' },
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
'/v3/client/user-configuration/{id}': {
|
|
274
|
+
put: {
|
|
275
|
+
tags: [ 'Client' ],
|
|
276
|
+
description: 'User configuration settings',
|
|
277
|
+
operationId: 'update-user-configuration',
|
|
278
|
+
parameters: [ {
|
|
279
|
+
in: 'path',
|
|
280
|
+
name: 'id',
|
|
281
|
+
required: true,
|
|
282
|
+
description: 'The ID of the client.',
|
|
283
|
+
schema: {
|
|
284
|
+
type: 'string',
|
|
285
|
+
},
|
|
286
|
+
} ],
|
|
287
|
+
requestBody: {
|
|
288
|
+
content: {
|
|
289
|
+
'application/json': {
|
|
290
|
+
schema: j2s( userConfigurationSchemaBody ).swagger,
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
responses: {
|
|
295
|
+
200: { description: 'Updated successfully' },
|
|
296
|
+
401: { description: 'Unauthorized User' },
|
|
297
|
+
422: { description: 'Field Error' },
|
|
298
|
+
500: { description: 'Server Error' },
|
|
299
|
+
204: { description: 'Not Found' },
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
|
|
304
|
+
'/v3/client/documents/{id}': {
|
|
305
|
+
put: {
|
|
306
|
+
tags: [ 'Client' ],
|
|
307
|
+
description: 'Documents settings',
|
|
308
|
+
operationId: 'update-documents',
|
|
309
|
+
parameters: [ {
|
|
310
|
+
in: 'path',
|
|
311
|
+
name: 'id',
|
|
312
|
+
required: true,
|
|
313
|
+
description: 'The ID of the client.',
|
|
314
|
+
schema: {
|
|
315
|
+
type: 'string',
|
|
316
|
+
},
|
|
317
|
+
} ],
|
|
318
|
+
requestBody: {
|
|
319
|
+
content: {
|
|
320
|
+
'application/json': {
|
|
321
|
+
schema: j2s( documentsSchemaBody ).swagger,
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
responses: {
|
|
326
|
+
200: { description: 'Updated successfully' },
|
|
327
|
+
401: { description: 'Unauthorized User' },
|
|
328
|
+
422: { description: 'Field Error' },
|
|
329
|
+
500: { description: 'Server Error' },
|
|
330
|
+
204: { description: 'Not Found' },
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
|
|
335
|
+
'/v3/client/audit-configuration/{id}': {
|
|
336
|
+
get: {
|
|
337
|
+
tags: [ 'Client' ],
|
|
338
|
+
description: 'Get audit configuration by store id',
|
|
339
|
+
operationId: 'get-audit-configuration',
|
|
340
|
+
parameters: [
|
|
341
|
+
{
|
|
342
|
+
in: 'path',
|
|
343
|
+
name: 'id',
|
|
344
|
+
required: true,
|
|
345
|
+
description: 'The ID of the store.',
|
|
346
|
+
schema: {
|
|
347
|
+
type: 'string',
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
],
|
|
351
|
+
responses: {
|
|
352
|
+
200: { description: 'Success' },
|
|
353
|
+
401: { description: 'Unauthorized User' },
|
|
354
|
+
422: { description: 'Field Error' },
|
|
355
|
+
500: { description: 'Server Error' },
|
|
356
|
+
204: { description: 'Not Found' },
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
},
|
|
360
|
+
|
|
361
|
+
'/v3/client/audit-configuration/{id}': {
|
|
362
|
+
post: {
|
|
363
|
+
tags: [ 'Client' ],
|
|
364
|
+
description: 'Audit configuration settings',
|
|
365
|
+
operationId: 'update-audit-configuration',
|
|
366
|
+
parameters: [ {
|
|
367
|
+
in: 'path',
|
|
368
|
+
name: 'id',
|
|
369
|
+
required: true,
|
|
370
|
+
description: 'The ID of the store.',
|
|
371
|
+
schema: {
|
|
372
|
+
type: 'string',
|
|
373
|
+
},
|
|
374
|
+
} ],
|
|
375
|
+
requestBody: {
|
|
376
|
+
content: {
|
|
377
|
+
'application/json': {
|
|
378
|
+
schema: j2s( auditConfigSchemaBody ).swagger,
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
responses: {
|
|
383
|
+
200: { description: 'Updated successfully' },
|
|
384
|
+
401: { description: 'Unauthorized User' },
|
|
385
|
+
422: { description: 'Field Error' },
|
|
386
|
+
500: { description: 'Server Error' },
|
|
387
|
+
204: { description: 'Not Found' },
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
|
|
392
|
+
'/v3/client/get-csm-users': {
|
|
393
|
+
get: {
|
|
394
|
+
tags: [ 'Client' ],
|
|
395
|
+
description: 'Get csm users',
|
|
396
|
+
operationId: 'get-csm-users',
|
|
397
|
+
responses: {
|
|
398
|
+
200: { description: 'Success' },
|
|
399
|
+
401: { description: 'Unauthorized User' },
|
|
400
|
+
422: { description: 'Field Error' },
|
|
401
|
+
500: { description: 'Server Error' },
|
|
402
|
+
204: { description: 'Not Found' },
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
},
|
|
406
|
+
|
|
407
|
+
'/v3/client/get-ops-users': {
|
|
408
|
+
get: {
|
|
409
|
+
tags: [ 'Client' ],
|
|
410
|
+
description: 'Get ops users',
|
|
411
|
+
operationId: 'get-ops-users',
|
|
412
|
+
responses: {
|
|
413
|
+
200: { description: 'Success' },
|
|
414
|
+
401: { description: 'Unauthorized User' },
|
|
415
|
+
422: { description: 'Field Error' },
|
|
416
|
+
500: { description: 'Server Error' },
|
|
417
|
+
204: { description: 'Not Found' },
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
|
|
422
|
+
'/v3/client/activity-log/{id}': {
|
|
423
|
+
post: {
|
|
424
|
+
tags: [ 'Client' ],
|
|
425
|
+
description: 'Activity log',
|
|
426
|
+
operationId: 'activity-log',
|
|
427
|
+
parameters: [ {
|
|
428
|
+
in: 'path',
|
|
429
|
+
name: 'id',
|
|
430
|
+
required: true,
|
|
431
|
+
description: 'The ID of the client.',
|
|
432
|
+
schema: {
|
|
433
|
+
type: 'string',
|
|
434
|
+
},
|
|
435
|
+
} ],
|
|
436
|
+
requestBody: {
|
|
437
|
+
content: {
|
|
438
|
+
'application/json': {
|
|
439
|
+
schema: j2s( activityLogSchema ).swagger,
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
},
|
|
443
|
+
responses: {
|
|
444
|
+
200: { description: 'Success' },
|
|
445
|
+
401: { description: 'Unauthorized User' },
|
|
446
|
+
422: { description: 'Field Error' },
|
|
447
|
+
500: { description: 'Server Error' },
|
|
448
|
+
204: { description: 'Not Found' },
|
|
449
|
+
},
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
'/v3/client/detailed-all-client-count': {
|
|
453
|
+
get: {
|
|
454
|
+
tags: [ 'Client' ],
|
|
455
|
+
description: 'Get toatal info about overall clients',
|
|
456
|
+
operationId: 'detailed-all-client-count',
|
|
457
|
+
parameters: [
|
|
458
|
+
{
|
|
459
|
+
in: 'path',
|
|
460
|
+
name: 'id',
|
|
461
|
+
required: true,
|
|
462
|
+
schema: {
|
|
463
|
+
type: 'string',
|
|
464
|
+
},
|
|
465
|
+
},
|
|
466
|
+
],
|
|
467
|
+
responses: {
|
|
468
|
+
200: { description: 'Success' },
|
|
469
|
+
401: { description: 'Unauthorized User' },
|
|
470
|
+
422: { description: 'Field Error' },
|
|
471
|
+
500: { description: 'Server Error' },
|
|
472
|
+
204: { description: 'Not Found' },
|
|
473
|
+
},
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
'/v3/user/client-list': {
|
|
477
|
+
get: {
|
|
478
|
+
tags: [ 'Client' ],
|
|
479
|
+
description: `Get list of client Info`,
|
|
480
|
+
operationId: 'client-list',
|
|
481
|
+
parameters: [
|
|
482
|
+
{
|
|
483
|
+
in: 'query',
|
|
484
|
+
scema: j2s( clientListSchema ).swagger,
|
|
485
|
+
require: true,
|
|
486
|
+
},
|
|
487
|
+
],
|
|
488
|
+
responses: {
|
|
489
|
+
200: { description: `Success` },
|
|
490
|
+
401: { description: 'Unauthorized User' },
|
|
491
|
+
422: { description: 'Field Error' },
|
|
492
|
+
500: { description: 'Server Error' },
|
|
493
|
+
204: { description: 'Not Found' },
|
|
494
|
+
},
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
|
|
498
|
+
'/v3/user/detailed-client-count': {
|
|
499
|
+
get: {
|
|
500
|
+
tags: [ 'Client' ],
|
|
501
|
+
description: `Get a client overall Info`,
|
|
502
|
+
operationId: 'detailed-client-count',
|
|
503
|
+
parameters: [
|
|
504
|
+
{
|
|
505
|
+
in: 'query',
|
|
506
|
+
scema: j2s( detailedClientCountSchema ).swagger,
|
|
507
|
+
require: true,
|
|
508
|
+
},
|
|
509
|
+
],
|
|
510
|
+
responses: {
|
|
511
|
+
200: { description: `Success` },
|
|
512
|
+
401: { description: 'Unauthorized User' },
|
|
513
|
+
422: { description: 'Field Error' },
|
|
514
|
+
500: { description: 'Server Error' },
|
|
515
|
+
204: { description: 'Not Found' },
|
|
516
|
+
},
|
|
517
|
+
},
|
|
518
|
+
},
|
|
519
|
+
|
|
520
|
+
};
|
|
@@ -9,50 +9,88 @@ import { detailedAllClientCount, detailedClientCount, clientList } from '../cont
|
|
|
9
9
|
|
|
10
10
|
export const clientRouter = express.Router();
|
|
11
11
|
|
|
12
|
-
clientRouter.post( '/create', isAllowedSessionHandler,
|
|
13
|
-
|
|
12
|
+
clientRouter.post( '/create', isAllowedSessionHandler,
|
|
13
|
+
authorize( { userType: [ 'tango' ], access: [ { featureName: 'manage', name: 'brands', permissions: [ 'isEdit' ] } ] } ),
|
|
14
|
+
validate( clientCreationValid ), isclientNameExists, changeStatus, create );
|
|
15
|
+
clientRouter.get( '/get-clients', isAllowedSessionHandler,
|
|
16
|
+
authorize( { userType: [ 'tango' ] } ), getClients );
|
|
14
17
|
clientRouter.get( '/client-details/:id', isAllowedSessionHandler, validate( clientDetailsValid ), clientDetails );
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
clientRouter.put( '/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
clientRouter.put( '/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
clientRouter.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
18
|
+
|
|
19
|
+
clientRouter.put( '/brand-info/:id', isAllowedSessionHandler, authorize(
|
|
20
|
+
{ userType: [ 'tango', 'client' ], access: [
|
|
21
|
+
{ featureName: 'settings', name: 'brandDetails', permissions: [ 'isEdit' ] } ] } ),
|
|
22
|
+
validate( brandInfoValid ), updateBrandInfo );
|
|
23
|
+
|
|
24
|
+
clientRouter.put( '/billing-details/:id', isAllowedSessionHandler, authorize(
|
|
25
|
+
{ userType: [ 'tango', 'client' ], access: [
|
|
26
|
+
{ featureName: 'settings', name: 'brandDetails', permissions: [ 'isEdit' ] } ] } ),
|
|
27
|
+
validate( billingDetailsValid ), updateBillingDetails );
|
|
28
|
+
|
|
29
|
+
clientRouter.put( '/signatory-details/:id', isAllowedSessionHandler, authorize(
|
|
30
|
+
{ userType: [ 'tango', 'client' ], access: [
|
|
31
|
+
{ featureName: 'settings', name: 'brandDetails', permissions: [ 'isEdit' ] } ] } ),
|
|
32
|
+
validate( signatoryDetailsValid ), updateSignatoryDetails );
|
|
33
|
+
|
|
34
|
+
clientRouter.put( '/ticket-configuration/:id', isAllowedSessionHandler, authorize(
|
|
35
|
+
{ userType: [ 'tango' ], access: [
|
|
36
|
+
{ featureName: 'settings', name: 'configuration', permissions: [ 'isEdit' ] } ] } ),
|
|
37
|
+
validate( ticketConfigurationValid ), updateTicketConfiguration );
|
|
38
|
+
|
|
39
|
+
clientRouter.put( '/feature-configuration/:id', isAllowedSessionHandler, authorize(
|
|
40
|
+
{ userType: [ 'tango' ], access: [
|
|
41
|
+
{ featureName: 'settings', name: 'configuration', permissions: [ 'isEdit' ] } ] } ),
|
|
42
|
+
validate( featureConfigurationValid ), updateFeatureConfiguration );
|
|
43
|
+
|
|
44
|
+
clientRouter.put( '/domain-details/:id', isAllowedSessionHandler, authorize(
|
|
45
|
+
{ userType: [ 'tango', 'client' ], access: [
|
|
46
|
+
{ featureName: 'settings', name: 'configuration', permissions: [ 'isEdit' ] } ] } ),
|
|
47
|
+
validate( domainDetailsValid ), domainDetailsConfiguration );
|
|
48
|
+
|
|
49
|
+
clientRouter.put( '/user-configuration/:id', isAllowedSessionHandler, authorize(
|
|
50
|
+
{ userType: [ 'tango' ], access: [
|
|
51
|
+
{ featureName: 'settings', name: 'configuration', permissions: [ 'isEdit' ] } ] } ),
|
|
52
|
+
validate( userConfigurationValid ), userConfiguration );
|
|
53
|
+
|
|
54
|
+
clientRouter.put( '/documents/:id', isAllowedSessionHandler, authorize(
|
|
55
|
+
{ userType: [ 'tango', 'client' ], access: [
|
|
56
|
+
{ featureName: 'settings', name: 'documents', permissions: [ 'isEdit' ] } ] } ),
|
|
57
|
+
validate( documentsValid ), updateDocuments );
|
|
58
|
+
|
|
59
|
+
clientRouter.get( '/audit-configuration/:id', isAllowedSessionHandler, authorize(
|
|
60
|
+
{ userType: [ 'tango' ], access: [
|
|
61
|
+
{ featureName: 'settings', name: 'configuration', permissions: [ 'isView' ] } ] } ),
|
|
62
|
+
validate( getAuditConfigValid ), getAuditConfiguration );
|
|
63
|
+
|
|
64
|
+
clientRouter.post( '/audit-configuration/:id', isAllowedSessionHandler, authorize(
|
|
65
|
+
{ userType: [ 'tango' ], access: [
|
|
66
|
+
{ featureName: 'settings', name: 'configuration', permissions: [ 'isEdit' ] } ] } ),
|
|
67
|
+
validate( auditConfigValid ), auditConfiguration );
|
|
68
|
+
|
|
69
|
+
clientRouter.get( '/get-csm-users', isAllowedSessionHandler, authorize(
|
|
70
|
+
{ userType: [ 'tango' ], access: [
|
|
71
|
+
{ featureName: 'settings', name: 'configuration', permissions: [ 'isView' ] } ] } ),
|
|
72
|
+
getCsmUsers );
|
|
73
|
+
|
|
74
|
+
clientRouter.get( '/get-ops-users', isAllowedSessionHandler, authorize(
|
|
75
|
+
{ userType: [ 'tango' ], access: [
|
|
76
|
+
{ featureName: 'settings', name: 'configuration', permissions: [ 'isView' ] } ] } ),
|
|
77
|
+
getOpsUsers );
|
|
78
|
+
|
|
79
|
+
clientRouter.get( '/detailed-all-client-count', isAllowedSessionHandler,
|
|
80
|
+
authorize( { userType: [ 'tango' ] } ),
|
|
81
|
+
detailedAllClientCount );
|
|
82
|
+
|
|
83
|
+
clientRouter.post( '/client-list', isAllowedSessionHandler,
|
|
84
|
+
authorize( { userType: [ 'tango' ], access: [ { featureName: 'manage', name: 'brands', permissions: [ 'isView' ] } ] } ),
|
|
85
|
+
validate( clientListValid ), clientList );
|
|
86
|
+
|
|
87
|
+
clientRouter.get( '/detailed-client-count', isAllowedSessionHandler,
|
|
88
|
+
authorize( { userType: [ 'tango', 'client' ] } ),
|
|
89
|
+
validate( detailedClientCountValid ), isclientIdExists, detailedClientCount );
|
|
90
|
+
|
|
91
|
+
clientRouter.post( '/activity-log', isAllowedSessionHandler, authorize(
|
|
92
|
+
{ userType: [ 'tango', 'client' ], access: [
|
|
93
|
+
{ featureName: 'settings', name: 'activityLog', permissions: [ 'isView' ] } ] } ),
|
|
94
|
+
validate( activityLogValid ), getActivityLogs );
|
|
57
95
|
|
|
58
96
|
|