tango-app-api-trax 3.2.1 → 3.3.1-airtel-1
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 +3 -3
- package/src/controllers/download.controller.js +154 -17
- package/src/controllers/gallery.controller.js +124 -31
- package/src/controllers/internalTrax.controller.js +284 -5
- package/src/controllers/mobileTrax.controller.js +200 -40
- package/src/controllers/teaxFlag.controller.js +161 -142
- package/src/controllers/trax.controller.js +1477 -153
- package/src/controllers/traxDashboard.controllers.js +350 -105
- package/src/dtos/dashboardValidation.dtos.js +2 -0
- package/src/dtos/downloadValidation.dtos.js +3 -0
- package/src/dtos/validation.dtos.js +17 -5
- package/src/routes/download.router.js +4 -0
- package/src/routes/gallery.routes.js +5 -1
- package/src/routes/internalTraxApi.router.js +3 -1
- package/src/routes/mobileTrax.routes.js +3 -1
- package/src/routes/trax.routes.js +12 -2
- package/src/routes/traxDashboard.routes.js +3 -1
- package/src/services/checklistAssign.service.js +8 -0
- package/src/services/planogram.service.js +5 -0
- package/src/services/teams.service.js +30 -0
|
@@ -5,6 +5,7 @@ const baseSchema = {
|
|
|
5
5
|
storeId: joi.array().required().empty(),
|
|
6
6
|
fromDate: joi.string().required(),
|
|
7
7
|
toDate: joi.string().required(),
|
|
8
|
+
userEmailes: joi.array().optional().empty(),
|
|
8
9
|
};
|
|
9
10
|
const tableSchema = {
|
|
10
11
|
searchValue: joi.string().optional().allow( '' ),
|
|
@@ -13,6 +14,7 @@ const tableSchema = {
|
|
|
13
14
|
limit: joi.number().required(),
|
|
14
15
|
offset: joi.number().required(),
|
|
15
16
|
sortColumnName: joi.string().optional().allow( '' ),
|
|
17
|
+
export: joi.boolean().optional().allow( '' ),
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
|
|
@@ -13,6 +13,7 @@ export const validateDownloadInsertSchema = joi.object( {
|
|
|
13
13
|
checklistName: joi.string().optional().allow( '' ),
|
|
14
14
|
fileType: joi.string().required(),
|
|
15
15
|
storeIds: joi.array().optional().allow( '' ),
|
|
16
|
+
userEmailList: joi.array().optional().allow( '' ),
|
|
16
17
|
questions: joi.array().optional().allow( '' ),
|
|
17
18
|
previewType: joi.string().optional().allow( '' ),
|
|
18
19
|
viewFlag: joi.boolean().optional().allow( '' ),
|
|
@@ -23,6 +24,8 @@ export const validateDownloadInsertSchema = joi.object( {
|
|
|
23
24
|
viewRedo: joi.boolean().optional().allow( '' ),
|
|
24
25
|
insertType: joi.string().optional().allow( '' ),
|
|
25
26
|
filter: joi.string().optional().allow( '' ),
|
|
27
|
+
filtertype: joi.string().optional().allow( '' ),
|
|
28
|
+
checkListType: joi.string().required(),
|
|
26
29
|
|
|
27
30
|
} );
|
|
28
31
|
|
|
@@ -81,13 +81,15 @@ export const checklistPageValidation = {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
export const uploadUserSchema = joi.object( {
|
|
84
|
-
id: joi.string().
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
id: joi.string().optional(),
|
|
85
|
+
checklistId: joi.string().optional(),
|
|
86
|
+
assignedUsers: joi.array().optional(),
|
|
87
|
+
uploadUser: joi.boolean().optional(),
|
|
87
88
|
type: joi.string().optional().allow( '' ),
|
|
88
89
|
addUser: joi.boolean().optional(),
|
|
89
90
|
delete: joi.boolean().optional(),
|
|
90
91
|
clientId: joi.string().optional(),
|
|
92
|
+
coverage: joi.string().optional(),
|
|
91
93
|
} );
|
|
92
94
|
|
|
93
95
|
export const uploadUserValidation = {
|
|
@@ -114,7 +116,7 @@ export const publishValidation = {
|
|
|
114
116
|
};
|
|
115
117
|
|
|
116
118
|
export const dashboardSchema = joi.object( {
|
|
117
|
-
store_id: joi.string().
|
|
119
|
+
store_id: joi.string().optional().allow( '' ),
|
|
118
120
|
date: joi.string().required(),
|
|
119
121
|
} );
|
|
120
122
|
|
|
@@ -126,7 +128,7 @@ export const mobileChecklistSchema = joi.object( {
|
|
|
126
128
|
limit: joi.string().optional(),
|
|
127
129
|
offset: joi.string().optional(),
|
|
128
130
|
date: joi.string().optional(),
|
|
129
|
-
store_id: joi.string().optional(),
|
|
131
|
+
store_id: joi.string().optional().allow( '' ),
|
|
130
132
|
checklistStatus: joi.string().optional().allow( '' ),
|
|
131
133
|
searchValue: joi.string().optional().allow( '' ),
|
|
132
134
|
} );
|
|
@@ -144,4 +146,14 @@ export const startValidation = {
|
|
|
144
146
|
body: startSchema,
|
|
145
147
|
};
|
|
146
148
|
|
|
149
|
+
export const selectAssignSchema = joi.object( {
|
|
150
|
+
clientId: joi.string().required(),
|
|
151
|
+
coverage: joi.string().required(),
|
|
152
|
+
assignType: joi.string().required(),
|
|
153
|
+
} );
|
|
154
|
+
|
|
155
|
+
export const selectAssign = {
|
|
156
|
+
body: selectAssignSchema,
|
|
157
|
+
};
|
|
158
|
+
|
|
147
159
|
|
|
@@ -11,13 +11,17 @@ import {
|
|
|
11
11
|
getChecklistFromZipId,
|
|
12
12
|
getPDFCSVChecklistDetails,
|
|
13
13
|
cancelDownload,
|
|
14
|
+
downloadInsertAI,
|
|
15
|
+
getAiChecklistDataFromZipId,
|
|
14
16
|
} from '../controllers/download.controller.js';
|
|
15
17
|
|
|
16
18
|
downloadRouter
|
|
17
19
|
.post( '/downloadInsert', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [] } ] } ), validate( downloadValidationDtos.validateDownloadInsertParams ), downloadInsert )
|
|
20
|
+
.post( '/downloadInsertAI', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [] } ] } ), validate( downloadValidationDtos.validateDownloadInsertParams ), downloadInsertAI )
|
|
18
21
|
.post( '/downloadList', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [] } ] } ), validate( downloadValidationDtos.validateDownloadListParams ), downloadList )
|
|
19
22
|
.post( '/downloadUpdate', downloadUpdate ) // isAllowedInternalAPIHandler,
|
|
20
23
|
.get( '/getChecklistFromZipId', getChecklistFromZipId ) // isAllowedInternalAPIHandler,
|
|
24
|
+
.get( '/getAiChecklistDataFromZipId', getAiChecklistDataFromZipId ) // isAllowedInternalAPIHandler,
|
|
21
25
|
.post( '/getChecklistDetails', getPDFCSVChecklistDetails )
|
|
22
26
|
.put( '/cancelDownload/:id', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [] } ] } ), cancelDownload );
|
|
23
27
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import { getchecklist, viewchecklist, getMobileUseagelist, storeOpencloselist, getcustomerunattendedlist, storesList, checklistDropdown, redoChecklist, approveChecklist, approvalstatus, getLogs, headerStoresV2 } from '../controllers/gallery.controller.js';
|
|
3
|
+
import { getchecklist, viewchecklist, getMobileUseagelist, storeOpencloselist, getcustomerunattendedlist, storesList, checklistDropdown, redoChecklist, approveChecklist, approvalstatus, getLogs, headerStoresV2, teamsList, userList } from '../controllers/gallery.controller.js';
|
|
4
4
|
import express from 'express';
|
|
5
5
|
export const galleryRouter = express.Router();
|
|
6
6
|
import { validate, isAllowedSessionHandler, isAllowedClient, getAssinedStore } from 'tango-app-api-middleware';
|
|
@@ -28,3 +28,7 @@ galleryRouter
|
|
|
28
28
|
.post( '/getLogs', isAllowedSessionHandler, getLogs );
|
|
29
29
|
galleryRouter
|
|
30
30
|
.post( '/headerStores_v2', isAllowedSessionHandler, isAllowedClient, validate( validationDtos.validateHeaderParamsv2 ), getAssinedStore, headerStoresV2 );
|
|
31
|
+
galleryRouter
|
|
32
|
+
.get( '/teamsList', isAllowedSessionHandler, isAllowedClient, teamsList );
|
|
33
|
+
galleryRouter
|
|
34
|
+
.post( '/userList', isAllowedSessionHandler, isAllowedClient, userList );
|
|
@@ -19,6 +19,8 @@ internalTraxRouter
|
|
|
19
19
|
.get( '/checklist', isAllowedInternalAPIHandler, internalController.internalAPIChecklist )
|
|
20
20
|
.post( '/getPDFCSVChecklistDetails', isAllowedInternalAPIHandler, internalController.getPDFCSVChecklistDetails )
|
|
21
21
|
.get( '/getOTP', isAllowedInternalAPIHandler, internalController.getOTP )
|
|
22
|
-
.get( '/getDownloads', isAllowedInternalAPIHandler, internalController.getDownloads )
|
|
22
|
+
.get( '/getDownloads', isAllowedInternalAPIHandler, internalController.getDownloads )
|
|
23
|
+
.post( '/sendPushNotification', isAllowedInternalAPIHandler, internalController.internalSendPushNotification )
|
|
24
|
+
.post( '/sendAiPushNotification', isAllowedInternalAPIHandler, internalController.internalAISendPushNotification );
|
|
23
25
|
|
|
24
26
|
|
|
@@ -24,5 +24,7 @@ mobileRouter
|
|
|
24
24
|
.post( '/appVersion', mobileController.updateappVersion )
|
|
25
25
|
.post( '/verifylocation', isAllowedSessionHandler, mobileController.getStoreLocation, mobileController.location )
|
|
26
26
|
.post( '/login', mobileController.login )
|
|
27
|
-
.post( '/checkUpdateVersion', mobileController.checkVersion )
|
|
27
|
+
.post( '/checkUpdateVersion', mobileController.checkVersion )
|
|
28
|
+
.post( '/checkClientConfig', isAllowedSessionHandler, mobileController.clientConfig )
|
|
29
|
+
.post( '/updatePlanoStatus', isAllowedSessionHandler, mobileController.updatePlanoStatus );
|
|
28
30
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { isAllowedSessionHandler, validate, accessVerification, isAllowedClient } from 'tango-app-api-middleware';
|
|
3
|
-
import { checklistValidation, checklistDetailsValidation, runaiValidation, checklistPageSchema, duplicateValidation, updateChecklistValidation, uploadUserValidation, aichecklistValidation, publishValidation } from '../dtos/validation.dtos.js';
|
|
3
|
+
import { checklistValidation, checklistDetailsValidation, runaiValidation, checklistPageSchema, duplicateValidation, updateChecklistValidation, uploadUserValidation, aichecklistValidation, publishValidation, selectAssign } from '../dtos/validation.dtos.js';
|
|
4
4
|
import * as traxController from '../controllers/trax.controller.js';
|
|
5
5
|
|
|
6
6
|
export const traxRouter = express.Router();
|
|
@@ -14,11 +14,21 @@ traxRouter
|
|
|
14
14
|
.get( '/duplicateChecklist/:checklistId', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), validate( duplicateValidation ), traxController.duplicateChecklist )
|
|
15
15
|
.put( '/checklist/update/:checklistId', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), validate( updateChecklistValidation ), traxController.update )
|
|
16
16
|
.post( '/validateUser', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), validate( uploadUserValidation ), traxController.validateUser )
|
|
17
|
+
.post( '/validateUserv1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), validate( uploadUserValidation ), traxController.validateUserv1 )
|
|
17
18
|
.get( '/userDetails/:checklistId', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ), validate( duplicateValidation ), traxController.assignedUserDetails )
|
|
19
|
+
.get( '/userDetailsv1/:checklistId', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ), validate( duplicateValidation ), traxController.assignedUserDetailsv1 )
|
|
18
20
|
.post( '/checklistConfigure', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), traxController.updateConfigure )
|
|
21
|
+
.post( '/checklistConfigurev1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), traxController.updateConfigurev1 )
|
|
19
22
|
.delete( '/deleteChecklist/:checklistId', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), validate( duplicateValidation ), traxController.deleteChecklist )
|
|
20
23
|
.put( '/publish', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isEdit' ] } ] } ), validate( publishValidation ), traxController.updatePublish )
|
|
21
24
|
.get( '/userList', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ), traxController.userlist )
|
|
22
25
|
.get( '/zoneList', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ), traxController.zoneList )
|
|
23
26
|
.get( '/aichecklist', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ), validate( aichecklistValidation ), traxController.aiChecklist )
|
|
24
|
-
.get( '/predefinedChecklist', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ), validate( aichecklistValidation ), traxController.preDefinedChecklist )
|
|
27
|
+
.get( '/predefinedChecklist', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ), validate( aichecklistValidation ), traxController.preDefinedChecklist )
|
|
28
|
+
.post( '/selectAssign', validate( selectAssign ), traxController.selectAssign )
|
|
29
|
+
.post( '/assign', isAllowedSessionHandler, traxController.checklistAssign )
|
|
30
|
+
// .post( '/assignUpload', isAllowedSessionHandler, traxController.assignChecklistUser )
|
|
31
|
+
.post( '/updateAssign', isAllowedSessionHandler, traxController.updateAssign );
|
|
32
|
+
;
|
|
33
|
+
|
|
34
|
+
// isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ ] } ] } ),
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
reportChecklistTableV1,
|
|
30
30
|
reinitiatechecklist,
|
|
31
31
|
sendAlert,
|
|
32
|
+
getUserEmails,
|
|
32
33
|
} from '../controllers/traxDashboard.controllers.js';
|
|
33
34
|
|
|
34
35
|
traxDashboardRouter
|
|
@@ -56,6 +57,7 @@ traxDashboardRouter
|
|
|
56
57
|
.post( '/reportChecklistData', reportChecklistTable )
|
|
57
58
|
.post( '/reportChecklistDataV1', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [] } ] } ), validate( dashboardValidationDtos.validateReportChecklistTableParams ), reportChecklistTableV1 )
|
|
58
59
|
.post( '/reinitiatechecklist', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'checklist', permissions: [ 'isAdd', 'isEdit' ] } ] } ), reinitiatechecklist )
|
|
59
|
-
.post( '/sendAlert', isAllowedSessionHandler, sendAlert )
|
|
60
|
+
.post( '/sendAlert', isAllowedSessionHandler, sendAlert )
|
|
61
|
+
.post( '/getUserEmails', isAllowedSessionHandler, getUserEmails );
|
|
60
62
|
|
|
61
63
|
export default traxDashboardRouter;
|
|
@@ -24,8 +24,16 @@ export const updateMany = async ( query = {}, record={} ) => {
|
|
|
24
24
|
return model.checklistassignconfigModel.updateMany( query, { $set: record } );
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
+
export const updateOne = async ( query = {}, record={} ) => {
|
|
28
|
+
return model.checklistassignconfigModel.updateOne( query, { $set: record }, { upsert: true } );
|
|
29
|
+
};
|
|
30
|
+
|
|
27
31
|
export const aggregate = async ( query = {} ) => {
|
|
28
32
|
return model.checklistassignconfigModel.aggregate( query );
|
|
29
33
|
};
|
|
30
34
|
|
|
35
|
+
export const count = async ( query = {} ) => {
|
|
36
|
+
return model.checklistassignconfigModel.countDocuments( query );
|
|
37
|
+
};
|
|
38
|
+
|
|
31
39
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import teamsModel from 'tango-api-schema/schema/teams.model.js';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export async function createTeamsModel( data ) {
|
|
5
|
+
return await teamsModel.create( data );
|
|
6
|
+
};
|
|
7
|
+
export async function updateOneTeams( query, record ) {
|
|
8
|
+
return await teamsModel.updateOne( query, { $set: record }, { upsert: true } );
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export async function aggregateTeams( query ) {
|
|
12
|
+
return await teamsModel.aggregate( query );
|
|
13
|
+
};
|
|
14
|
+
export async function deleteTeams( query ={} ) {
|
|
15
|
+
return await teamsModel.deleteOne( query );
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export async function findOneTeams( query ={}, field={} ) {
|
|
19
|
+
return await teamsModel.findOne( query, field );
|
|
20
|
+
};
|
|
21
|
+
export async function findteams( query ={}, field={} ) {
|
|
22
|
+
return await teamsModel.find( query, field );
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export async function updateOneTeamModel( query, record ) {
|
|
26
|
+
return await teamsModel.updateOne( query, record );
|
|
27
|
+
}
|
|
28
|
+
export function countDocumentsTeams( query ) {
|
|
29
|
+
return teamsModel.countDocuments( query );
|
|
30
|
+
}
|