mobioffice-cli 1.0.0 → 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,71 +0,0 @@
|
|
1
|
-
import { createCipheriv, createDecipheriv, randomBytes } from 'crypto';
|
2
|
-
import { Utilities } from '../../src/models/utility.model';
|
3
|
-
import { createInterface } from 'readline';
|
4
|
-
|
5
|
-
const readLineInterface = createInterface({
|
6
|
-
input: process.stdin,
|
7
|
-
output: process.stdout
|
8
|
-
})
|
9
|
-
|
10
|
-
const readLine = Utilities.readLineAsync;
|
11
|
-
const readLineClose = Utilities.readLineClose;
|
12
|
-
|
13
|
-
async function encryptAString(secretText: string) {
|
14
|
-
try {
|
15
|
-
// Encryption
|
16
|
-
const algorithm = 'aes-256-cbc';
|
17
|
-
const key = "wearethebestoneswearethebestones"; // Replace with your secret key
|
18
|
-
// const iv = randomBytes(16); // Initialization Vector
|
19
|
-
const iv = "wearethebestones"; // Initialization Vector
|
20
|
-
|
21
|
-
const cipher = createCipheriv(algorithm, key, iv);
|
22
|
-
let encryptedString = cipher.update(secretText, 'utf8', 'hex');
|
23
|
-
encryptedString += cipher.final('hex');
|
24
|
-
return {
|
25
|
-
encryptedString,
|
26
|
-
key,
|
27
|
-
iv
|
28
|
-
};
|
29
|
-
} catch(error) {
|
30
|
-
console.log(error.message);
|
31
|
-
throw {
|
32
|
-
message: error.message
|
33
|
-
}
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
|
-
async function decryptEncryptedStr(encryptedString: string, key, iv) {
|
38
|
-
try {
|
39
|
-
const algorithm = 'aes-256-cbc';
|
40
|
-
// Decryption
|
41
|
-
const decipher = createDecipheriv(algorithm, key, iv);
|
42
|
-
let decryptedString = decipher.update(encryptedString, 'hex', 'utf8');
|
43
|
-
decryptedString += decipher.final('utf8');
|
44
|
-
return decryptedString;
|
45
|
-
} catch(error) {
|
46
|
-
console.log(error.message);
|
47
|
-
throw {
|
48
|
-
message: error.message
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
async function main() {
|
54
|
-
try {
|
55
|
-
const secretText: any = await readLine("Provide secret text: ", readLineInterface);
|
56
|
-
const encryptionPayload = await encryptAString(secretText);
|
57
|
-
const encStr = encryptionPayload.encryptedString;
|
58
|
-
const key = encryptionPayload.key;
|
59
|
-
const iv = encryptionPayload.iv;
|
60
|
-
console.log("Encrypted String:", encStr);
|
61
|
-
const decryptedString = await decryptEncryptedStr(encStr, key, iv);
|
62
|
-
console.log("Decrypted String:", decryptedString);
|
63
|
-
console.log(JSON.parse(decryptedString));
|
64
|
-
readLineClose(readLineInterface);
|
65
|
-
} catch(error) {
|
66
|
-
console.log(error.message)
|
67
|
-
readLineClose(readLineInterface);
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
main();
|
@@ -1,117 +0,0 @@
|
|
1
|
-
import admin from "../db";
|
2
|
-
import { Utilities } from "../../src/models/utility.model";
|
3
|
-
import { createInterface } from "readline";
|
4
|
-
import { Company } from "../../src/models/company.model";
|
5
|
-
import { report } from "process";
|
6
|
-
|
7
|
-
const readLine = Utilities.readLineAsync;
|
8
|
-
const readLineClose = Utilities.readLineClose;
|
9
|
-
|
10
|
-
const readLineInterface = createInterface({
|
11
|
-
input: process.stdin,
|
12
|
-
output: process.stdout
|
13
|
-
})
|
14
|
-
|
15
|
-
async function makeHostsManagersOfEachOther() {
|
16
|
-
try {
|
17
|
-
const firestore = admin.firestore();
|
18
|
-
const companyNickname: any = await readLine("Enter company Nick name: ", readLineInterface);
|
19
|
-
const companyId = await Company.getCompanyIdByNickName(firestore, companyNickname);
|
20
|
-
console.log("Found companyId: ", companyId)
|
21
|
-
const usersList = await firestore.collection("Companies")
|
22
|
-
.doc(companyId)
|
23
|
-
.collection("Users")
|
24
|
-
.get();
|
25
|
-
const hosts: any = [];
|
26
|
-
const others: any = [];
|
27
|
-
usersList.docs.forEach((doc) => {
|
28
|
-
const roles = doc.data().roles;
|
29
|
-
if (roles.includes("host")) {
|
30
|
-
hosts.push(doc.data())
|
31
|
-
} else {
|
32
|
-
others.push(doc.data())
|
33
|
-
}
|
34
|
-
})
|
35
|
-
// console.log("others", others);
|
36
|
-
const reportingToInfo = hosts.map((hostInfo) => {
|
37
|
-
return {
|
38
|
-
name: hostInfo.name,
|
39
|
-
id: hostInfo.id
|
40
|
-
}
|
41
|
-
})
|
42
|
-
const reportingToIds: any[] = []
|
43
|
-
const reportingToNames: any[] = []
|
44
|
-
reportingToInfo.forEach((obj) => {
|
45
|
-
if (obj.name !== "Samyak Jain") {
|
46
|
-
reportingToIds.push(obj.id);
|
47
|
-
reportingToNames.push(obj.name);
|
48
|
-
}
|
49
|
-
})
|
50
|
-
console.log(reportingToIds);
|
51
|
-
console.log(reportingToNames);
|
52
|
-
const exceptions = ["Meet Patel", "Harmi"];
|
53
|
-
const usersToUpdate: any[] = [];
|
54
|
-
others.forEach((obj) => {
|
55
|
-
if (!exceptions.includes(obj.name)) {
|
56
|
-
usersToUpdate.push({
|
57
|
-
name: obj.name,
|
58
|
-
id: obj.id
|
59
|
-
});
|
60
|
-
}
|
61
|
-
})
|
62
|
-
await Promise.all(usersToUpdate.map(async (user) => {
|
63
|
-
const userFirebaseDoc = await firestore.collection("Companies")
|
64
|
-
.doc(companyId)
|
65
|
-
.collection("Users")
|
66
|
-
.doc(user.id)
|
67
|
-
.get();
|
68
|
-
let updatedUserInfo: any = userFirebaseDoc.data();
|
69
|
-
updatedUserInfo.reportingTo = reportingToIds;
|
70
|
-
updatedUserInfo.managers = reportingToNames;
|
71
|
-
userFirebaseDoc.ref.set(updatedUserInfo);
|
72
|
-
}))
|
73
|
-
console.log(usersToUpdate);
|
74
|
-
// others.forEach(())
|
75
|
-
// const hostManagerMap = {};
|
76
|
-
// console.log(reportingToInfo);
|
77
|
-
// reportingToInfo.forEach((hostInfo) => {
|
78
|
-
// const reportingToIdArrOfCurrHost: any = [];
|
79
|
-
// const reportingToNameArr: any = [];
|
80
|
-
// reportingToInfo.forEach((obj) => {
|
81
|
-
// if (hostInfo.id !== obj.id && obj.name !== 'Samyak Jain') {
|
82
|
-
// reportingToIdArrOfCurrHost.push(obj.id)
|
83
|
-
// reportingToNameArr.push(obj.name);
|
84
|
-
// }
|
85
|
-
// })
|
86
|
-
// hostManagerMap[hostInfo.id] = {
|
87
|
-
// reportingTo: reportingToIdArrOfCurrHost,
|
88
|
-
// managers: reportingToNameArr
|
89
|
-
// }
|
90
|
-
// })
|
91
|
-
// console.log(hostManagerMap);
|
92
|
-
// await Promise.all(hosts.map((async (hostInfo) => {
|
93
|
-
// const hostFirebaseDoc = await firestore.collection("Companies")
|
94
|
-
// .doc(companyId)
|
95
|
-
// .collection("Users")
|
96
|
-
// .doc(hostInfo.id)
|
97
|
-
// .get();
|
98
|
-
// const updatedHostDoc: any = hostFirebaseDoc.data();
|
99
|
-
// if (updatedHostDoc.name !== "Samyak Jain") {
|
100
|
-
// updatedHostDoc.reportingTo = hostManagerMap[updatedHostDoc.id].reportingTo;
|
101
|
-
// updatedHostDoc.managers = hostManagerMap[updatedHostDoc.id].managers;
|
102
|
-
// console.log(updatedHostDoc);
|
103
|
-
// // await hostFirebaseDoc.ref.set(updatedHostDoc);
|
104
|
-
// }
|
105
|
-
// })))
|
106
|
-
readLineClose(readLineInterface);
|
107
|
-
} catch(error) {
|
108
|
-
console.log(error);
|
109
|
-
readLineClose(readLineInterface);
|
110
|
-
}
|
111
|
-
}
|
112
|
-
|
113
|
-
async function main() {
|
114
|
-
await makeHostsManagersOfEachOther();
|
115
|
-
}
|
116
|
-
|
117
|
-
main();
|
@@ -1,97 +0,0 @@
|
|
1
|
-
import fetchNpmNode from "isomorphic-fetch";
|
2
|
-
import { Utilities } from "../../src/models/utility.model";
|
3
|
-
import { createInterface } from "readline";
|
4
|
-
const readLineAsync = Utilities.readLineAsync;
|
5
|
-
const readLineClose = Utilities.readLineClose;
|
6
|
-
const readLineInterface = createInterface({
|
7
|
-
input: process.stdin,
|
8
|
-
output: process.stdout
|
9
|
-
});
|
10
|
-
const companyName = "Mobioffice";
|
11
|
-
|
12
|
-
async function sendMessage() {
|
13
|
-
try {
|
14
|
-
const phoneNumberListStr: any = await readLineAsync("Please provide comma separated 10 digit phone numbers: ", readLineInterface);
|
15
|
-
const phoneNumbers = phoneNumberListStr.split(",").map((phnNum) => {
|
16
|
-
return phnNum.trim();
|
17
|
-
});
|
18
|
-
const areNumbersValid = phoneNumbers.every((phone) => phone.length == 10);
|
19
|
-
if (!areNumbersValid) {
|
20
|
-
throw {
|
21
|
-
message: "Some of the phone numbers are not of 10 digits"
|
22
|
-
}
|
23
|
-
}
|
24
|
-
const templateId: any = await readLineAsync("Please enter the template Name: ", readLineInterface);
|
25
|
-
console.log(phoneNumbers);
|
26
|
-
let dataString = template_dataString_map[templateId].dataString;
|
27
|
-
if (!dataString) {
|
28
|
-
throw {
|
29
|
-
message: "templateId you provided is not invalid"
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
const result = await Promise.all(phoneNumbers.map(async (destinationNumber, idx ) => {
|
34
|
-
const dataStringToSend = dataString.replace("__destinationNumber__", destinationNumber);
|
35
|
-
console.log(dataStringToSend);
|
36
|
-
const resp1: any = await fetchNpmNode(gupshup_Whatsapp_gate.api_url, {
|
37
|
-
method: "POST",
|
38
|
-
body: dataStringToSend,
|
39
|
-
headers: {
|
40
|
-
apikey: gupshup_Whatsapp_gate.api_key,
|
41
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
42
|
-
},
|
43
|
-
});
|
44
|
-
return {
|
45
|
-
response1: resp1
|
46
|
-
}
|
47
|
-
}))
|
48
|
-
console.log("-----------result---------", result);
|
49
|
-
} catch(error) {
|
50
|
-
console.log("Error:", error.message);
|
51
|
-
} finally {
|
52
|
-
readLineClose(readLineInterface);
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
sendMessage();
|
57
|
-
|
58
|
-
const gupshup_Whatsapp_host = {
|
59
|
-
api_key: "anqheagsugk5ilfmeyuzuv4k0p5f0xsi",
|
60
|
-
api_url: "https://api.gupshup.io/sm/api/v1/template/msg",
|
61
|
-
channel: "whatsapp",
|
62
|
-
source: "919925039603",
|
63
|
-
templateId_host_instructions: "89f46092-28fe-4ddf-8a11-b5da8c34e89e",
|
64
|
-
}
|
65
|
-
|
66
|
-
const gupshup_Whatsapp_gate = {
|
67
|
-
api_key: "anqheagsugk5ilfmeyuzuv4k0p5f0xsi",
|
68
|
-
api_url: "https://api.gupshup.io/sm/api/v1/template/msg",
|
69
|
-
channel: "whatsapp",
|
70
|
-
source: "919925039603",
|
71
|
-
templateId_atGate_instructions: "37dbb2e4-d7cb-4df1-86f3-35fc6ceafaf4",
|
72
|
-
}
|
73
|
-
|
74
|
-
const template_dataString_map = {
|
75
|
-
"89f46092-28fe-4ddf-8a11-b5da8c34e89e": {
|
76
|
-
requirementMsgs: ["Please provide comma separated 10 digit phone numbers: ", "Please provide visitor name", "Please provide area name", "Please provide"],
|
77
|
-
dataString: `'channel=${gupshup_Whatsapp_gate.channel}&source=${gupshup_Whatsapp_gate.source}&destination=__destinationNumber__&src.name=mymobioffice&template=%7B%22id%22:%22${gupshup_Whatsapp_gate.templateId_atGate_instructions}%22,%22params%22:%5B%22${companyName}%22,%22__visitorName__%22,%22__hostName__%22,%22__areaName__%22%5D%7D'`,
|
78
|
-
},
|
79
|
-
"37dbb2e4-d7cb-4df1-86f3-35fc6ceafaf4": {
|
80
|
-
requirementMsgs: ["Please provide comma separated 10 digit phone numbers: ", ],
|
81
|
-
dataString: `'channel=${gupshup_Whatsapp_host.channel}&source=${gupshup_Whatsapp_host.source}&destination=__destinationNumber__&src.name=mymobioffice&template=%7B%22id%22:%22${gupshup_Whatsapp_host.templateId_host_instructions}%22,%22params%22:%5B%22${companyName}%22,%22__visitorName__%22,%22__hostName__%22%5D%7D'`
|
82
|
-
},
|
83
|
-
"vmVideoMsg": {
|
84
|
-
requirementMsgs: ["Please provide comma separated 10 digit phone numbers: ", ],
|
85
|
-
dataString: 'channel=whatsapp&source=919925039603&destination=__destinationNumber__&src.name=mymobioffice&template=%7B%22id%22:%22fc4fff94-d495-4278-b288-58f12ee089ad%22,%22params%22:%5B%5D%7D&message=%7B%22type%22:%22video%22,%22video%22:%7B%22id%22:%22c8711d40-7e88-4eb7-b3f8-bd298d733116%22%7D%7D&'
|
86
|
-
},
|
87
|
-
"e2dcfdb4-1cef-4a6e-90ec-e70f0274e209": {
|
88
|
-
requirementMsgs: [],
|
89
|
-
dataString: 'channel=whatsapp&source=919925039603&destination=__destinationNumber__&src.name=mymobioffice&template=%7B%22id%22:%22e2dcfdb4-1cef-4a6e-90ec-e70f0274e209%22,%22params%22:%5B%226%22,%22__DATE__%22,%22__URL__%22%5D%7D'
|
90
|
-
},
|
91
|
-
"49f26e4c-93b4-4e87-bc30-569ea7eb2e31": {
|
92
|
-
requirementMsgs: [],
|
93
|
-
dataString: 'channel=whatsapp&source=919925039603&destination=__destinationNumber__&src.name=mymobioffice&template=%7B%22id%22:%2249f26e4c-93b4-4e87-bc30-569ea7eb2e31%22,%22params%22:%5B%22Tarun Chelumalla%22,%22Mobi office%22,%22Tarun%22,%2203:00%20pm%20on%2021/11/2023%22%5D%7D&message=%7B%22type%22:%22image%22,%22image%22:%7B%22link%22:%22https://www.simplilearn.com/ice9/free_resources_article_thumb/what_is_image_Processing.jpg%22%7D%7D&'
|
94
|
-
}
|
95
|
-
}
|
96
|
-
|
97
|
-
// 'channel=whatsapp&source=919925039603&destination=__destinationNumber__&src.name=mymobioffice&template=%7B%22id%22:%22fc4fff94-d495-4278-b288-58f12ee089ad%22,%22params%22:%5B%5D%7D&message=%7B%22type%22:%22video%22,%22video%22:%7B%22id%22:%22c8711d40-7e88-4eb7-b3f8-bd298d733116%22%7D%7D&'
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import * as admin from 'firebase-admin';
|
2
|
-
import { Company } from './company.model';
|
3
|
-
|
4
|
-
class FeedDetailsScreen {
|
5
|
-
|
6
|
-
static async createFeedDetailsScreen(firestore:admin.firestore.Firestore,nickName:string,data:any){
|
7
|
-
let companyId = await Company.getCompanyIdbyNickname(firestore,nickName);
|
8
|
-
let snapshot = firestore
|
9
|
-
.collection("Companies")
|
10
|
-
.doc(companyId)
|
11
|
-
.collection("Feed-Details-Screen").doc()
|
12
|
-
data.id = snapshot.id
|
13
|
-
await snapshot.set(data)
|
14
|
-
return data
|
15
|
-
}
|
16
|
-
|
17
|
-
static async updateFeedDetailsScreen(firestore:admin.firestore.Firestore,nickName:string,data:any){
|
18
|
-
let companyId = await Company.getCompanyIdbyNickname(firestore,nickName);
|
19
|
-
let snapshot = await firestore
|
20
|
-
.collection("Companies")
|
21
|
-
.doc(companyId)
|
22
|
-
.collection("Feed-Details-Screen").where("actionName","==",data.actionName).get()
|
23
|
-
snapshot.forEach((doc)=>{
|
24
|
-
doc.ref.update(data)
|
25
|
-
})
|
26
|
-
}
|
27
|
-
|
28
|
-
}
|
29
|
-
export { FeedDetailsScreen };
|
@@ -1,355 +0,0 @@
|
|
1
|
-
import { Company } from "./company.model";
|
2
|
-
import * as admin from "firebase-admin";
|
3
|
-
import { Attendance } from "./attendance.model";
|
4
|
-
|
5
|
-
class Action {
|
6
|
-
actionType: string = "";
|
7
|
-
companyId: string = "";
|
8
|
-
displayName: string = "";
|
9
|
-
end_label: string = "";
|
10
|
-
icon: string = "";
|
11
|
-
id: string = "";
|
12
|
-
idForReport: string = "";
|
13
|
-
name: string = "";
|
14
|
-
order: number = 0;
|
15
|
-
require_location: boolean = false;
|
16
|
-
require_selfie: boolean = false;
|
17
|
-
startCollectionName: string = "";
|
18
|
-
start_label: string = "";
|
19
|
-
users: string[] = [];
|
20
|
-
forApproval?: boolean = false;
|
21
|
-
|
22
|
-
initViaSnapshotDoc(doc: any) {
|
23
|
-
var _data = doc.data();
|
24
|
-
this.companyId = _data.companyId;
|
25
|
-
this.displayName = _data.displayName;
|
26
|
-
this.end_label = _data.end_label;
|
27
|
-
this.icon = _data.icon;
|
28
|
-
this.id = _data.id;
|
29
|
-
this.idForReport = _data.idForReport;
|
30
|
-
this.name = _data.name;
|
31
|
-
this.order = _data.order;
|
32
|
-
this.require_location = _data.require_location;
|
33
|
-
this.require_selfie = _data.require_selfie;
|
34
|
-
this.startCollectionName = _data.startCollectionName;
|
35
|
-
this.start_label = _data.start_label;
|
36
|
-
this.users = _data.users;
|
37
|
-
}
|
38
|
-
|
39
|
-
static ActionType = {
|
40
|
-
CICO: "checkInOut",
|
41
|
-
REPORT: "report",
|
42
|
-
WORKLOG: "worklog",
|
43
|
-
};
|
44
|
-
|
45
|
-
static async getActionByName(
|
46
|
-
firestore: admin.firestore.Firestore,
|
47
|
-
name: string,
|
48
|
-
nickname: string
|
49
|
-
) {
|
50
|
-
let companyId = await Company.getCompanyIdbyNickname(firestore, nickname);
|
51
|
-
const snap = await firestore
|
52
|
-
.collection("Companies")
|
53
|
-
.doc(companyId)
|
54
|
-
.collection("Actions")
|
55
|
-
.where("name", "==", name)
|
56
|
-
.get();
|
57
|
-
const data = snap.docs.map((obj) => obj.data());
|
58
|
-
return data[0];
|
59
|
-
}
|
60
|
-
|
61
|
-
static async getActionId(
|
62
|
-
firestore: admin.firestore.Firestore,
|
63
|
-
companyId: string,
|
64
|
-
action: string
|
65
|
-
) {
|
66
|
-
let user_attendance = await firestore
|
67
|
-
.collection("Companies")
|
68
|
-
.doc(companyId)
|
69
|
-
.collection("Actions")
|
70
|
-
.where("name", "==", action)
|
71
|
-
.get();
|
72
|
-
let actionId = user_attendance.docs.map((doc) => doc.data());
|
73
|
-
return actionId[0]?.id;
|
74
|
-
}
|
75
|
-
|
76
|
-
static async getActionGroupId(
|
77
|
-
firestore: admin.firestore.Firestore,
|
78
|
-
companyId: string,
|
79
|
-
actionId: string
|
80
|
-
) {
|
81
|
-
try {
|
82
|
-
let reportActionDocArr = await firestore
|
83
|
-
.collection("Companies")
|
84
|
-
.doc(companyId)
|
85
|
-
.collection("Report-Actions")
|
86
|
-
.where("id", "==", actionId)
|
87
|
-
.get();
|
88
|
-
if (reportActionDocArr.docs.length) {
|
89
|
-
const reportActionData = reportActionDocArr.docs[0].data();
|
90
|
-
return reportActionData.activityFor;
|
91
|
-
} else {
|
92
|
-
return null;
|
93
|
-
}
|
94
|
-
} catch(error) {
|
95
|
-
return null;
|
96
|
-
}
|
97
|
-
}
|
98
|
-
|
99
|
-
static async getActionIdbyDisplayName(
|
100
|
-
firestore: admin.firestore.Firestore,
|
101
|
-
companyId: string,
|
102
|
-
action: string
|
103
|
-
) {
|
104
|
-
let user_attendance = await firestore
|
105
|
-
.collection("Companies")
|
106
|
-
.doc(companyId)
|
107
|
-
.collection("Actions")
|
108
|
-
.where("displayName", "==", action)
|
109
|
-
.get();
|
110
|
-
let actionId = user_attendance.docs.map((doc) => doc.data());
|
111
|
-
return actionId[0].id;
|
112
|
-
}
|
113
|
-
|
114
|
-
static async getActionIdByDisplayName(firestore:admin.firestore.Firestore,companyId:string,action:string){
|
115
|
-
let user_attendance = await firestore.collection('Companies').doc(companyId).collection('Actions').where('displayName','==',action).get()
|
116
|
-
let actionId = user_attendance.docs.map((doc)=>doc.data())
|
117
|
-
return actionId[0].id
|
118
|
-
}
|
119
|
-
|
120
|
-
static async addUserIdInAction(firestore:admin.firestore.Firestore,arrayUnion:any,actionName:string,companyId:string,userId:string){
|
121
|
-
let actionId = await Action.getActionId(firestore,companyId,actionName);
|
122
|
-
await firestore.collection('Companies').doc(companyId).collection('Actions').doc(actionId).update({
|
123
|
-
users:arrayUnion(userId)
|
124
|
-
})
|
125
|
-
return "updated"
|
126
|
-
}
|
127
|
-
|
128
|
-
static async getActionNamebyUser(firestore:admin.firestore.Firestore,companyId:string,UserId:string){
|
129
|
-
try {
|
130
|
-
let snapshot = await firestore.collection("Companies").doc(companyId).collection('Actions').where('users','array-contains',UserId).get()
|
131
|
-
let actions = snapshot.docs.map((doc)=>{
|
132
|
-
return doc.data().name
|
133
|
-
})
|
134
|
-
return actions
|
135
|
-
} catch (error: any) {
|
136
|
-
throw new Error(error);
|
137
|
-
}
|
138
|
-
}
|
139
|
-
|
140
|
-
// static async getActionsByPhone(firestore:admin.firestore.Firestore,phone:string) {
|
141
|
-
// var companies = await Company.getCompanyDocByPhone(phone);
|
142
|
-
// var uid = ""; //User.getIdByPhone(phone);
|
143
|
-
// var actions = [];
|
144
|
-
// for (var company of companies) {
|
145
|
-
// var actionModel = await db
|
146
|
-
// .collection("Companies")
|
147
|
-
// .doc(company.id)
|
148
|
-
// .collection("Actions")
|
149
|
-
// .where("users", "array-contains", uid)
|
150
|
-
// .get();
|
151
|
-
// actions.push(actionModel);
|
152
|
-
// }
|
153
|
-
// return actions;
|
154
|
-
// }
|
155
|
-
|
156
|
-
static async getOrCreateAction(
|
157
|
-
firestore: admin.firestore.Firestore,
|
158
|
-
actionMap: any
|
159
|
-
) {
|
160
|
-
actionMap.companyId = await Company.getCompanyIdbyNickname(
|
161
|
-
firestore,
|
162
|
-
actionMap.companyId
|
163
|
-
);
|
164
|
-
var action = await firestore
|
165
|
-
.collection("Companies")
|
166
|
-
.doc(actionMap.companyId)
|
167
|
-
.collection("Actions")
|
168
|
-
.where("name", "==", actionMap.name)
|
169
|
-
.get();
|
170
|
-
if(action.empty){
|
171
|
-
//actionMap = await Action.convertingActionDataType(actionMap)
|
172
|
-
let actionRef = firestore
|
173
|
-
.collection("Companies")
|
174
|
-
.doc(actionMap.companyId)
|
175
|
-
.collection("Actions")
|
176
|
-
.doc();
|
177
|
-
actionMap.id = actionRef.id;
|
178
|
-
if(actionMap.actionType == "report" || actionMap.actionType == "doffing" ||actionMap.actionType == "folding"){
|
179
|
-
actionMap.idForReport = actionRef.id;
|
180
|
-
}
|
181
|
-
await actionRef.set({ ...actionMap });
|
182
|
-
return actionMap;
|
183
|
-
}
|
184
|
-
else {
|
185
|
-
return action.docs[0].data();
|
186
|
-
}
|
187
|
-
}
|
188
|
-
|
189
|
-
static async convertingActionDataType(data:any){
|
190
|
-
if(data['order']){
|
191
|
-
data.order = Number(data.order)
|
192
|
-
}
|
193
|
-
if(data['require_location']){
|
194
|
-
data['require_location'] = await Action.booleanConvertion(data['require_location']);
|
195
|
-
}
|
196
|
-
if(data['require_selfie']){
|
197
|
-
data['require_selfie'] = await Action.booleanConvertion(data['require_selfie']);
|
198
|
-
}
|
199
|
-
if(data['forApproval']){
|
200
|
-
data['forApproval'] = await Action.booleanConvertion(data['forApproval']);
|
201
|
-
}
|
202
|
-
if(data['isFaceDetected']){
|
203
|
-
data['isFaceDetected'] = await Action.booleanConvertion(data['isFaceDetected']);
|
204
|
-
}
|
205
|
-
return data
|
206
|
-
}
|
207
|
-
|
208
|
-
static async booleanConvertion(value:any){
|
209
|
-
if(value){
|
210
|
-
value = (value.toLowerCase() == "true");
|
211
|
-
}else{
|
212
|
-
value = ""
|
213
|
-
}
|
214
|
-
return value
|
215
|
-
}
|
216
|
-
|
217
|
-
static async updateActions(firestore:admin.firestore.Firestore,arrayUnion:any,nickName:string,actionName:string,newDetails:any){
|
218
|
-
let companyId = await Company.getCompanyIdbyNickname(firestore,nickName);
|
219
|
-
let actionId = await Action.getActionId(firestore,companyId,actionName)
|
220
|
-
let snapshot = await firestore.collection("Companies").doc(companyId).collection('Actions').doc(actionId)
|
221
|
-
//newDetails = await Action.convertingActionDataType(newDetails)
|
222
|
-
if(newDetails.users){
|
223
|
-
for(let user of newDetails.users){
|
224
|
-
console.log(user)
|
225
|
-
snapshot.update({
|
226
|
-
users:arrayUnion(user)
|
227
|
-
})
|
228
|
-
}
|
229
|
-
|
230
|
-
delete newDetails.users
|
231
|
-
}
|
232
|
-
snapshot.update(newDetails)
|
233
|
-
return 'Updated successfully'
|
234
|
-
}
|
235
|
-
|
236
|
-
static async actionStep(firestore:admin.firestore.Firestore,nickName:string,actionName:string,actionStep:any){
|
237
|
-
// actionStep = await Action.convertingActionStepsDataType(actionStep)
|
238
|
-
let companyId = await Company.getCompanyIdbyNickname(firestore,nickName)
|
239
|
-
let action = await Action.getActionByName(firestore,actionName,nickName)
|
240
|
-
const result = await Action.getOrCreateStep(firestore,actionStep,companyId,action)
|
241
|
-
return result;
|
242
|
-
}
|
243
|
-
|
244
|
-
static async convertingActionStepsDataType(data:any){
|
245
|
-
if(data.order){
|
246
|
-
data.order = Number(data.order)
|
247
|
-
}
|
248
|
-
if(data.field){
|
249
|
-
if(data.field.isRequired){
|
250
|
-
data.field.isRequired = await Action.booleanConvertion(data.field.isRequired)
|
251
|
-
}
|
252
|
-
if(data.field.isMultiline){
|
253
|
-
data.field.isMultiline = await Action.booleanConvertion(data.field.isMultiline)
|
254
|
-
}
|
255
|
-
if(data.field.autoChangePage){
|
256
|
-
data.field.autoChangePage = await Action.booleanConvertion(data.field.autoChangePage)
|
257
|
-
}
|
258
|
-
if(data.field.isAPICalled){
|
259
|
-
data.field.isAPICalled = await Action.booleanConvertion(data.field.isAPICalled)
|
260
|
-
}
|
261
|
-
if(data.field.isImagePickerNeeded){
|
262
|
-
data.field.isImagePickerNeeded = await Action.booleanConvertion(data.field.isImagePickerNeeded)
|
263
|
-
}
|
264
|
-
}
|
265
|
-
return data;
|
266
|
-
}
|
267
|
-
|
268
|
-
|
269
|
-
static async getOrCreateStep(firestore:admin.firestore.Firestore,step:any,companyId:string, action:any) {
|
270
|
-
let docRef = firestore
|
271
|
-
.collection("Companies")
|
272
|
-
.doc(companyId)
|
273
|
-
.collection("Actions")
|
274
|
-
.doc(action.id)
|
275
|
-
.collection(action.startCollectionName)
|
276
|
-
let snapshot = await docRef.where('label','==',step.label).get()
|
277
|
-
if(snapshot.empty){
|
278
|
-
let addStep_snapshot = docRef.doc()
|
279
|
-
step.id = addStep_snapshot.id;
|
280
|
-
addStep_snapshot.set({ ...step });
|
281
|
-
return step
|
282
|
-
}else{
|
283
|
-
return snapshot.docs[0].data()
|
284
|
-
}
|
285
|
-
}
|
286
|
-
|
287
|
-
static async updateActionsStep(firestore:admin.firestore.Firestore,nickName:string,actionName:string,actionSteps:any){
|
288
|
-
let companyId = await Company.getCompanyIdbyNickname(firestore,nickName)
|
289
|
-
let action = await Action.getActionByName(firestore,actionName,nickName)
|
290
|
-
let snapshot = await firestore.collection('Companies').doc(companyId).collection('Actions').doc(action.id).collection(action.startCollectionName).where('label','==',actionSteps.label).get()
|
291
|
-
if(snapshot.empty){
|
292
|
-
return `Given data invalid`
|
293
|
-
}else{
|
294
|
-
snapshot.docs[0].ref.update(actionSteps)
|
295
|
-
return snapshot.docs[0].data().id
|
296
|
-
}
|
297
|
-
}
|
298
|
-
|
299
|
-
static actionTemplate = {
|
300
|
-
actionType: "",
|
301
|
-
companyId: "",
|
302
|
-
displayName: "",
|
303
|
-
end_label: "",
|
304
|
-
icon: "",
|
305
|
-
id: "",
|
306
|
-
idForReport: "",
|
307
|
-
name: "",
|
308
|
-
order: 3,
|
309
|
-
require_location: false,
|
310
|
-
require_selfie: false,
|
311
|
-
startCollectionName: "",
|
312
|
-
start_label: "",
|
313
|
-
users: [],
|
314
|
-
};
|
315
|
-
|
316
|
-
static async deleteActionSteps(firestore:admin.firestore.Firestore,nickName:string,actionName:string,label:string){
|
317
|
-
let companyId = await Company.getCompanyIdbyNickname(firestore,nickName)
|
318
|
-
let action = await Action.getActionByName(firestore,actionName,nickName)
|
319
|
-
let snapshot = await firestore.collection("Companies").doc(companyId).collection("Actions").doc(action.id).collection(action.startCollectionName).where('label','==',label).get()
|
320
|
-
|
321
|
-
if(snapshot.empty){
|
322
|
-
return `Given data invalid`
|
323
|
-
}else{
|
324
|
-
snapshot.docs[0].ref.delete()
|
325
|
-
return "Deleted successfully"
|
326
|
-
}
|
327
|
-
}
|
328
|
-
|
329
|
-
static async updateMeetingStatus(firestore:admin.firestore.Firestore,companyId:string,userId:string,eventId:string,time:number){
|
330
|
-
let actionId = await Action.getActionId(firestore,companyId,"meeting")
|
331
|
-
const meetingDocRef = await firestore.collection("Companies")
|
332
|
-
.doc(companyId)
|
333
|
-
.collection("Actions")
|
334
|
-
.doc(actionId)
|
335
|
-
.collection("meetings")
|
336
|
-
.where("userId","==",userId)
|
337
|
-
.where("eventId","==",eventId)
|
338
|
-
.get()
|
339
|
-
if (meetingDocRef.docs.length) {
|
340
|
-
let extraData = meetingDocRef.docs[0].data().extraData
|
341
|
-
extraData = {
|
342
|
-
...extraData,
|
343
|
-
"End Time":time
|
344
|
-
}
|
345
|
-
console.log(extraData)
|
346
|
-
meetingDocRef.forEach((doc)=>{
|
347
|
-
doc.ref.update({
|
348
|
-
extraData:extraData
|
349
|
-
})
|
350
|
-
})
|
351
|
-
}
|
352
|
-
}
|
353
|
-
}
|
354
|
-
|
355
|
-
export { Action };
|