mobioffice-cli 0.2.1 → 1.0.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/{src/index.ts → lib/index.d.ts} +1 -45
- package/lib/models/Feed-Details-Screen.model.d.ts +6 -0
- package/lib/models/Feed-Details-Screen.model.js +27 -0
- package/lib/models/action.model.d.ts +58 -0
- package/lib/models/action.model.js +315 -0
- package/lib/models/actions/doffing.d.ts +6 -0
- package/lib/models/actions/doffing.js +64 -0
- package/lib/models/actions/folding.d.ts +7 -0
- package/lib/models/actions/folding.js +37 -0
- package/lib/models/attendance.model.d.ts +44 -0
- package/lib/models/attendance.model.js +446 -0
- package/lib/models/cicoPost.model.d.ts +9 -0
- package/lib/models/cicoPost.model.js +19 -0
- package/lib/models/company.model.d.ts +67 -0
- package/lib/models/company.model.js +725 -0
- package/lib/models/contact-us/resquest.model.d.ts +30 -0
- package/lib/models/contact-us/resquest.model.js +73 -0
- package/lib/models/crud/crud.d.ts +7 -0
- package/lib/models/crud/crud.js +27 -0
- package/lib/models/customCollection.model.d.ts +9 -0
- package/lib/models/customCollection.model.js +40 -0
- package/lib/models/customer/customer.model.d.ts +32 -0
- package/lib/models/customer/customer.model.js +62 -0
- package/lib/models/deviceChangeReq.d.ts +10 -0
- package/lib/models/deviceChangeReq.js +138 -0
- package/lib/models/dispatch.model.d.ts +14 -0
- package/lib/models/dispatch.model.js +93 -0
- package/lib/models/feed.models.d.ts +8 -0
- package/lib/models/feed.models.js +97 -0
- package/lib/models/geofence.model.d.ts +7 -0
- package/lib/models/geofence.model.js +61 -0
- package/lib/models/leaveApplicationPost.model.d.ts +12 -0
- package/lib/models/leaveApplicationPost.model.js +72 -0
- package/lib/models/license.model.d.ts +25 -0
- package/lib/models/license.model.js +198 -0
- package/lib/models/log.model.d.ts +6 -0
- package/{src/models/log.model.ts → lib/models/log.model.js} +11 -11
- package/lib/models/meeting.model.d.ts +11 -0
- package/lib/models/meeting.model.js +79 -0
- package/lib/models/meter.model.d.ts +18 -0
- package/lib/models/meter.model.js +54 -0
- package/lib/models/missingPunchPost.model.d.ts +15 -0
- package/lib/models/missingPunchPost.model.js +69 -0
- package/lib/models/offline.model.d.ts +70 -0
- package/lib/models/offline.model.js +831 -0
- package/lib/models/post.model.d.ts +38 -0
- package/lib/models/post.model.js +94 -0
- package/lib/models/printDetailsScreen.model.d.ts +6 -0
- package/lib/models/printDetailsScreen.model.js +27 -0
- package/lib/models/pushNotifications/pushNotification.model.d.ts +4 -0
- package/lib/models/pushNotifications/pushNotification.model.js +17 -0
- package/lib/models/report-actions.model.d.ts +26 -0
- package/lib/models/report-actions.model.js +56 -0
- package/lib/models/report-definition-details.model.d.ts +13 -0
- package/lib/models/report-definition-details.model.js +85 -0
- package/lib/models/report-definition.model.d.ts +23 -0
- package/lib/models/report-definition.model.js +26 -0
- package/lib/models/report-definitions-summary.model.d.ts +8 -0
- package/lib/models/report-definitions-summary.model.js +59 -0
- package/lib/models/report-detail-data.model.d.ts +46 -0
- package/lib/models/report-detail-data.model.js +49 -0
- package/lib/models/report-visibility.model.d.ts +7 -0
- package/lib/models/report-visibility.model.js +42 -0
- package/lib/models/report.model.d.ts +19 -0
- package/lib/models/report.model.js +138 -0
- package/lib/models/reportGenerator.model.d.ts +164 -0
- package/lib/models/reportGenerator.model.js +642 -0
- package/lib/models/response.model.d.ts +18 -0
- package/lib/models/response.model.js +30 -0
- package/lib/models/steps.factory.model.d.ts +172 -0
- package/lib/models/steps.factory.model.js +187 -0
- package/lib/models/storeGupShupLog.model.d.ts +6 -0
- package/lib/models/storeGupShupLog.model.js +51 -0
- package/lib/models/summary.model.d.ts +10 -0
- package/{src/models/summary.model.ts → lib/models/summary.model.js} +28 -27
- package/lib/models/tasks/sub-task-group.model.d.ts +42 -0
- package/lib/models/tasks/sub-task-group.model.js +154 -0
- package/lib/models/tasks/tags.model.d.ts +29 -0
- package/lib/models/tasks/tags.model.js +70 -0
- package/lib/models/tasks/task-group.model.d.ts +53 -0
- package/lib/models/tasks/task-group.model.js +156 -0
- package/lib/models/tasks/task.model.d.ts +163 -0
- package/lib/models/tasks/task.model.js +603 -0
- package/lib/models/tempCollection.model.d.ts +40 -0
- package/{src/models/tempCollection.model.ts → lib/models/tempCollection.model.js} +114 -130
- package/lib/models/user.model.d.ts +42 -0
- package/lib/models/user.model.js +272 -0
- package/lib/models/utility.model.d.ts +13 -0
- package/lib/models/utility.model.js +93 -0
- package/lib/models/visitorManagement/acknowledgement.model.d.ts +9 -0
- package/lib/models/visitorManagement/acknowledgement.model.js +55 -0
- package/lib/models/visitorManagement/invite.model.d.ts +32 -0
- package/lib/models/visitorManagement/invite.model.js +326 -0
- package/lib/models/visitorManagement/newIn.model.d.ts +19 -0
- package/lib/models/visitorManagement/newIn.model.js +67 -0
- package/lib/models/visitorManagement/selfServe.model.d.ts +13 -0
- package/lib/models/visitorManagement/selfServe.model.js +46 -0
- package/lib/models/worklogPost.model.d.ts +6 -0
- package/lib/models/worklogPost.model.js +9 -0
- package/lib/services/customer.d.ts +30 -0
- package/lib/services/customer.js +354 -0
- package/lib/services/meeting.d.ts +19 -0
- package/lib/services/meeting.js +109 -0
- package/package.json +4 -1
- package/.prettierrc +0 -4
- package/a.js +0 -3
- package/scripts/1.ts +0 -1300
- package/scripts/GCloudPubSub/pub-sub-config.json +0 -12
- package/scripts/GCloudPubSub/visitorAutoRejection.ts +0 -86
- package/scripts/actions/assignUsersFromOneActionToOther.ts +0 -64
- package/scripts/actions/assignUsersListToAction.ts +0 -81
- package/scripts/actions/getActionsListOfUser.ts +0 -42
- package/scripts/actions/getCompanyUserDetails.ts +0 -49
- package/scripts/actions/giveActionToUser.ts +0 -41
- package/scripts/actions/giveUsersToActivitySelector.ts +0 -56
- package/scripts/actions/groupActionsInActivitySelector.ts +0 -101
- package/scripts/actions/modifySummaryReportDB.ts +0 -42
- package/scripts/actions/setUrlToActionStep.ts +0 -18
- package/scripts/actions/syncMySqlAttendanceDBWithFirebase.ts +0 -93
- package/scripts/actions/syncMySqlMeetingsDBWithFirebase.ts +0 -103
- package/scripts/actions/test.ts +0 -29
- package/scripts/actions/transferFeedsOldIdToNew.ts +0 -40
- package/scripts/actions/transformUserIntoManager.ts +0 -89
- package/scripts/argvConfig.js +0 -9
- package/scripts/backUpData/testCode.ts +0 -131
- package/scripts/benaraScripts/addWorkAreaMap.ts +0 -46
- package/scripts/benaraScripts/add_customers.ts +0 -26
- package/scripts/benaraScripts/add_customers_contact.ts +0 -27
- package/scripts/benaraScripts/add_empty_work_area.ts +0 -17
- package/scripts/benaraScripts/assignManagers.ts +0 -35
- package/scripts/benaraScripts/changeCheckInFlag.ts +0 -45
- package/scripts/benaraScripts/createCustomerContactsList.ts +0 -170
- package/scripts/benaraScripts/createUserByDeletingOldUser.ts +0 -70
- package/scripts/benaraScripts/createUsersAreaMapCollection.ts +0 -23
- package/scripts/benaraScripts/createWorkAreaMap.ts +0 -24
- package/scripts/benaraScripts/mapWorkAreasToUsers.ts +0 -112
- package/scripts/companies_data.json +0 -2496
- package/scripts/create_or_update_users.ts +0 -31
- package/scripts/csvToJson/csvToJson.ts +0 -90
- package/scripts/csvToJson/users.json +0 -3896
- package/scripts/db.js +0 -27
- package/scripts/db.json +0 -13
- package/scripts/dbMySql.ts +0 -63
- package/scripts/delete_action_steps.ts +0 -11
- package/scripts/delete_user.ts +0 -71
- package/scripts/dev_companies_data.json +0 -613
- package/scripts/enroll.xlsx +0 -0
- package/scripts/export_users.ts +0 -72
- package/scripts/files/visitorManagementFiles/displayScreen.json +0 -70
- package/scripts/files/visitorManagementFiles/init_report_visibility.ts +0 -79
- package/scripts/firebaseConfig.js +0 -12
- package/scripts/firebaseDocs/deleteIncommingCollection.ts +0 -47
- package/scripts/firebaseDocs/updateDoc.ts +0 -43
- package/scripts/getActionDataIntoJSON/getActionData.ts +0 -68
- package/scripts/get_attendance_by_any_date.ts +0 -14
- package/scripts/get_attendance_by_month.ts +0 -12
- package/scripts/get_attendance_monthly_by_team.ts +0 -11
- package/scripts/get_daily_report.ts +0 -10
- package/scripts/get_mangers.ts +0 -13
- package/scripts/grant_user_license.ts +0 -18
- package/scripts/init_CustomCollection.ts +0 -16
- package/scripts/init_action_steps.ts +0 -28
- package/scripts/init_actions.ts +0 -31
- package/scripts/init_company.ts +0 -18
- package/scripts/init_customer_mysql.ts +0 -12
- package/scripts/init_feed.ts +0 -4
- package/scripts/init_feed_details_screen.ts +0 -14
- package/scripts/init_geofence.ts +0 -26
- package/scripts/init_print_details_screen.ts +0 -14
- package/scripts/init_report_actions.ts +0 -24
- package/scripts/init_report_definition_detail.ts +0 -26
- package/scripts/init_report_definition_summary.ts +0 -16
- package/scripts/init_report_visibility.ts +0 -46
- package/scripts/init_user_customcollection.ts +0 -16
- package/scripts/json/action.json +0 -21
- package/scripts/json/company.json +0 -24
- package/scripts/json/report-action.json +0 -13
- package/scripts/json/report-def-deet.json +0 -43
- package/scripts/json/resp.json +0 -784
- package/scripts/json/steps.json +0 -24
- package/scripts/json/test.ts +0 -49
- package/scripts/mysqlConfig.ts +0 -9
- package/scripts/revoke_or_extend_license.ts +0 -14
- package/scripts/stream.js +0 -4
- package/scripts/testing1.ts +0 -35
- package/scripts/update/doc.json +0 -20
- package/scripts/update/getDocByPath.ts +0 -34
- package/scripts/update/updateDocByPath.ts +0 -47
- package/scripts/update/updateUsersOfCompanies.ts +0 -58
- package/scripts/update_actions.ts +0 -19
- package/scripts/update_actions_steps.ts +0 -19
- package/scripts/update_company.ts +0 -19
- package/scripts/update_geofence.ts +0 -20
- package/scripts/update_managers.ts +0 -16
- package/scripts/visitorMgmt/createArea.ts +0 -68
- package/scripts/visitorMgmt/createArea.txt +0 -3
- package/scripts/visitorMgmt/createVisitorPathInstructionDocs.ts +0 -130
- package/scripts/visitorMgmt/createVisitorPathInstructionDocs.txt +0 -18
- package/scripts/visitorMgmt/encryptDateString.ts +0 -71
- package/scripts/visitorMgmt/makeHostsManagersOfEachOther.ts +0 -117
- package/scripts/whatsapp_gupshup/sendMessage.ts +0 -97
- package/src/models/Feed-Details-Screen.model.ts +0 -29
- package/src/models/action.model.ts +0 -355
- package/src/models/actions/doffing.ts +0 -71
- package/src/models/actions/folding.ts +0 -39
- package/src/models/attendance.model.ts +0 -615
- package/src/models/cicoPost.model.ts +0 -20
- package/src/models/company.model.ts +0 -975
- package/src/models/contact-us/resquest.model.ts +0 -87
- package/src/models/crud/crud.ts +0 -30
- package/src/models/customCollection.model.ts +0 -47
- package/src/models/customer/customer.model.ts +0 -85
- package/src/models/deviceChangeReq.ts +0 -150
- package/src/models/dispatch.model.ts +0 -99
- package/src/models/feed.models.ts +0 -104
- package/src/models/geofence.model.ts +0 -61
- package/src/models/leaveApplicationPost.model.ts +0 -79
- package/src/models/license.model.ts +0 -215
- package/src/models/meeting.model.ts +0 -80
- package/src/models/meter.model.ts +0 -62
- package/src/models/missingPunchPost.model.ts +0 -84
- package/src/models/offline.model.ts +0 -1133
- package/src/models/post.model.ts +0 -105
- package/src/models/printDetailsScreen.model.ts +0 -30
- package/src/models/pushNotifications/pushNotification.model.ts +0 -17
- package/src/models/report-actions.model.ts +0 -57
- package/src/models/report-definition-details.model.ts +0 -89
- package/src/models/report-definition.model.ts +0 -26
- package/src/models/report-definitions-summary.model.ts +0 -59
- package/src/models/report-detail-data.model.ts +0 -49
- package/src/models/report-visibility.model.ts +0 -44
- package/src/models/report.model.ts +0 -179
- package/src/models/reportGenerator.model.ts +0 -883
- package/src/models/response.model.ts +0 -31
- package/src/models/steps.factory.model.ts +0 -195
- package/src/models/storeGupShupLog.model.ts +0 -49
- package/src/models/tasks/sub-task-group.model.ts +0 -173
- package/src/models/tasks/tags.model.ts +0 -113
- package/src/models/tasks/task-group.model.ts +0 -172
- package/src/models/tasks/task.model.ts +0 -681
- package/src/models/user.model.ts +0 -319
- package/src/models/utility.model.ts +0 -100
- package/src/models/visitorManagement/acknowledgement.model.ts +0 -71
- package/src/models/visitorManagement/invite.model.ts +0 -406
- package/src/models/visitorManagement/newIn.model.ts +0 -82
- package/src/models/visitorManagement/selfServe.model.ts +0 -58
- package/src/models/worklogPost.model.ts +0 -8
- package/src/services/customer.ts +0 -382
- package/src/services/meeting.ts +0 -123
- package/test/1.ts +0 -13
- package/test/db.js +0 -19
- package/test/firebaseConfig.js +0 -1
- package/tsconfig.json +0 -16
@@ -1,406 +0,0 @@
|
|
1
|
-
import { Company } from "../company.model";
|
2
|
-
import { Post } from "../post.model";
|
3
|
-
import * as admin from "firebase-admin";
|
4
|
-
import { Utilities } from "../utility.model";
|
5
|
-
import { Attendance } from "../attendance.model";
|
6
|
-
import { Pool } from "mysql2/typings/mysql/lib/Pool";
|
7
|
-
import CurdService from "../crud/crud";
|
8
|
-
import { Policy } from "@google-cloud/pubsub";
|
9
|
-
|
10
|
-
class Invitation extends Post {
|
11
|
-
isProcessed = false;
|
12
|
-
|
13
|
-
static async setIncomingInfoToInvitation(
|
14
|
-
firestore: admin.firestore.Firestore,
|
15
|
-
invitationInfo: any,
|
16
|
-
post: Invitation,
|
17
|
-
nickName: string
|
18
|
-
) {
|
19
|
-
const userDetails = await Company.getUserDetailsByPhone(
|
20
|
-
firestore,
|
21
|
-
nickName,
|
22
|
-
"+" + invitationInfo.phone
|
23
|
-
);
|
24
|
-
const whomToMeet = userDetails[0].name;
|
25
|
-
post.actionEvent = invitationInfo.extra.actionEvent;
|
26
|
-
post.actionId = invitationInfo.extra.actionId;
|
27
|
-
post.actionName = invitationInfo.extra.actionName;
|
28
|
-
post.actionType = invitationInfo.extra.actionType;
|
29
|
-
post.companyId = invitationInfo.extra.companyId;
|
30
|
-
post.createdAt = invitationInfo.extra.createdAt;
|
31
|
-
post.refId = invitationInfo.extra.extraData.phone;
|
32
|
-
post.description = `${invitationInfo.extra.extraData.visitorName} is going to meet ${whomToMeet} `;
|
33
|
-
post.eventId = invitationInfo.extra.eventId;
|
34
|
-
post.isGeofence = invitationInfo.extra.isGeofence;
|
35
|
-
post.userId = invitationInfo.userId;
|
36
|
-
const newExtraData = await this.modifyExtraDAtaForInvitation(
|
37
|
-
invitationInfo,
|
38
|
-
whomToMeet
|
39
|
-
);
|
40
|
-
post.extraData = newExtraData;
|
41
|
-
post.time = invitationInfo.extra.time;
|
42
|
-
let postOBJ = JSON.parse(JSON.stringify(post));
|
43
|
-
postOBJ["isApproved"] = invitationInfo.isApproved;
|
44
|
-
return postOBJ;
|
45
|
-
}
|
46
|
-
|
47
|
-
static async modifyExtraDAtaForInvitation(
|
48
|
-
invitationInfo: any,
|
49
|
-
whomToMeet: string
|
50
|
-
) {
|
51
|
-
const visitorName = invitationInfo.extra.extraData.visitorName;
|
52
|
-
const personToMeet = whomToMeet;
|
53
|
-
const meetingTimeObj = invitationInfo.extra.extraData.meetingTime;
|
54
|
-
const meetingEpochTime =
|
55
|
-
meetingTimeObj._seconds * 1000 +
|
56
|
-
Math.floor(meetingTimeObj._nanoseconds / 1000000);
|
57
|
-
const visitorPhoneNumber = invitationInfo.extra.extraData.phone;
|
58
|
-
const acknowledgedTime = null;
|
59
|
-
const checkOutTimeOfVisitor = null;
|
60
|
-
const newExtraData = {
|
61
|
-
visitorName,
|
62
|
-
personToMeet,
|
63
|
-
visitorPhoneNumber,
|
64
|
-
status: "Invitation Sent",
|
65
|
-
acknowledgedTime,
|
66
|
-
time: meetingEpochTime,
|
67
|
-
date: invitationInfo.extra.extraData.meetingDate,
|
68
|
-
checkInTimeOfVisitor: null,
|
69
|
-
checkInDateOfVisitor: "---",
|
70
|
-
checkOutTimeOfVisitor,
|
71
|
-
};
|
72
|
-
return newExtraData;
|
73
|
-
}
|
74
|
-
|
75
|
-
static async uploadEntryToMySql(connection: Pool, info: any) {
|
76
|
-
const crudServicce = new CurdService(connection);
|
77
|
-
try {
|
78
|
-
const checkInTime = info.checkInTime ? `'${info.checkInTime}'` : null;
|
79
|
-
const qryString =
|
80
|
-
info.cardColor == null ||
|
81
|
-
info.image == null ||
|
82
|
-
info.idProofType == null ||
|
83
|
-
info.idImage == null
|
84
|
-
? `INSERT INTO visits (visitorName, phoneNo, meetingPerson,
|
85
|
-
checkInTime, companyId, visitId, category, meetingPersonPhone,
|
86
|
-
visitType, scheduledTime, purposeOfVisit, isApproved, cardColor, additionalVisitors, visitorsLeaving, assets, image, idProofType, idImage, refId, inGateKeeperId)
|
87
|
-
VALUES ('${info.visitorName}',
|
88
|
-
'${info.visitorPhone}',
|
89
|
-
'${info.meetingPerson}',
|
90
|
-
${checkInTime},
|
91
|
-
'${info.companyId}',
|
92
|
-
'${info.visitId}',
|
93
|
-
'${info.category}',
|
94
|
-
'${info.meetingPersonPhone}',
|
95
|
-
'${info.visitType}',
|
96
|
-
'${info.scheduledTime}',
|
97
|
-
'${info.purposeOfVisit}',
|
98
|
-
${info.isApproved},
|
99
|
-
'${info.cardColor ?? ""}',
|
100
|
-
${info.additionalVisitors},
|
101
|
-
${info.visitorsLeaving},
|
102
|
-
'${info.assets}',
|
103
|
-
'${info.image}',
|
104
|
-
${info.idProofType},
|
105
|
-
'${info.idImage ?? ""}',
|
106
|
-
'${info.refId ?? ""}',
|
107
|
-
'${info.inGateKeeperId ?? ""}');`
|
108
|
-
: `INSERT INTO visits (visitorName, phoneNo, meetingPerson,
|
109
|
-
checkInTime, companyId, visitId, category, meetingPersonPhone,
|
110
|
-
visitType, scheduledTime, purposeOfVisit, isApproved, cardColor, additionalVisitors, visitorsLeaving, assets, image, idProofType, idImage, refId, inGateKeeperId)
|
111
|
-
VALUES ('${info.visitorName}',
|
112
|
-
'${info.visitorPhone}',
|
113
|
-
'${info.meetingPerson}',
|
114
|
-
${checkInTime},
|
115
|
-
'${info.companyId}',
|
116
|
-
'${info.visitId}',
|
117
|
-
'${info.category}',
|
118
|
-
'${info.meetingPersonPhone}',
|
119
|
-
'${info.visitType}',
|
120
|
-
'${info.scheduledTime}',
|
121
|
-
'${info.purposeOfVisit}',
|
122
|
-
${info.isApproved},
|
123
|
-
'${info.cardColor}',
|
124
|
-
${info.additionalVisitors},
|
125
|
-
${info.visitorsLeaving},
|
126
|
-
'${info.assets}',
|
127
|
-
'${info.image}',
|
128
|
-
'${info.idProofType}',
|
129
|
-
'${info.idImage}',
|
130
|
-
'${info.refId}',
|
131
|
-
'${info.inGateKeeperId}');`;
|
132
|
-
console.log(qryString);
|
133
|
-
await crudServicce.query(qryString);
|
134
|
-
} catch (error: any) {
|
135
|
-
console.log(error.message);
|
136
|
-
throw new Error(error.message);
|
137
|
-
}
|
138
|
-
}
|
139
|
-
|
140
|
-
static async updateInvitationEntryOnReception(
|
141
|
-
connection: Pool,
|
142
|
-
visitId: string,
|
143
|
-
redId: string,
|
144
|
-
inGateKeeperId: string,
|
145
|
-
checkInTime: string
|
146
|
-
) {
|
147
|
-
const crudServicce = new CurdService(connection);
|
148
|
-
try {
|
149
|
-
const qryString = `UPDATE visits SET checkInTime = '${checkInTime}', refId = '${redId}', inGateKeeperId = '${inGateKeeperId}' WHERE visitId = '${visitId}';`;
|
150
|
-
await crudServicce.query(qryString);
|
151
|
-
} catch (error: any) {
|
152
|
-
console.log(error.message);
|
153
|
-
throw new Error(error.message);
|
154
|
-
}
|
155
|
-
}
|
156
|
-
|
157
|
-
static async updateInvitationOnApproval(
|
158
|
-
connection: Pool,
|
159
|
-
visitId: string,
|
160
|
-
isApproved: boolean
|
161
|
-
) {
|
162
|
-
const curdService = new CurdService(connection)
|
163
|
-
try {
|
164
|
-
const qryString = `UPDATE visits SET isApproved = ${isApproved} WHERE visitId = '${visitId}';`;
|
165
|
-
await curdService.query(qryString);
|
166
|
-
} catch (error: any) {
|
167
|
-
console.log(error.message);
|
168
|
-
throw new Error(error.message);
|
169
|
-
}
|
170
|
-
}
|
171
|
-
|
172
|
-
static async updateInvitationWithCardColor(
|
173
|
-
connection: Pool,
|
174
|
-
visitId: string,
|
175
|
-
cardColor: string
|
176
|
-
) {
|
177
|
-
const crudServicce = new CurdService(connection)
|
178
|
-
try {
|
179
|
-
const qryString =
|
180
|
-
cardColor == null
|
181
|
-
? `UPDATE visits SET cardColor = ${cardColor} WHERE visitId = '${visitId}';`
|
182
|
-
: `UPDATE visits SET cardColor = '${cardColor}' WHERE visitId = '${visitId}';`;
|
183
|
-
await crudServicce.query(qryString)
|
184
|
-
} catch (error: any) {
|
185
|
-
console.log(error.message);
|
186
|
-
throw new Error(error.message);
|
187
|
-
}
|
188
|
-
}
|
189
|
-
static async updateInvitationWithIdProof(
|
190
|
-
connection: Pool,
|
191
|
-
visitId: string,
|
192
|
-
proofType: string,
|
193
|
-
proofImage: string
|
194
|
-
) {
|
195
|
-
const crudServicce = new CurdService(connection);
|
196
|
-
try {
|
197
|
-
let qryString = `UPDATE visits SET idProofType = `
|
198
|
-
if (proofType) {
|
199
|
-
qryString += `'${proofType}', idImage = `
|
200
|
-
} else {
|
201
|
-
qryString += `null, idImage = `
|
202
|
-
}
|
203
|
-
|
204
|
-
if (proofImage) {
|
205
|
-
qryString += `'${proofImage}' `
|
206
|
-
} else {
|
207
|
-
qryString += `null `;
|
208
|
-
}
|
209
|
-
qryString += `where visitId = '${visitId}';`;
|
210
|
-
console.log(qryString);
|
211
|
-
console.log("--------------------------");
|
212
|
-
await crudServicce.query(qryString);
|
213
|
-
} catch (error: any) {
|
214
|
-
console.log(error.message);
|
215
|
-
throw new Error(error.message);
|
216
|
-
}
|
217
|
-
}
|
218
|
-
|
219
|
-
static async updateInvitationWithVisitorsLeaving(
|
220
|
-
connection: Pool,
|
221
|
-
visitId: string,
|
222
|
-
outGateKeeperId: string,
|
223
|
-
visitorsLeaving: string
|
224
|
-
) {
|
225
|
-
const crudServicce = new CurdService(connection);
|
226
|
-
try {
|
227
|
-
const qryString = `UPDATE visits
|
228
|
-
SET visitorsLeaving = '${Number(visitorsLeaving)}', outGateKeeperId = '${outGateKeeperId}'
|
229
|
-
WHERE visitId = '${visitId}';`;
|
230
|
-
await crudServicce.query(qryString);
|
231
|
-
} catch (error: any) {
|
232
|
-
console.log(error.message);
|
233
|
-
throw new Error(error.message);
|
234
|
-
}
|
235
|
-
}
|
236
|
-
|
237
|
-
static async updateInvitationWithImage(
|
238
|
-
connection: Pool,
|
239
|
-
visitId: string,
|
240
|
-
imageBase64: string,
|
241
|
-
additionalVisitors: string,
|
242
|
-
assets: string
|
243
|
-
) {
|
244
|
-
const crudServicce = new CurdService(connection);
|
245
|
-
try {
|
246
|
-
const qryString = `UPDATE visits
|
247
|
-
SET image = '${imageBase64}', additionalVisitors = '${additionalVisitors}', assets = '${assets}'
|
248
|
-
WHERE visitId = '${visitId}';`;
|
249
|
-
await crudServicce.query(qryString);
|
250
|
-
} catch (error: any) {
|
251
|
-
console.log(error.message);
|
252
|
-
throw new Error(error.message);
|
253
|
-
}
|
254
|
-
}
|
255
|
-
|
256
|
-
static async updateInvitationWithApprovedAt(
|
257
|
-
connection: Pool,
|
258
|
-
visitId: string,
|
259
|
-
approvedAt: string
|
260
|
-
) {
|
261
|
-
const crudServicce = new CurdService(connection);
|
262
|
-
try {
|
263
|
-
const qryString = `UPDATE visits SET approvedAt = '${approvedAt}' WHERE visitId = '${visitId}';`;
|
264
|
-
await crudServicce.query(qryString);
|
265
|
-
} catch (error: any) {
|
266
|
-
console.log(error.message);
|
267
|
-
throw new Error(error.message);
|
268
|
-
}
|
269
|
-
}
|
270
|
-
|
271
|
-
static async fetchHostMeetingsForTheDay(
|
272
|
-
connection: Pool,
|
273
|
-
hostPhone: string,
|
274
|
-
companyId: string
|
275
|
-
) {
|
276
|
-
const crudServicce = new CurdService(connection);
|
277
|
-
try {
|
278
|
-
let date = await Attendance.getCurrentdate();
|
279
|
-
date = date.split("/").reverse().join('-');
|
280
|
-
console.log("current date:", date);
|
281
|
-
const qryString = `SELECT * FROM visits
|
282
|
-
WHERE meetingPersonPhone = '${hostPhone}'
|
283
|
-
AND companyId = '${companyId}'
|
284
|
-
AND isReassigned IS NOT true
|
285
|
-
AND meetingTime IS NULL
|
286
|
-
AND DATE(scheduledTime) = '${date}'`;
|
287
|
-
const meetingsListInfo: any = await crudServicce.query(qryString);
|
288
|
-
const meetingsList = meetingsListInfo.map((meetingInfo: any) => {
|
289
|
-
return {
|
290
|
-
id: meetingInfo.id,
|
291
|
-
visitId: meetingInfo.visitId,
|
292
|
-
visitorName: meetingInfo.visitorName,
|
293
|
-
scheduledTime: meetingInfo.scheduledTime,
|
294
|
-
meetingPerson: meetingInfo.meetingPerson,
|
295
|
-
visitType: meetingInfo.visitType
|
296
|
-
}
|
297
|
-
})
|
298
|
-
return meetingsList;
|
299
|
-
} catch (error: any) {
|
300
|
-
console.log(error.message);
|
301
|
-
throw new Error(error.message);
|
302
|
-
}
|
303
|
-
}
|
304
|
-
|
305
|
-
static async checkUserIsExist(
|
306
|
-
connection: Pool,
|
307
|
-
Phone: string,
|
308
|
-
companyId: string
|
309
|
-
) {
|
310
|
-
const currentDateIST = new Date().toLocaleString("en-US", {
|
311
|
-
timeZone: "Asia/Kolkata",
|
312
|
-
year: "numeric",
|
313
|
-
month: "2-digit",
|
314
|
-
day: "2-digit",
|
315
|
-
hour: "2-digit",
|
316
|
-
minute: "2-digit",
|
317
|
-
second: "2-digit",
|
318
|
-
hour12: false,
|
319
|
-
});
|
320
|
-
|
321
|
-
const [date, time] = currentDateIST.split(", ");
|
322
|
-
const [day, month, year] = date.split("/");
|
323
|
-
const formattedDate = `${year}-${day}-${month} ${time}`;
|
324
|
-
const crudServicce = new CurdService(connection);
|
325
|
-
try {
|
326
|
-
const qryString = `SELECT id, companyId, phone, fromTime, toTime, isActive, createdAt FROM gatePassDetails
|
327
|
-
WHERE isActive = true
|
328
|
-
AND companyId = '${companyId}'
|
329
|
-
AND phone = '${Phone}'
|
330
|
-
AND fromTime <= '${formattedDate}'
|
331
|
-
AND toTime >= '${formattedDate}'
|
332
|
-
ORDER BY id DESC
|
333
|
-
LIMIT 1;`;
|
334
|
-
console.log("qryString ====================================> ", qryString);
|
335
|
-
const meetingsListInfo = await crudServicce.query(qryString);
|
336
|
-
return meetingsListInfo;
|
337
|
-
} catch (error: any) {
|
338
|
-
console.log(error.message);
|
339
|
-
throw new Error(error.message);
|
340
|
-
}
|
341
|
-
}
|
342
|
-
|
343
|
-
static async createGatePass(
|
344
|
-
connection: Pool,
|
345
|
-
companyId: string,
|
346
|
-
phone: string,
|
347
|
-
from: string,
|
348
|
-
to: string,
|
349
|
-
name: string,
|
350
|
-
createdBy: string,
|
351
|
-
faceJpg: string
|
352
|
-
) {
|
353
|
-
const crudServicce = new CurdService(connection);
|
354
|
-
try {
|
355
|
-
const currentDateIST = new Date().toLocaleString("en-US", {
|
356
|
-
timeZone: "Asia/Kolkata",
|
357
|
-
year: "numeric",
|
358
|
-
month: "2-digit",
|
359
|
-
day: "2-digit",
|
360
|
-
hour: "2-digit",
|
361
|
-
minute: "2-digit",
|
362
|
-
second: "2-digit",
|
363
|
-
hour12: false,
|
364
|
-
});
|
365
|
-
|
366
|
-
const [date, time] = currentDateIST.split(", ");
|
367
|
-
const [day, month, year] = date.split("/");
|
368
|
-
const formattedDate = `${year}-${day}-${month} ${time}`;
|
369
|
-
|
370
|
-
console.log(formattedDate);
|
371
|
-
const qryString = `INSERT INTO gatePassDetails (companyId, phone, fromTime, toTime, isActive, createdAt, name, createdBy, image)
|
372
|
-
VALUES('${companyId}', '${phone}', '${from}', '${to}', 1, '${formattedDate}', '${name}', '${createdBy}', '${faceJpg}');`;
|
373
|
-
|
374
|
-
console.log("qryString ====================================> ", qryString);
|
375
|
-
const meetingsListInfo = await crudServicce.query(qryString);
|
376
|
-
return meetingsListInfo;
|
377
|
-
} catch (error: any) {
|
378
|
-
console.log(error.message);
|
379
|
-
throw new Error(error.message);
|
380
|
-
}
|
381
|
-
}
|
382
|
-
|
383
|
-
static async updateUserGatePassData(
|
384
|
-
connection: Pool,
|
385
|
-
id: number,
|
386
|
-
to: string
|
387
|
-
) {
|
388
|
-
const crudServicce = new CurdService(connection);
|
389
|
-
try {
|
390
|
-
const qryString = `UPDATE gatePassDetails
|
391
|
-
SET toTime = '${to}'
|
392
|
-
WHERE id = '${id}';`;
|
393
|
-
|
394
|
-
console.log("qryString ====================================> ", qryString);
|
395
|
-
const meetingsListInfo = await crudServicce.query(qryString);
|
396
|
-
return meetingsListInfo;
|
397
|
-
} catch (error: any) {
|
398
|
-
console.log(error.message);
|
399
|
-
throw new Error(error.message);
|
400
|
-
}
|
401
|
-
}
|
402
|
-
|
403
|
-
|
404
|
-
}
|
405
|
-
|
406
|
-
export { Invitation };
|
@@ -1,82 +0,0 @@
|
|
1
|
-
import * as admin from "firebase-admin";
|
2
|
-
import { Post } from "../post.model";
|
3
|
-
|
4
|
-
class NewIn extends Post {
|
5
|
-
isProcessed: boolean = false;
|
6
|
-
|
7
|
-
static async setIncomingInfoToNewIn(visitorInfo: any, post: NewIn){
|
8
|
-
post.actionEvent = visitorInfo.extra.actionEvent;
|
9
|
-
post.actionId = visitorInfo.extra.actionId;
|
10
|
-
post.actionName = visitorInfo.extra.actionName;
|
11
|
-
post.actionType = visitorInfo.extra.actionType;
|
12
|
-
post.companyId = visitorInfo.extra.companyId;
|
13
|
-
post.createdAt = visitorInfo.extra.createdAt;
|
14
|
-
post.description = `${visitorInfo.extra.extraData.visitorName} is going to meet ${visitorInfo.extra.extraData.whomToMeet} `;
|
15
|
-
post.eventId = visitorInfo.extra.eventId;
|
16
|
-
post.isGeofence = visitorInfo.extra.isGeofence;
|
17
|
-
post.userId = visitorInfo.userId;
|
18
|
-
const newExtraData = await this.modifyExtraDataForNewIn(visitorInfo);
|
19
|
-
post.extraData = newExtraData;
|
20
|
-
post.seen = visitorInfo.extra.seen;
|
21
|
-
post.stepValues = visitorInfo.extra.stepValues;
|
22
|
-
post.time = visitorInfo.extra.time;
|
23
|
-
return post;
|
24
|
-
}
|
25
|
-
|
26
|
-
static async modifyExtraDataForNewIn(visitorInfo : any){
|
27
|
-
const visitorName = visitorInfo.extra.extraData.visitorName;
|
28
|
-
const personToMeet = visitorInfo.extra.extraData.whomToMeet;
|
29
|
-
const personToMeetId = visitorInfo.extra.extraData.whomToMeetId;
|
30
|
-
const visitorPhoneNumber = visitorInfo.extra.extraData.phone;
|
31
|
-
const checkInTimeOfVisitor = visitorInfo.createdAt;
|
32
|
-
const visitorPicture = visitorInfo.visitorImage
|
33
|
-
const checkInDateOfVisitor = visitorInfo.date
|
34
|
-
const status = "In Progress"
|
35
|
-
const checkOutTimeOfVisitor = null
|
36
|
-
const acknowledgedTime = null
|
37
|
-
const newExtraData = {
|
38
|
-
visitorName,
|
39
|
-
personToMeet,
|
40
|
-
visitorPhoneNumber,
|
41
|
-
checkInTimeOfVisitor,
|
42
|
-
visitorPicture,
|
43
|
-
checkInDateOfVisitor,
|
44
|
-
status,
|
45
|
-
checkOutTimeOfVisitor,
|
46
|
-
acknowledgedTime,
|
47
|
-
personToMeetId
|
48
|
-
}
|
49
|
-
return newExtraData;
|
50
|
-
}
|
51
|
-
|
52
|
-
static async uploadQRcodeImg(
|
53
|
-
storageRef: any,
|
54
|
-
imgAsBase64: string,
|
55
|
-
actionName: string,
|
56
|
-
createdAt: string,
|
57
|
-
) {
|
58
|
-
console.log("imgAsBase64");
|
59
|
-
let imageBuffer = Buffer.from(imgAsBase64, "base64")
|
60
|
-
let file = await storageRef.file(`visitorManagement/${actionName}/qrCodes/${createdAt}`);
|
61
|
-
|
62
|
-
await file.save(
|
63
|
-
imageBuffer,
|
64
|
-
{
|
65
|
-
metadata: { contentType: "image/jpeg" },
|
66
|
-
},
|
67
|
-
() => {
|
68
|
-
return "Unable to upload the image.";
|
69
|
-
}
|
70
|
-
);
|
71
|
-
let options: object = {
|
72
|
-
action: "read",
|
73
|
-
expires: "03-17-2025",
|
74
|
-
};
|
75
|
-
const url = await file.getSignedUrl(options);
|
76
|
-
return url[0];
|
77
|
-
|
78
|
-
}
|
79
|
-
|
80
|
-
}
|
81
|
-
|
82
|
-
export { NewIn };
|
@@ -1,58 +0,0 @@
|
|
1
|
-
import * as admin from "firebase-admin";
|
2
|
-
import { Post } from "../post.model";
|
3
|
-
|
4
|
-
class SelfServe extends Post {
|
5
|
-
isProcessed: boolean = false;
|
6
|
-
|
7
|
-
static async setIncomingInfoToNewIn(visitorInfo: any, post: SelfServe){
|
8
|
-
post.actionEvent = visitorInfo.extra.actionEvent;
|
9
|
-
post.actionId = visitorInfo.extra.actionId;
|
10
|
-
post.actionName = visitorInfo.extra.actionName;
|
11
|
-
post.actionType = visitorInfo.extra.actionType;
|
12
|
-
post.companyId = visitorInfo.extra.companyId;
|
13
|
-
post.createdAt = visitorInfo.extra.createdAt;
|
14
|
-
post.description = `${visitorInfo.extra.extraData.visitorName} is going to meet ${visitorInfo.extra.extraData.whomToMeet} `;
|
15
|
-
post.eventId = visitorInfo.extra.eventId;
|
16
|
-
post.isGeofence = visitorInfo.extra.isGeofence;
|
17
|
-
post.userId = visitorInfo.userId;
|
18
|
-
|
19
|
-
const newExtraData = await this.modifyExtraDataForNewIn(visitorInfo);
|
20
|
-
|
21
|
-
post.extraData = newExtraData;
|
22
|
-
post.forApproval = visitorInfo.extra.forApproval;
|
23
|
-
post.forApprovalText = visitorInfo.extra.forApprovalText;
|
24
|
-
|
25
|
-
post.seen = visitorInfo.extra.seen;
|
26
|
-
post.endAt = "";
|
27
|
-
post.endLat = "";
|
28
|
-
post.endLong = "";
|
29
|
-
post.stepValues = visitorInfo.extra.stepValues;
|
30
|
-
post.time = visitorInfo.extra.time;
|
31
|
-
|
32
|
-
|
33
|
-
return post;
|
34
|
-
}
|
35
|
-
|
36
|
-
static async modifyExtraDataForNewIn(visitorInfo : any){
|
37
|
-
const visitorName = visitorInfo.extra.extraData.visitorName;
|
38
|
-
const personToMeet = visitorInfo.extra.extraData.whomToMeet;
|
39
|
-
const vistorPhoneNumber = visitorInfo.phone;
|
40
|
-
const checkInTimeOfVisitor = visitorInfo.checkInTime;
|
41
|
-
const visitorPicture = visitorInfo.visitorImage
|
42
|
-
|
43
|
-
const newExtraData = {
|
44
|
-
visitorName,
|
45
|
-
personToMeet,
|
46
|
-
vistorPhoneNumber,
|
47
|
-
checkInTimeOfVisitor,
|
48
|
-
visitorPicture
|
49
|
-
|
50
|
-
}
|
51
|
-
return newExtraData;
|
52
|
-
|
53
|
-
}
|
54
|
-
|
55
|
-
|
56
|
-
}
|
57
|
-
|
58
|
-
export { SelfServe };
|