mobioffice-cli 0.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/.prettierrc +4 -0
- package/README.md +1 -0
- package/a.js +3 -0
- package/lib/index.js +87 -0
- package/package.json +50 -0
- package/scripts/1.ts +1300 -0
- package/scripts/GCloudPubSub/pub-sub-config.json +12 -0
- package/scripts/GCloudPubSub/visitorAutoRejection.ts +86 -0
- package/scripts/actions/assignUsersFromOneActionToOther.ts +64 -0
- package/scripts/actions/assignUsersListToAction.ts +81 -0
- package/scripts/actions/getActionsListOfUser.ts +42 -0
- package/scripts/actions/getCompanyUserDetails.ts +49 -0
- package/scripts/actions/giveActionToUser.ts +41 -0
- package/scripts/actions/giveUsersToActivitySelector.ts +56 -0
- package/scripts/actions/groupActionsInActivitySelector.ts +101 -0
- package/scripts/actions/modifySummaryReportDB.ts +42 -0
- package/scripts/actions/setUrlToActionStep.ts +18 -0
- package/scripts/actions/syncMySqlAttendanceDBWithFirebase.ts +93 -0
- package/scripts/actions/syncMySqlMeetingsDBWithFirebase.ts +103 -0
- package/scripts/actions/test.ts +29 -0
- package/scripts/actions/transferFeedsOldIdToNew.ts +40 -0
- package/scripts/actions/transformUserIntoManager.ts +89 -0
- package/scripts/argvConfig.js +9 -0
- package/scripts/backUpData/testCode.ts +131 -0
- package/scripts/benaraScripts/addWorkAreaMap.ts +46 -0
- package/scripts/benaraScripts/add_customers.ts +26 -0
- package/scripts/benaraScripts/add_customers_contact.ts +27 -0
- package/scripts/benaraScripts/add_empty_work_area.ts +17 -0
- package/scripts/benaraScripts/assignManagers.ts +35 -0
- package/scripts/benaraScripts/changeCheckInFlag.ts +45 -0
- package/scripts/benaraScripts/createCustomerContactsList.ts +170 -0
- package/scripts/benaraScripts/createUserByDeletingOldUser.ts +70 -0
- package/scripts/benaraScripts/createUsersAreaMapCollection.ts +23 -0
- package/scripts/benaraScripts/createWorkAreaMap.ts +24 -0
- package/scripts/benaraScripts/mapWorkAreasToUsers.ts +112 -0
- package/scripts/companies_data.json +2496 -0
- package/scripts/create_or_update_users.ts +31 -0
- package/scripts/csvToJson/csvToJson.ts +90 -0
- package/scripts/csvToJson/users.json +3896 -0
- package/scripts/db.js +27 -0
- package/scripts/db.json +13 -0
- package/scripts/dbMySql.ts +63 -0
- package/scripts/delete_action_steps.ts +11 -0
- package/scripts/delete_user.ts +71 -0
- package/scripts/dev_companies_data.json +613 -0
- package/scripts/enroll.xlsx +0 -0
- package/scripts/export_users.ts +72 -0
- package/scripts/files/visitorManagementFiles/displayScreen.json +70 -0
- package/scripts/files/visitorManagementFiles/init_report_visibility.ts +79 -0
- package/scripts/firebaseConfig.js +12 -0
- package/scripts/firebaseDocs/deleteIncommingCollection.ts +47 -0
- package/scripts/firebaseDocs/updateDoc.ts +43 -0
- package/scripts/getActionDataIntoJSON/getActionData.ts +68 -0
- package/scripts/get_attendance_by_any_date.ts +14 -0
- package/scripts/get_attendance_by_month.ts +12 -0
- package/scripts/get_attendance_monthly_by_team.ts +11 -0
- package/scripts/get_daily_report.ts +10 -0
- package/scripts/get_mangers.ts +13 -0
- package/scripts/grant_user_license.ts +18 -0
- package/scripts/init_CustomCollection.ts +16 -0
- package/scripts/init_action_steps.ts +28 -0
- package/scripts/init_actions.ts +31 -0
- package/scripts/init_company.ts +18 -0
- package/scripts/init_customer_mysql.ts +12 -0
- package/scripts/init_feed.ts +4 -0
- package/scripts/init_feed_details_screen.ts +14 -0
- package/scripts/init_geofence.ts +26 -0
- package/scripts/init_print_details_screen.ts +14 -0
- package/scripts/init_report_actions.ts +24 -0
- package/scripts/init_report_definition_detail.ts +26 -0
- package/scripts/init_report_definition_summary.ts +16 -0
- package/scripts/init_report_visibility.ts +46 -0
- package/scripts/init_user_customcollection.ts +16 -0
- package/scripts/json/action.json +21 -0
- package/scripts/json/company.json +24 -0
- package/scripts/json/report-action.json +13 -0
- package/scripts/json/report-def-deet.json +43 -0
- package/scripts/json/resp.json +784 -0
- package/scripts/json/steps.json +24 -0
- package/scripts/json/test.ts +49 -0
- package/scripts/mysqlConfig.ts +9 -0
- package/scripts/revoke_or_extend_license.ts +14 -0
- package/scripts/stream.js +4 -0
- package/scripts/testing1.ts +35 -0
- package/scripts/update/doc.json +20 -0
- package/scripts/update/getDocByPath.ts +34 -0
- package/scripts/update/updateDocByPath.ts +47 -0
- package/scripts/update/updateUsersOfCompanies.ts +58 -0
- package/scripts/update_actions.ts +19 -0
- package/scripts/update_actions_steps.ts +19 -0
- package/scripts/update_company.ts +19 -0
- package/scripts/update_geofence.ts +20 -0
- package/scripts/update_managers.ts +16 -0
- package/scripts/visitorMgmt/createArea.ts +68 -0
- package/scripts/visitorMgmt/createArea.txt +3 -0
- package/scripts/visitorMgmt/createVisitorPathInstructionDocs.ts +130 -0
- package/scripts/visitorMgmt/createVisitorPathInstructionDocs.txt +18 -0
- package/scripts/visitorMgmt/encryptDateString.ts +71 -0
- package/scripts/visitorMgmt/makeHostsManagersOfEachOther.ts +117 -0
- package/scripts/whatsapp_gupshup/sendMessage.ts +97 -0
- package/src/index.ts +87 -0
- package/src/models/Feed-Details-Screen.model.ts +29 -0
- package/src/models/action.model.ts +355 -0
- package/src/models/actions/doffing.ts +71 -0
- package/src/models/actions/folding.ts +39 -0
- package/src/models/attendance.model.ts +615 -0
- package/src/models/cicoPost.model.ts +20 -0
- package/src/models/company.model.ts +975 -0
- package/src/models/contact-us/resquest.model.ts +87 -0
- package/src/models/crud/crud.ts +30 -0
- package/src/models/customCollection.model.ts +47 -0
- package/src/models/customer/customer.model.ts +85 -0
- package/src/models/deviceChangeReq.ts +150 -0
- package/src/models/dispatch.model.ts +99 -0
- package/src/models/feed.models.ts +104 -0
- package/src/models/geofence.model.ts +61 -0
- package/src/models/leaveApplicationPost.model.ts +79 -0
- package/src/models/license.model.ts +215 -0
- package/src/models/log.model.ts +25 -0
- package/src/models/meeting.model.ts +80 -0
- package/src/models/meter.model.ts +62 -0
- package/src/models/missingPunchPost.model.ts +84 -0
- package/src/models/offline.model.ts +1133 -0
- package/src/models/post.model.ts +105 -0
- package/src/models/printDetailsScreen.model.ts +30 -0
- package/src/models/pushNotifications/pushNotification.model.ts +17 -0
- package/src/models/report-actions.model.ts +57 -0
- package/src/models/report-definition-details.model.ts +89 -0
- package/src/models/report-definition.model.ts +26 -0
- package/src/models/report-definitions-summary.model.ts +59 -0
- package/src/models/report-detail-data.model.ts +49 -0
- package/src/models/report-visibility.model.ts +44 -0
- package/src/models/report.model.ts +179 -0
- package/src/models/reportGenerator.model.ts +883 -0
- package/src/models/response.model.ts +31 -0
- package/src/models/steps.factory.model.ts +195 -0
- package/src/models/storeGupShupLog.model.ts +49 -0
- package/src/models/summary.model.ts +63 -0
- package/src/models/tasks/sub-task-group.model.ts +173 -0
- package/src/models/tasks/tags.model.ts +113 -0
- package/src/models/tasks/task-group.model.ts +172 -0
- package/src/models/tasks/task.model.ts +681 -0
- package/src/models/tempCollection.model.ts +398 -0
- package/src/models/user.model.ts +319 -0
- package/src/models/utility.model.ts +100 -0
- package/src/models/visitorManagement/acknowledgement.model.ts +71 -0
- package/src/models/visitorManagement/invite.model.ts +406 -0
- package/src/models/visitorManagement/newIn.model.ts +82 -0
- package/src/models/visitorManagement/selfServe.model.ts +58 -0
- package/src/models/worklogPost.model.ts +8 -0
- package/src/services/customer.ts +382 -0
- package/src/services/meeting.ts +123 -0
- package/test/1.ts +13 -0
- package/test/db.js +19 -0
- package/test/firebaseConfig.js +1 -0
- package/tsconfig.json +16 -0
@@ -0,0 +1,172 @@
|
|
1
|
+
import * as admin from "firebase-admin";
|
2
|
+
import { SubTaskGroup } from "./sub-task-group.model";
|
3
|
+
|
4
|
+
class TaskGroup {
|
5
|
+
private _id!: string | "";
|
6
|
+
public get id(): string | "" {
|
7
|
+
return this._id;
|
8
|
+
}
|
9
|
+
public set id(value: string | "") {
|
10
|
+
this._id = value;
|
11
|
+
}
|
12
|
+
|
13
|
+
private _groupTitle!: string;
|
14
|
+
public get groupTitle(): string {
|
15
|
+
return this._groupTitle;
|
16
|
+
}
|
17
|
+
public set groupTitle(value: string) {
|
18
|
+
this._groupTitle = value;
|
19
|
+
}
|
20
|
+
|
21
|
+
private _userId?: string | undefined;
|
22
|
+
public get userId(): string | undefined {
|
23
|
+
return this._userId;
|
24
|
+
}
|
25
|
+
public set userId(value: string | undefined) {
|
26
|
+
this._userId = value;
|
27
|
+
}
|
28
|
+
|
29
|
+
private _companyId!: string;
|
30
|
+
public get companyId(): string {
|
31
|
+
return this._companyId;
|
32
|
+
}
|
33
|
+
public set companyId(value: string) {
|
34
|
+
this._companyId = value;
|
35
|
+
}
|
36
|
+
|
37
|
+
private _subGroups!: SubTaskGroup[] | [];
|
38
|
+
public get subGroups(): SubTaskGroup[] | [] {
|
39
|
+
return this._subGroups;
|
40
|
+
}
|
41
|
+
public set subGroups(value: SubTaskGroup[] | []) {
|
42
|
+
this._subGroups = value;
|
43
|
+
}
|
44
|
+
|
45
|
+
constructor() {}
|
46
|
+
|
47
|
+
argConstructor(
|
48
|
+
id: string,
|
49
|
+
groupTitle: string,
|
50
|
+
userId: string,
|
51
|
+
companyId: string,
|
52
|
+
subGroups: SubTaskGroup[]
|
53
|
+
) {
|
54
|
+
this.id = id;
|
55
|
+
this.subGroups = subGroups ?? [];
|
56
|
+
this.groupTitle = groupTitle;
|
57
|
+
this.userId = userId;
|
58
|
+
this.companyId = companyId;
|
59
|
+
}
|
60
|
+
|
61
|
+
fromJSON(taskGroup: string) {
|
62
|
+
let taskGroupJSON = JSON.parse(taskGroup);
|
63
|
+
this.id = taskGroupJSON["id"];
|
64
|
+
|
65
|
+
if (taskGroupJSON["subGroups"].length > 0) {
|
66
|
+
var i = 0;
|
67
|
+
taskGroupJSON["subGroups"].forEach((element: JSON) => {
|
68
|
+
let subTaskGroup = new SubTaskGroup();
|
69
|
+
subTaskGroup.fromJSON(JSON.stringify(element));
|
70
|
+
this.subGroups[i] = subTaskGroup;
|
71
|
+
i++;
|
72
|
+
});
|
73
|
+
} else {
|
74
|
+
this.subGroups = [];
|
75
|
+
}
|
76
|
+
this.groupTitle = taskGroupJSON["groupTitle"];
|
77
|
+
this.userId = taskGroupJSON["userId"];
|
78
|
+
this.companyId = taskGroupJSON["companyId"];
|
79
|
+
}
|
80
|
+
|
81
|
+
toJSON() {
|
82
|
+
return {
|
83
|
+
id: this.id,
|
84
|
+
subGroups: this.subGroups,
|
85
|
+
groupTitle: this.groupTitle,
|
86
|
+
userId: this.userId,
|
87
|
+
companyId: this.companyId,
|
88
|
+
};
|
89
|
+
}
|
90
|
+
|
91
|
+
async save(firestore: admin.firestore.Firestore) {
|
92
|
+
if (this.id == null || this.id == "" || this.id == undefined) {
|
93
|
+
return {
|
94
|
+
status: "ERROR",
|
95
|
+
message: "Error Saving Task Group. ID Not Found",
|
96
|
+
};
|
97
|
+
} else {
|
98
|
+
let taskDoc: admin.firestore.DocumentReference = firestore
|
99
|
+
.collection("Companies")
|
100
|
+
.doc(this.companyId)
|
101
|
+
.collection("Task-Group")
|
102
|
+
.doc(this.id);
|
103
|
+
|
104
|
+
await taskDoc.set(this.toJSON());
|
105
|
+
|
106
|
+
return {
|
107
|
+
status: "OK",
|
108
|
+
message: "Task Group Added Successfully",
|
109
|
+
path: taskDoc.path,
|
110
|
+
};
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
static async addUpdateTaskGroup(
|
115
|
+
firestore: admin.firestore.Firestore,
|
116
|
+
body: any
|
117
|
+
) {
|
118
|
+
try {
|
119
|
+
console.log("The BODY IS ", body);
|
120
|
+
let taskGroupModel = body["extra"];
|
121
|
+
console.log("The Task Model is ", taskGroupModel);
|
122
|
+
let newTaskGroup: TaskGroup = new TaskGroup();
|
123
|
+
try {
|
124
|
+
console.log(newTaskGroup);
|
125
|
+
newTaskGroup.fromJSON(JSON.stringify(taskGroupModel));
|
126
|
+
} catch (e) {
|
127
|
+
console.log("Error running newTaskGroup.fromJSON()");
|
128
|
+
throw {
|
129
|
+
status: 500,
|
130
|
+
message: "Error running newTaskGroup.fromJSON()"
|
131
|
+
}
|
132
|
+
}
|
133
|
+
console.log("The NEW TASK GROUP is ", newTaskGroup.toJSON());
|
134
|
+
let response;
|
135
|
+
try {
|
136
|
+
console.log("I AM SAVING THE TASK GROUP");
|
137
|
+
response = await newTaskGroup.save(firestore);
|
138
|
+
console.log("TASK GROUP SAVED");
|
139
|
+
} catch (e) {
|
140
|
+
console.log("Error", e);
|
141
|
+
throw {
|
142
|
+
status: 500
|
143
|
+
}
|
144
|
+
}
|
145
|
+
console.log("response", response);
|
146
|
+
// Delete Incoming Ref
|
147
|
+
if (taskGroupModel["id"] != "") {
|
148
|
+
if (response?.["status"] == "OK") {
|
149
|
+
await firestore
|
150
|
+
.collection("Incoming")
|
151
|
+
.doc(body["id"])
|
152
|
+
.delete();
|
153
|
+
} else {
|
154
|
+
await firestore
|
155
|
+
.collection("Incoming")
|
156
|
+
.doc(body["id"])
|
157
|
+
.update({ message: response?.["message"] });
|
158
|
+
}
|
159
|
+
}
|
160
|
+
return {
|
161
|
+
...response
|
162
|
+
}
|
163
|
+
} catch(error: any) {
|
164
|
+
return {
|
165
|
+
status: error?.status ?? 500,
|
166
|
+
error: error?.message ?? "Internal Server Error"
|
167
|
+
}
|
168
|
+
}
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
export { TaskGroup };
|