tango-app-api-audit 3.5.17 → 3.5.18

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.
@@ -1,5 +1,5 @@
1
1
  import j2s from 'joi-to-swagger';
2
- import { getListSchema, getFileSchema, getFileHistorySchema, userAuditedDataSchema, viewFileSchema, saveSchema, cancelSchema } from '../dtos/eyeTestAudit.dtos.js';
2
+ import { getListSchema, getFileSchema, getFileHistorySchema, userAuditedDataSchema, viewFileSchema, saveSchema, cancelSchema, summaryCardSchema, getUserConfigSchema, rmListSchema, updateUserConfigParamsSchema, updateUserConfigSchema, updateEmailConfigParamaSchema, updateEmailConfigSchema, getEmailConfigSchema, summaryListSchema, emailAlertLogSchema } from '../dtos/eyeTestAudit.dtos.js';
3
3
 
4
4
  export const eyeTestAuditDocs = {
5
5
 
@@ -160,4 +160,196 @@ export const eyeTestAuditDocs = {
160
160
  },
161
161
  },
162
162
  },
163
+ '/v3/eye-test-audit/summary-list': {
164
+ post: {
165
+ tags: [ 'Eye Test Audit' ],
166
+ description: 'Eye test audit report',
167
+ operationId: 'summary-list',
168
+ requestBody: {
169
+ content: {
170
+ 'application/json': {
171
+ schema: j2s( summaryListSchema ).swagger,
172
+ },
173
+ },
174
+ },
175
+ responses: {
176
+ 200: { description: 'Successful' },
177
+ 401: { description: 'Unauthorized User' },
178
+ 422: { description: 'Field Error' },
179
+ 500: { description: 'Server Error' },
180
+ 204: { description: 'Not Found' },
181
+ },
182
+ },
183
+ },
184
+ '/v3/eye-test-audit/email-alert-log': {
185
+ post: {
186
+ tags: [ 'Eye Test Audit' ],
187
+ description: 'logs of email alert against of optum',
188
+ operationId: 'email-alert-log',
189
+ requestBody: {
190
+ content: {
191
+ 'application/json': {
192
+ schema: j2s( emailAlertLogSchema ).swagger,
193
+ },
194
+ },
195
+ },
196
+ responses: {
197
+ 200: { description: 'Successful' },
198
+ 401: { description: 'Unauthorized User' },
199
+ 422: { description: 'Field Error' },
200
+ 500: { description: 'Server Error' },
201
+ 204: { description: 'Not Found' },
202
+ },
203
+ },
204
+ },
205
+
206
+ '/v3/eye-test-audit/summary-card': {
207
+ post: {
208
+ tags: [ 'Eye Test Audit' ],
209
+ description: 'Eye test audit overview by counts',
210
+ operationId: 'summary-card',
211
+ requestBody: {
212
+ content: {
213
+ 'application/json': {
214
+ schema: j2s( summaryCardSchema ).swagger,
215
+ },
216
+ },
217
+ },
218
+ responses: {
219
+ 200: { description: 'Successful' },
220
+ 401: { description: 'Unauthorized User' },
221
+ 422: { description: 'Field Error' },
222
+ 500: { description: 'Server Error' },
223
+ 204: { description: 'Not Found' },
224
+ },
225
+ },
226
+ },
227
+ '/v3/eye-test-audit/get-user-config': {
228
+ get: {
229
+ tags: [ 'Eye Test Audit' ],
230
+ description: `Get regional manager list`,
231
+ operationId: 'get-user-config',
232
+ parameters: [
233
+ {
234
+ in: 'query',
235
+ name: 'clientId',
236
+ scema: j2s( getUserConfigSchema ).swagger,
237
+ require: false,
238
+ },
239
+ ],
240
+ responses: {
241
+ 200: { description: 'Successful' },
242
+ 401: { description: 'Unauthorized User' },
243
+ 422: { description: 'Field Error' },
244
+ 500: { description: 'Server Error' },
245
+ 204: { description: 'Not Found' },
246
+ },
247
+ },
248
+ },
249
+
250
+ '/v3/eye-test-audit/rm-list': {
251
+ get: {
252
+ tags: [ 'Eye Test Audit' ],
253
+ description: `Get regional manager list`,
254
+ operationId: 'rm-list',
255
+ parameters: [
256
+ {
257
+ in: 'query',
258
+ name: 'clientId',
259
+ scema: j2s( rmListSchema ).swagger,
260
+ require: false,
261
+ },
262
+ ],
263
+ responses: {
264
+ 200: { description: 'Successful' },
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/eye-test-audit/update-user-config': {
274
+ put: {
275
+ tags: [ 'Eye Test Audit' ],
276
+ description: `Update user list`,
277
+ operationId: 'get-user-config',
278
+ parameters: [
279
+ {
280
+ in: 'query',
281
+ name: '_id',
282
+ scema: j2s( updateUserConfigParamsSchema ).swagger,
283
+ require: false,
284
+ },
285
+ ],
286
+ requestBody: {
287
+ content: {
288
+ 'application/json': {
289
+ schema: j2s( updateUserConfigSchema ).swagger,
290
+ },
291
+ },
292
+ },
293
+ responses: {
294
+ 200: { description: 'Successful' },
295
+ 401: { description: 'Unauthorized User' },
296
+ 422: { description: 'Field Error' },
297
+ 500: { description: 'Server Error' },
298
+ 204: { description: 'Not Found' },
299
+ },
300
+ },
301
+ },
302
+
303
+ '/v3/eye-test-audit/get-email-config': {
304
+ get: {
305
+ tags: [ 'Eye Test Audit' ],
306
+ description: `Get email configuration`,
307
+ operationId: 'get-email-config',
308
+ parameters: [
309
+ {
310
+ in: 'query',
311
+ name: 'clientId',
312
+ scema: j2s( getEmailConfigSchema ).swagger,
313
+ require: false,
314
+ },
315
+ ],
316
+ responses: {
317
+ 200: { description: 'Successful' },
318
+ 401: { description: 'Unauthorized User' },
319
+ 422: { description: 'Field Error' },
320
+ 500: { description: 'Server Error' },
321
+ 204: { description: 'Not Found' },
322
+ },
323
+ },
324
+ },
325
+
326
+ '/v3/eye-test-audit/update-email-config': {
327
+ put: {
328
+ tags: [ 'Eye Test Audit' ],
329
+ description: `Update email configuration`,
330
+ operationId: 'update-email-config',
331
+ parameters: [
332
+ {
333
+ in: 'query',
334
+ name: '_id',
335
+ scema: j2s( updateEmailConfigParamaSchema ).swagger,
336
+ require: false,
337
+ },
338
+ ],
339
+ requestBody: {
340
+ content: {
341
+ 'application/json': {
342
+ schema: j2s( updateEmailConfigSchema ).swagger,
343
+ },
344
+ },
345
+ },
346
+ responses: {
347
+ 200: { description: 'Successful' },
348
+ 401: { description: 'Unauthorized User' },
349
+ 422: { description: 'Field Error' },
350
+ 500: { description: 'Server Error' },
351
+ 204: { description: 'Not Found' },
352
+ },
353
+ },
354
+ },
163
355
  };
@@ -1,4 +1,5 @@
1
1
  import joi from 'joi';
2
+ import dayjs from 'dayjs';
2
3
 
3
4
  export const getListSchema = joi.object(
4
5
  {
@@ -95,4 +96,290 @@ export const userAuditedDataValid = {
95
96
  params: userAuditedDataSchema,
96
97
  };
97
98
 
99
+ export const summaryListSchema = joi.object( {
100
+ keyType: joi.string()
101
+ .valid( 'rm', 'cluster', 'store' )
102
+ .required()
103
+ .messages( {
104
+ 'any.only': 'Please give a valid key type',
105
+ 'any.required': 'keyType is required',
106
+ } ),
107
+ fromDate: joi.string()
108
+ .pattern( /^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD format' )
109
+ .required()
110
+ .messages( {
111
+ 'string.pattern.name': `'fromDate' must be in the format YYYY-MM-DD (e.g., 2025-07-19).`,
112
+ 'string.empty': `'fromDate' is required.`,
113
+ } )
114
+ .custom( ( value, helpers ) => {
115
+ const from = dayjs( value );
116
+ if ( !from.isValid() ) {
117
+ return helpers.error( 'any.invalid', { message: 'Invalid fromDate' } );
118
+ }
119
+ return value;
120
+ } ),
121
+
122
+ toDate: joi.string()
123
+ .pattern( /^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD format' )
124
+ .required()
125
+ .messages( {
126
+ 'string.pattern.name': `'toDate' must be in the format YYYY-MM-DD (e.g., 2025-07-19).`,
127
+ 'string.empty': `'toDate' is required.`,
128
+ } )
129
+ .custom( ( value, helpers ) => {
130
+ const to = dayjs( value );
131
+ const today = dayjs();
132
+
133
+ if ( !to.isValid() ) {
134
+ return helpers.error( 'any.invalid', { message: 'Invalid toDate' } );
135
+ }
136
+ if ( to.isAfter( today, 'day' ) ) {
137
+ return helpers.error( 'any.invalid', { message: 'toDate cannot be in the future' } );
138
+ }
139
+
140
+ return value;
141
+ } ),
142
+ type: joi.string().required().messages( {
143
+ 'any.required': 'Type is required',
144
+ 'string.empty': 'Type cannot be empty',
145
+ } ),
146
+ demographics: joi.array().optional(),
147
+ RMList: joi.array().items(
148
+ joi.object( {
149
+ email: joi.string().required(),
150
+ _id: joi.string().required(),
151
+ } ).required(),
152
+ ).optional(),
153
+ storeId: joi.array().items( joi.string().required() ).required(),
154
+ complianceScore: joi.number().optional().allow( null ),
155
+ nearAddition: joi.string().optional().allow( '' ),
156
+ isExport: joi.boolean().optional(),
157
+ searchValue: joi.string().optional().allow( '' ),
158
+ sortBy: joi.string().optional(),
159
+ sortOrder: joi.number().optional(),
160
+ } );
161
+
162
+ export const summaryListValid = {
163
+ body: summaryListSchema,
164
+ };
165
+
166
+
167
+ export const summaryCardSchema = joi.object( {
168
+
169
+ fromDate: joi.string()
170
+ .pattern( /^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD format' )
171
+ .required()
172
+ .messages( {
173
+ 'string.pattern.name': `'fromDate' must be in the format YYYY-MM-DD (e.g., 2025-07-19).`,
174
+ 'string.empty': `'fromDate' is required.`,
175
+ } )
176
+ .custom( ( value, helpers ) => {
177
+ const from = dayjs( value );
178
+ if ( !from.isValid() ) {
179
+ return helpers.error( 'any.invalid', { message: 'Invalid fromDate' } );
180
+ }
181
+ return value;
182
+ } ),
183
+
184
+ toDate: joi.string()
185
+ .pattern( /^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD format' )
186
+ .required()
187
+ .messages( {
188
+ 'string.pattern.name': `'toDate' must be in the format YYYY-MM-DD (e.g., 2025-07-19).`,
189
+ 'string.empty': `'toDate' is required.`,
190
+ } )
191
+ .custom( ( value, helpers ) => {
192
+ const to = dayjs( value );
193
+ const today = dayjs();
194
+
195
+ if ( !to.isValid() ) {
196
+ return helpers.error( 'any.invalid', { message: 'Invalid toDate' } );
197
+ }
198
+ if ( to.isAfter( today, 'day' ) ) {
199
+ return helpers.error( 'any.invalid', { message: 'toDate cannot be in the future' } );
200
+ }
98
201
 
202
+ return value;
203
+ } ),
204
+ type: joi.string().required().messages( {
205
+ 'any.required': 'Type is required',
206
+ 'string.empty': 'Type cannot be empty',
207
+ } ),
208
+ demographics: joi.array().optional(),
209
+ // RMList: joi.array().items(
210
+ // joi.object( {
211
+ // email: joi.string().required(),
212
+ // _id: joi.string().required(),
213
+ // } ).required(),
214
+ // ).optional(),
215
+ storeId: joi.array().items( joi.string().required() ).required(),
216
+ complianceScore: joi.number().optional().allow( null ),
217
+ nearAddition: joi.string().optional().allow( '' ),
218
+ category: joi.string().optional() .valid( 'fake', 'genuine' ),
219
+ } );
220
+
221
+ export const summaryCardValid = {
222
+ body: summaryCardSchema,
223
+ };
224
+
225
+
226
+ export const emailAlertLogSchema = joi.object( {
227
+ fromDate: joi.string()
228
+ .pattern( /^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD format' )
229
+ .required()
230
+ .messages( {
231
+ 'string.pattern.name': `'fromDate' must be in the format YYYY-MM-DD (e.g., 2025-07-19).`,
232
+ 'string.empty': `'fromDate' is required.`,
233
+ } )
234
+ .custom( ( value, helpers ) => {
235
+ const from = dayjs( value );
236
+ if ( !from.isValid() ) {
237
+ return helpers.error( 'any.invalid', { message: 'Invalid fromDate' } );
238
+ }
239
+ return value;
240
+ } ),
241
+
242
+ toDate: joi.string()
243
+ .pattern( /^\d{4}-\d{2}-\d{2}$/, 'YYYY-MM-DD format' )
244
+ .required()
245
+ .messages( {
246
+ 'string.pattern.name': `'toDate' must be in the format YYYY-MM-DD (e.g., 2025-07-19).`,
247
+ 'string.empty': `'toDate' is required.`,
248
+ } )
249
+ .custom( ( value, helpers ) => {
250
+ const to = dayjs( value );
251
+ const today = dayjs();
252
+
253
+ if ( !to.isValid() ) {
254
+ return helpers.error( 'any.invalid', { message: 'Invalid toDate' } );
255
+ }
256
+ if ( to.isAfter( today, 'day' ) ) {
257
+ return helpers.error( 'any.invalid', { message: 'toDate cannot be in the future' } );
258
+ }
259
+
260
+ return value;
261
+ } ),
262
+ type: joi.string().required().messages( {
263
+ 'any.required': 'Type is required',
264
+ 'string.empty': 'Type cannot be empty',
265
+ } ),
266
+ RMList: joi.array().items(
267
+ joi.object( {
268
+ email: joi.string().required(),
269
+ _id: joi.string().required(),
270
+ } ).required(),
271
+ ).optional(),
272
+ clientId: joi.string().when( '$userType', {
273
+ is: 'tango',
274
+ then: joi.required().messages( {
275
+ 'any.required': 'clientId is required',
276
+ 'string.base': 'clientId must be a string',
277
+ } ),
278
+ otherwise: joi.optional(),
279
+ } ),
280
+ cluster: joi.array().items( joi.string().required() ).required(),
281
+ isExport: joi.boolean().optional(),
282
+ searchValue: joi.string().optional().allow( '' ),
283
+ sortBy: joi.string().optional(),
284
+ sortOrder: joi.number().optional(),
285
+ } );
286
+
287
+ export const emailAlertLogValid = {
288
+ body: emailAlertLogSchema,
289
+ };
290
+
291
+ export const getUserConfigSchema = joi.object( {
292
+ clientId: joi.string().when( '$userType', {
293
+ is: 'tango',
294
+ then: joi.required().messages( {
295
+ 'any.required': 'clientId is required',
296
+ 'string.base': 'clientId must be a string',
297
+ } ),
298
+ otherwise: joi.optional(),
299
+ } ),
300
+ } );
301
+
302
+ export const getUserConfigValid = {
303
+ query: getUserConfigSchema,
304
+ };
305
+
306
+ export const rmListSchema = joi.object( {
307
+ clientId: joi.string().when( '$userType', {
308
+ is: 'tango',
309
+ then: joi.required().messages( {
310
+ 'any.required': 'clientId is required',
311
+ 'string.base': 'clientId must be a string',
312
+ } ),
313
+ otherwise: joi.optional(),
314
+ } ),
315
+ } );
316
+
317
+ export const rmListValid = {
318
+ query: rmListSchema,
319
+ };
320
+
321
+ export const updateUserConfigSchema = joi.object( {
322
+ clientId: joi.string().when( '$userType', {
323
+ is: 'tango',
324
+ then: joi.required().messages( {
325
+ 'any.required': 'clientId is required',
326
+ 'string.base': 'clientId must be a string',
327
+ } ),
328
+ otherwise: joi.optional(),
329
+ } ),
330
+ userList: joi.array().items( joi.object( {
331
+ _id: joi.string().required(),
332
+ email: joi.string().required() } ) ).required(),
333
+ } );
334
+
335
+ export const updateUserConfigParamsSchema = joi.object( {
336
+ _id: joi.string().optional(),
337
+ } );
338
+
339
+ export const updateUserConfigValid = {
340
+ body: updateUserConfigSchema,
341
+ query: updateUserConfigParamsSchema,
342
+ };
343
+
344
+
345
+ export const updateEmailConfigSchema = joi.object( {
346
+
347
+ clientId: joi.string().when( '$userType', {
348
+ is: 'tango',
349
+ then: joi.required().messages( {
350
+ 'any.required': 'clientId is required',
351
+ 'string.base': 'clientId must be a string',
352
+ } ),
353
+ otherwise: joi.optional(),
354
+ } ),
355
+ complianceThreshold: joi.object( {
356
+ condition: joi.string().valid( '>', '>=', '<=', '<', '=' ).required(),
357
+ value: joi.string().required(),
358
+ } ),
359
+ } );
360
+
361
+ export const updateEmailConfigParamaSchema = joi.object( {
362
+
363
+ _id: joi.string().required(),
364
+ } );
365
+
366
+ export const updateEmailConfigValid = {
367
+ body: updateEmailConfigSchema,
368
+ query: updateEmailConfigParamaSchema,
369
+ };
370
+
371
+
372
+ export const getEmailConfigSchema = joi.object( {
373
+ clientId: joi.string().when( '$userType', {
374
+ is: 'tango',
375
+ then: joi.required().messages( {
376
+ 'any.required': 'clientId is required',
377
+ 'string.base': 'clientId must be a string',
378
+ } ),
379
+ otherwise: joi.optional(),
380
+ } ),
381
+ } );
382
+
383
+ export const getEmailConfigValid = {
384
+ query: getEmailConfigSchema,
385
+ };
@@ -1,8 +1,9 @@
1
1
  import { Router } from 'express';
2
2
  import { isAllowedSessionHandler, validate } from 'tango-app-api-middleware';
3
3
  import { accessVerification } from 'tango-app-api-middleware';
4
- import { cancelValid, getFileHistoryValid, getFileValid, getListValid, saveValid, userAuditedDataValid, viewFileValid } from '../dtos/eyeTestAudit.dtos.js';
5
- import { cancel, getFile, getFileHistory, getList, save, userAuditedData, viewFile } from '../controllers/eyeTestAudit.controllers.js';
4
+ import { cancelValid, emailAlertLogValid, getEmailConfigValid, getFileHistoryValid, getFileValid, getListValid, getUserConfigValid, rmListValid, saveValid, summaryCardValid, summaryListValid, updateEmailConfigValid, updateUserConfigValid, userAuditedDataValid, viewFileValid } from '../dtos/eyeTestAudit.dtos.js';
5
+ import { addUserConfig, cancel, emailAlertLog, getEmailConfig, getFile, getFileHistory, getList, getUserConfig, rmList, save, summaryCard, summaryList, updateEmailConfig, updateEmailConfig1, updateUserConfig, userAuditedData, viewFile } from '../controllers/eyeTestAudit.controllers.js';
6
+ import { isSuperAdmin, roleValidation } from '../validation/eyeTest.validation.js';
6
7
 
7
8
  export const eyeTestAuditRouter = Router();
8
9
 
@@ -14,5 +15,22 @@ eyeTestAuditRouter.post( '/cancel', isAllowedSessionHandler, accessVerification(
14
15
  eyeTestAuditRouter.get( '/get-file-history/:id/:type', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), validate( getFileHistoryValid ), getFileHistory );
15
16
  eyeTestAuditRouter.get( '/user-audited-data/:id', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), validate( userAuditedDataValid ), userAuditedData );
16
17
 
18
+ // enhancement of aug of 2025
19
+
20
+ eyeTestAuditRouter.post( '/summary-list', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), validate( summaryListValid ), roleValidation, summaryList );
21
+ eyeTestAuditRouter.post( '/summary-card', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), validate( summaryCardValid ), summaryCard );
22
+ eyeTestAuditRouter.post( '/email-alert-log', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), isSuperAdmin, validate( emailAlertLogValid ), emailAlertLog );
23
+
24
+ // setting
25
+ eyeTestAuditRouter.get( '/get-user-config', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), validate( getUserConfigValid ), getUserConfig );
26
+ eyeTestAuditRouter.put( '/update-user-config', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), isSuperAdmin, validate( updateUserConfigValid ), addUserConfig, updateUserConfig );
27
+
28
+ eyeTestAuditRouter.get( '/rm-list', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), isSuperAdmin, validate( rmListValid ), rmList );
29
+ eyeTestAuditRouter.get( '/get-email-config', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), isSuperAdmin, validate( getEmailConfigValid ), getEmailConfig );
30
+ eyeTestAuditRouter.put( '/update-email-config', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ] } ), validate( updateEmailConfigValid ), updateEmailConfig );
31
+
32
+
33
+ eyeTestAuditRouter.put( '/temp', updateEmailConfig1 );
34
+
17
35
 
18
36
  export default eyeTestAuditRouter;
@@ -0,0 +1,6 @@
1
+ import clusterModel from 'tango-api-schema/schema/cluster.model';
2
+
3
+
4
+ export function aggregateClusters( query ) {
5
+ return clusterModel.aggregate( query, { collation: { locale: 'en', strength: 2 } } );
6
+ }
@@ -0,0 +1,9 @@
1
+ import eyeTestConfigurationModel from 'tango-api-schema/schema/eyeTestConfiguration.model.js';
2
+
3
+ export function updateOneEyeTestConfig( query, record, upsert ) {
4
+ return eyeTestConfigurationModel.updateOne( query, { $set: record }, upsert );
5
+ }
6
+
7
+ export function findOneEyeTestConfig( query, field ) {
8
+ return eyeTestConfigurationModel.findOne( query, field );
9
+ }
@@ -0,0 +1,39 @@
1
+ import { logger } from 'tango-app-api-middleware';
2
+
3
+ export async function roleValidation( req, res, next ) {
4
+ try {
5
+ const userRole = req?.user?.role;
6
+ switch ( userRole ) {
7
+ case 'user':
8
+ delete req?.body?.RMList;
9
+ break;
10
+ case 'admin':
11
+ delete req?.body?.RMList;
12
+ break;
13
+ case 'superadmin':
14
+ break;
15
+ default: return res.sendError( 'forbidden to access: you must be User or Admin or Super Admin', 403 );
16
+ }
17
+ next();
18
+ return;
19
+ } catch ( error ) {
20
+ logger.error( { error: error, message: req.query, function: 'roleValidation' } );
21
+ return res.sendError( error, 500 );
22
+ }
23
+ }
24
+
25
+ export async function isSuperAdmin( req, res, next ) {
26
+ try {
27
+ logger.info( { userType: req?.user?.userType } );
28
+ if ( req?.user?.role == 'superadmin' ) {
29
+ next();
30
+ return;
31
+ } else {
32
+ return res.sendError( 'forbidden this action', 403 );
33
+ }
34
+ } catch ( error ) {
35
+ logger.error( { error: error, message: req.query, function: 'isSuperAdmin' } );
36
+ return res.sendError( error, 500 );
37
+ }
38
+ }
39
+