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
@@ -0,0 +1,154 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.SubTaskGroup = void 0;
|
4
|
+
class SubTaskGroup {
|
5
|
+
_id;
|
6
|
+
get id() {
|
7
|
+
return this._id;
|
8
|
+
}
|
9
|
+
set id(value) {
|
10
|
+
this._id = value;
|
11
|
+
}
|
12
|
+
_groupId;
|
13
|
+
get groupId() {
|
14
|
+
return this._groupId;
|
15
|
+
}
|
16
|
+
set groupId(value) {
|
17
|
+
this._groupId = value;
|
18
|
+
}
|
19
|
+
_title;
|
20
|
+
get title() {
|
21
|
+
return this._title;
|
22
|
+
}
|
23
|
+
set title(value) {
|
24
|
+
this._title = value;
|
25
|
+
}
|
26
|
+
_userId;
|
27
|
+
get userId() {
|
28
|
+
return this._userId;
|
29
|
+
}
|
30
|
+
set userId(value) {
|
31
|
+
this._userId = value;
|
32
|
+
}
|
33
|
+
_companyId;
|
34
|
+
get companyId() {
|
35
|
+
return this._companyId;
|
36
|
+
}
|
37
|
+
set companyId(value) {
|
38
|
+
this._companyId = value;
|
39
|
+
}
|
40
|
+
constructor() { }
|
41
|
+
argConstructor(id, groupId, title, userId, companyId) {
|
42
|
+
this.id = id;
|
43
|
+
this.groupId = groupId;
|
44
|
+
this.title = title;
|
45
|
+
this.userId = userId;
|
46
|
+
this.companyId = companyId;
|
47
|
+
}
|
48
|
+
fromJSON(subTaskGroup) {
|
49
|
+
let subTaskGroupJSON = JSON.parse(subTaskGroup);
|
50
|
+
this.groupId = subTaskGroupJSON["groupId"];
|
51
|
+
this.id = subTaskGroupJSON["id"];
|
52
|
+
this.title = subTaskGroupJSON["title"];
|
53
|
+
this.userId = subTaskGroupJSON["userId"];
|
54
|
+
this.companyId = subTaskGroupJSON["companyId"];
|
55
|
+
}
|
56
|
+
toJSON() {
|
57
|
+
return {
|
58
|
+
id: this.id,
|
59
|
+
title: this.title,
|
60
|
+
groupId: this.groupId,
|
61
|
+
userId: this.userId,
|
62
|
+
companyId: this.companyId,
|
63
|
+
};
|
64
|
+
}
|
65
|
+
getValue(key) {
|
66
|
+
switch (key) {
|
67
|
+
case "id":
|
68
|
+
return this.id;
|
69
|
+
case "title":
|
70
|
+
return this.title;
|
71
|
+
case "groupId":
|
72
|
+
return this.groupId;
|
73
|
+
case "userId":
|
74
|
+
return this.userId;
|
75
|
+
case "companyId":
|
76
|
+
return this.companyId;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
async save(firestore) {
|
80
|
+
if (this.id == null || this.id == "" || this.id == undefined) {
|
81
|
+
return {
|
82
|
+
status: "ERROR",
|
83
|
+
message: "Error Saving Task Group. ID Not Found",
|
84
|
+
};
|
85
|
+
}
|
86
|
+
else {
|
87
|
+
let subGroupDoc = firestore
|
88
|
+
.collection("Companies")
|
89
|
+
.doc(this.companyId)
|
90
|
+
.collection("Task-Group")
|
91
|
+
.doc(this.groupId);
|
92
|
+
try {
|
93
|
+
let groupData = await subGroupDoc.get();
|
94
|
+
if (groupData.get("subGroups").length > 0) {
|
95
|
+
var allSGs = groupData.get("subGroups");
|
96
|
+
allSGs.push(this.toJSON());
|
97
|
+
console.log("allSGs", allSGs);
|
98
|
+
await subGroupDoc.update({
|
99
|
+
subGroups: allSGs,
|
100
|
+
});
|
101
|
+
}
|
102
|
+
else {
|
103
|
+
await subGroupDoc.update({
|
104
|
+
subGroups: [this.toJSON()],
|
105
|
+
});
|
106
|
+
}
|
107
|
+
}
|
108
|
+
catch (e) {
|
109
|
+
console.log("Error in updating sub group", e);
|
110
|
+
}
|
111
|
+
return { status: "OK", message: "Task Group Added Successfully" };
|
112
|
+
}
|
113
|
+
}
|
114
|
+
static async updateSubGroup(firestore, body) {
|
115
|
+
try {
|
116
|
+
console.log("The BODY IS ", body);
|
117
|
+
let subGroupModel = body["extra"];
|
118
|
+
console.log("The Sub Group Model is ", subGroupModel);
|
119
|
+
let subGroup = new SubTaskGroup();
|
120
|
+
subGroup.fromJSON(JSON.stringify(subGroupModel));
|
121
|
+
console.log("The subGroup model is ", subGroup.toJSON());
|
122
|
+
let response;
|
123
|
+
try {
|
124
|
+
response = await subGroup.save(firestore);
|
125
|
+
}
|
126
|
+
catch (e) {
|
127
|
+
console.log("Error in sub group", e);
|
128
|
+
throw {
|
129
|
+
message: "Error in sub group",
|
130
|
+
status: 500
|
131
|
+
};
|
132
|
+
}
|
133
|
+
// Delete Incoming Ref
|
134
|
+
if (body["id"] != "") {
|
135
|
+
if (response?.["status"] == "OK") {
|
136
|
+
await firestore
|
137
|
+
.collection("Incoming")
|
138
|
+
.doc(body["id"])
|
139
|
+
.delete();
|
140
|
+
}
|
141
|
+
}
|
142
|
+
return {
|
143
|
+
...response
|
144
|
+
};
|
145
|
+
}
|
146
|
+
catch (error) {
|
147
|
+
return {
|
148
|
+
error: error?.message ?? "Internal Server Error",
|
149
|
+
status: error?.status ?? 500
|
150
|
+
};
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
exports.SubTaskGroup = SubTaskGroup;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import * as admin from "firebase-admin";
|
2
|
+
declare class Tag {
|
3
|
+
private _id;
|
4
|
+
get id(): string | "";
|
5
|
+
set id(value: string | "");
|
6
|
+
private _value;
|
7
|
+
get value(): string | "";
|
8
|
+
set value(value: string | "");
|
9
|
+
private _userId;
|
10
|
+
get userId(): string | "";
|
11
|
+
set userId(value: string | "");
|
12
|
+
private _companyId;
|
13
|
+
get companyId(): string | "";
|
14
|
+
set companyId(value: string | "");
|
15
|
+
constructor();
|
16
|
+
argConstructor(id: string, value: string, userId: string, companyId: string): void;
|
17
|
+
fromJSON(tag: string): void;
|
18
|
+
toJSON(): {
|
19
|
+
id: string;
|
20
|
+
value: string;
|
21
|
+
userId: string;
|
22
|
+
companyId: string;
|
23
|
+
};
|
24
|
+
save(firestore: admin.firestore.Firestore): Promise<{
|
25
|
+
status: string;
|
26
|
+
message: string;
|
27
|
+
}>;
|
28
|
+
}
|
29
|
+
export { Tag };
|
@@ -0,0 +1,70 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Tag = void 0;
|
4
|
+
class Tag {
|
5
|
+
_id;
|
6
|
+
get id() {
|
7
|
+
return this._id;
|
8
|
+
}
|
9
|
+
set id(value) {
|
10
|
+
this._id = value;
|
11
|
+
}
|
12
|
+
_value;
|
13
|
+
get value() {
|
14
|
+
return this._value;
|
15
|
+
}
|
16
|
+
set value(value) {
|
17
|
+
this._value = value;
|
18
|
+
}
|
19
|
+
_userId;
|
20
|
+
get userId() {
|
21
|
+
return this._userId;
|
22
|
+
}
|
23
|
+
set userId(value) {
|
24
|
+
this._userId = value;
|
25
|
+
}
|
26
|
+
_companyId;
|
27
|
+
get companyId() {
|
28
|
+
return this._companyId;
|
29
|
+
}
|
30
|
+
set companyId(value) {
|
31
|
+
this._companyId = value;
|
32
|
+
}
|
33
|
+
constructor() { }
|
34
|
+
argConstructor(id, value, userId, companyId) {
|
35
|
+
this.id = id;
|
36
|
+
this.value = value;
|
37
|
+
this.userId = userId;
|
38
|
+
this.companyId = companyId;
|
39
|
+
}
|
40
|
+
fromJSON(tag) {
|
41
|
+
let tagJSON = JSON.parse(tag);
|
42
|
+
this.id = tagJSON["id"] ?? "";
|
43
|
+
this.value = tagJSON["value"] ?? null;
|
44
|
+
this.userId = tagJSON["userId"] ?? null;
|
45
|
+
this.companyId = tagJSON["companyId"] ?? null;
|
46
|
+
}
|
47
|
+
toJSON() {
|
48
|
+
return {
|
49
|
+
id: this.id,
|
50
|
+
value: this.value,
|
51
|
+
userId: this.userId,
|
52
|
+
companyId: this.companyId,
|
53
|
+
};
|
54
|
+
}
|
55
|
+
async save(firestore) {
|
56
|
+
if (this.id == null || this.id == "" || this.id == undefined) {
|
57
|
+
return { status: "ERROR", message: "Error Saving Tag. ID Not Found" };
|
58
|
+
}
|
59
|
+
else {
|
60
|
+
let tagDoc = firestore
|
61
|
+
.collection("Companies")
|
62
|
+
.doc(this.companyId)
|
63
|
+
.collection("Tags")
|
64
|
+
.doc(this.id);
|
65
|
+
await tagDoc.set(this.toJSON());
|
66
|
+
return { status: "OK", message: "Tag Added Successfully" };
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
exports.Tag = Tag;
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import * as admin from "firebase-admin";
|
2
|
+
import { SubTaskGroup } from "./sub-task-group.model";
|
3
|
+
declare class TaskGroup {
|
4
|
+
private _id;
|
5
|
+
get id(): string | "";
|
6
|
+
set id(value: string | "");
|
7
|
+
private _groupTitle;
|
8
|
+
get groupTitle(): string;
|
9
|
+
set groupTitle(value: string);
|
10
|
+
private _userId?;
|
11
|
+
get userId(): string | undefined;
|
12
|
+
set userId(value: string | undefined);
|
13
|
+
private _companyId;
|
14
|
+
get companyId(): string;
|
15
|
+
set companyId(value: string);
|
16
|
+
private _subGroups;
|
17
|
+
get subGroups(): SubTaskGroup[] | [];
|
18
|
+
set subGroups(value: SubTaskGroup[] | []);
|
19
|
+
constructor();
|
20
|
+
argConstructor(id: string, groupTitle: string, userId: string, companyId: string, subGroups: SubTaskGroup[]): void;
|
21
|
+
fromJSON(taskGroup: string): void;
|
22
|
+
toJSON(): {
|
23
|
+
id: string;
|
24
|
+
subGroups: [] | SubTaskGroup[];
|
25
|
+
groupTitle: string;
|
26
|
+
userId: string | undefined;
|
27
|
+
companyId: string;
|
28
|
+
};
|
29
|
+
save(firestore: admin.firestore.Firestore): Promise<{
|
30
|
+
status: string;
|
31
|
+
message: string;
|
32
|
+
path?: undefined;
|
33
|
+
} | {
|
34
|
+
status: string;
|
35
|
+
message: string;
|
36
|
+
path: string;
|
37
|
+
}>;
|
38
|
+
static addUpdateTaskGroup(firestore: admin.firestore.Firestore, body: any): Promise<{
|
39
|
+
status: string;
|
40
|
+
message: string;
|
41
|
+
path?: undefined;
|
42
|
+
error?: undefined;
|
43
|
+
} | {
|
44
|
+
status: string;
|
45
|
+
message: string;
|
46
|
+
path: string;
|
47
|
+
error?: undefined;
|
48
|
+
} | {
|
49
|
+
status: any;
|
50
|
+
error: any;
|
51
|
+
}>;
|
52
|
+
}
|
53
|
+
export { TaskGroup };
|
@@ -0,0 +1,156 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.TaskGroup = void 0;
|
4
|
+
const sub_task_group_model_1 = require("./sub-task-group.model");
|
5
|
+
class TaskGroup {
|
6
|
+
_id;
|
7
|
+
get id() {
|
8
|
+
return this._id;
|
9
|
+
}
|
10
|
+
set id(value) {
|
11
|
+
this._id = value;
|
12
|
+
}
|
13
|
+
_groupTitle;
|
14
|
+
get groupTitle() {
|
15
|
+
return this._groupTitle;
|
16
|
+
}
|
17
|
+
set groupTitle(value) {
|
18
|
+
this._groupTitle = value;
|
19
|
+
}
|
20
|
+
_userId;
|
21
|
+
get userId() {
|
22
|
+
return this._userId;
|
23
|
+
}
|
24
|
+
set userId(value) {
|
25
|
+
this._userId = value;
|
26
|
+
}
|
27
|
+
_companyId;
|
28
|
+
get companyId() {
|
29
|
+
return this._companyId;
|
30
|
+
}
|
31
|
+
set companyId(value) {
|
32
|
+
this._companyId = value;
|
33
|
+
}
|
34
|
+
_subGroups;
|
35
|
+
get subGroups() {
|
36
|
+
return this._subGroups;
|
37
|
+
}
|
38
|
+
set subGroups(value) {
|
39
|
+
this._subGroups = value;
|
40
|
+
}
|
41
|
+
constructor() { }
|
42
|
+
argConstructor(id, groupTitle, userId, companyId, subGroups) {
|
43
|
+
this.id = id;
|
44
|
+
this.subGroups = subGroups ?? [];
|
45
|
+
this.groupTitle = groupTitle;
|
46
|
+
this.userId = userId;
|
47
|
+
this.companyId = companyId;
|
48
|
+
}
|
49
|
+
fromJSON(taskGroup) {
|
50
|
+
let taskGroupJSON = JSON.parse(taskGroup);
|
51
|
+
this.id = taskGroupJSON["id"];
|
52
|
+
if (taskGroupJSON["subGroups"].length > 0) {
|
53
|
+
var i = 0;
|
54
|
+
taskGroupJSON["subGroups"].forEach((element) => {
|
55
|
+
let subTaskGroup = new sub_task_group_model_1.SubTaskGroup();
|
56
|
+
subTaskGroup.fromJSON(JSON.stringify(element));
|
57
|
+
this.subGroups[i] = subTaskGroup;
|
58
|
+
i++;
|
59
|
+
});
|
60
|
+
}
|
61
|
+
else {
|
62
|
+
this.subGroups = [];
|
63
|
+
}
|
64
|
+
this.groupTitle = taskGroupJSON["groupTitle"];
|
65
|
+
this.userId = taskGroupJSON["userId"];
|
66
|
+
this.companyId = taskGroupJSON["companyId"];
|
67
|
+
}
|
68
|
+
toJSON() {
|
69
|
+
return {
|
70
|
+
id: this.id,
|
71
|
+
subGroups: this.subGroups,
|
72
|
+
groupTitle: this.groupTitle,
|
73
|
+
userId: this.userId,
|
74
|
+
companyId: this.companyId,
|
75
|
+
};
|
76
|
+
}
|
77
|
+
async save(firestore) {
|
78
|
+
if (this.id == null || this.id == "" || this.id == undefined) {
|
79
|
+
return {
|
80
|
+
status: "ERROR",
|
81
|
+
message: "Error Saving Task Group. ID Not Found",
|
82
|
+
};
|
83
|
+
}
|
84
|
+
else {
|
85
|
+
let taskDoc = firestore
|
86
|
+
.collection("Companies")
|
87
|
+
.doc(this.companyId)
|
88
|
+
.collection("Task-Group")
|
89
|
+
.doc(this.id);
|
90
|
+
await taskDoc.set(this.toJSON());
|
91
|
+
return {
|
92
|
+
status: "OK",
|
93
|
+
message: "Task Group Added Successfully",
|
94
|
+
path: taskDoc.path,
|
95
|
+
};
|
96
|
+
}
|
97
|
+
}
|
98
|
+
static async addUpdateTaskGroup(firestore, body) {
|
99
|
+
try {
|
100
|
+
console.log("The BODY IS ", body);
|
101
|
+
let taskGroupModel = body["extra"];
|
102
|
+
console.log("The Task Model is ", taskGroupModel);
|
103
|
+
let newTaskGroup = new TaskGroup();
|
104
|
+
try {
|
105
|
+
console.log(newTaskGroup);
|
106
|
+
newTaskGroup.fromJSON(JSON.stringify(taskGroupModel));
|
107
|
+
}
|
108
|
+
catch (e) {
|
109
|
+
console.log("Error running newTaskGroup.fromJSON()");
|
110
|
+
throw {
|
111
|
+
status: 500,
|
112
|
+
message: "Error running newTaskGroup.fromJSON()"
|
113
|
+
};
|
114
|
+
}
|
115
|
+
console.log("The NEW TASK GROUP is ", newTaskGroup.toJSON());
|
116
|
+
let response;
|
117
|
+
try {
|
118
|
+
console.log("I AM SAVING THE TASK GROUP");
|
119
|
+
response = await newTaskGroup.save(firestore);
|
120
|
+
console.log("TASK GROUP SAVED");
|
121
|
+
}
|
122
|
+
catch (e) {
|
123
|
+
console.log("Error", e);
|
124
|
+
throw {
|
125
|
+
status: 500
|
126
|
+
};
|
127
|
+
}
|
128
|
+
console.log("response", response);
|
129
|
+
// Delete Incoming Ref
|
130
|
+
if (taskGroupModel["id"] != "") {
|
131
|
+
if (response?.["status"] == "OK") {
|
132
|
+
await firestore
|
133
|
+
.collection("Incoming")
|
134
|
+
.doc(body["id"])
|
135
|
+
.delete();
|
136
|
+
}
|
137
|
+
else {
|
138
|
+
await firestore
|
139
|
+
.collection("Incoming")
|
140
|
+
.doc(body["id"])
|
141
|
+
.update({ message: response?.["message"] });
|
142
|
+
}
|
143
|
+
}
|
144
|
+
return {
|
145
|
+
...response
|
146
|
+
};
|
147
|
+
}
|
148
|
+
catch (error) {
|
149
|
+
return {
|
150
|
+
status: error?.status ?? 500,
|
151
|
+
error: error?.message ?? "Internal Server Error"
|
152
|
+
};
|
153
|
+
}
|
154
|
+
}
|
155
|
+
}
|
156
|
+
exports.TaskGroup = TaskGroup;
|
@@ -0,0 +1,163 @@
|
|
1
|
+
import * as admin from "firebase-admin";
|
2
|
+
import { Tag } from "./tags.model";
|
3
|
+
declare class Task {
|
4
|
+
private _id;
|
5
|
+
get id(): string | "";
|
6
|
+
set id(value: string | "");
|
7
|
+
private _taskGroupId;
|
8
|
+
get taskGroupId(): string | "";
|
9
|
+
set taskGroupId(value: string | "");
|
10
|
+
private _groupId;
|
11
|
+
get groupId(): string | "";
|
12
|
+
set groupId(value: string | "");
|
13
|
+
private _title;
|
14
|
+
get title(): string | "";
|
15
|
+
set title(value: string | "");
|
16
|
+
private _description;
|
17
|
+
get description(): string | "";
|
18
|
+
set description(value: string | "");
|
19
|
+
private _priority;
|
20
|
+
get priority(): string | "";
|
21
|
+
set priority(value: string | "");
|
22
|
+
private _assignee;
|
23
|
+
get assignee(): string[] | [];
|
24
|
+
set assignee(value: string[] | []);
|
25
|
+
private _assets;
|
26
|
+
get assets(): string[] | [];
|
27
|
+
set assets(value: string[] | []);
|
28
|
+
private _locations;
|
29
|
+
get locations(): string[] | [];
|
30
|
+
set locations(value: string[] | []);
|
31
|
+
private _watchers;
|
32
|
+
get watchers(): string[] | [];
|
33
|
+
set watchers(value: string[] | []);
|
34
|
+
private _reminderDate;
|
35
|
+
get reminderDate(): number | null;
|
36
|
+
set reminderDate(value: number | null);
|
37
|
+
private _deadlineDate;
|
38
|
+
get deadlineDate(): number | null;
|
39
|
+
set deadlineDate(value: number | null);
|
40
|
+
private _tags;
|
41
|
+
get tags(): Tag[] | [];
|
42
|
+
set tags(value: Tag[] | []);
|
43
|
+
private _subGroupId;
|
44
|
+
get subGroupId(): string;
|
45
|
+
set subGroupId(value: string);
|
46
|
+
private cancelActionId;
|
47
|
+
private _updatedAt;
|
48
|
+
get updatedAt(): number | null;
|
49
|
+
set updatedAt(value: number | null);
|
50
|
+
private _createdAt;
|
51
|
+
get createdAt(): number | null;
|
52
|
+
set createdAt(value: number | null);
|
53
|
+
private _isCompleted;
|
54
|
+
get isCompleted(): boolean | false;
|
55
|
+
set isCompleted(value: boolean | false);
|
56
|
+
private _parentTaskId;
|
57
|
+
get parentTaskId(): string | "";
|
58
|
+
set parentTaskId(value: string | "");
|
59
|
+
private _order;
|
60
|
+
get order(): number | null;
|
61
|
+
set order(value: number | null);
|
62
|
+
private _subTasks;
|
63
|
+
get subTasks(): string[] | [];
|
64
|
+
set subTasks(value: string[] | []);
|
65
|
+
private _companyId;
|
66
|
+
get companyId(): string | "";
|
67
|
+
set companyId(value: string | "");
|
68
|
+
private _actionId;
|
69
|
+
get actionId(): string | "";
|
70
|
+
set actionId(value: string | "");
|
71
|
+
private _csTaskId;
|
72
|
+
get csTaskId(): string | "";
|
73
|
+
set csTaskId(value: string | "");
|
74
|
+
constructor();
|
75
|
+
argConstructor(id: string | "", taskGroupId: string | "", groupId: string | "", title: string | "", description: string, priority: string, assignee: string[], assets: string[], locations: string[], watchers: string[], reminderDate: number, deadlineDate: number, tags: Tag[], subGroupId: string, updatedAt: number, createdAt: number, isCompleted: boolean, parentTaskId: string, order: number, subtasks: string[], actionId: string, csTaskId: string, cancelActionId: string): void;
|
76
|
+
fromJSON(task: string): void;
|
77
|
+
toJSON(): {
|
78
|
+
id: string;
|
79
|
+
assignee: string[] | [];
|
80
|
+
deadlineDate: number | null;
|
81
|
+
description: string;
|
82
|
+
groupId: string;
|
83
|
+
order: number;
|
84
|
+
assets: string[] | [];
|
85
|
+
locations: string[] | [];
|
86
|
+
taskGroupId: string;
|
87
|
+
title: string;
|
88
|
+
priority: string;
|
89
|
+
watchers: string[] | [];
|
90
|
+
reminderDate: number | null;
|
91
|
+
tags: {
|
92
|
+
id: string;
|
93
|
+
value: string;
|
94
|
+
userId: string;
|
95
|
+
companyId: string;
|
96
|
+
}[];
|
97
|
+
subGroupId: string;
|
98
|
+
updatedAt: number | null;
|
99
|
+
createdAt: number | null;
|
100
|
+
isCompleted: boolean;
|
101
|
+
parentTaskId: string;
|
102
|
+
subTasks: string[] | [];
|
103
|
+
companyId: string;
|
104
|
+
actionId: string;
|
105
|
+
csTaskId: string;
|
106
|
+
cancelActionId: string;
|
107
|
+
};
|
108
|
+
save(firestore: admin.firestore.Firestore): Promise<{
|
109
|
+
status: string;
|
110
|
+
message: string;
|
111
|
+
id?: undefined;
|
112
|
+
} | {
|
113
|
+
status: string;
|
114
|
+
id: string;
|
115
|
+
message: string;
|
116
|
+
}>;
|
117
|
+
static markTaskAsCompleted(firestore: admin.firestore.Firestore, companyId: string, taskId: string): Promise<admin.firestore.WriteResult>;
|
118
|
+
static checkIsParentTaskCompleted(firestore: admin.firestore.Firestore, companyId: string, taskId: string): Promise<{
|
119
|
+
status: boolean;
|
120
|
+
parentTaskId: any;
|
121
|
+
} | {
|
122
|
+
parentTaskId: any;
|
123
|
+
status: null;
|
124
|
+
} | null>;
|
125
|
+
static createTaskAction(firestore: admin.firestore.Firestore, body: any): Promise<{
|
126
|
+
status: number;
|
127
|
+
taskActions: string;
|
128
|
+
message: string;
|
129
|
+
error?: undefined;
|
130
|
+
} | {
|
131
|
+
status: any;
|
132
|
+
error: any;
|
133
|
+
taskActions?: undefined;
|
134
|
+
message?: undefined;
|
135
|
+
}>;
|
136
|
+
static defFeedObj(): {
|
137
|
+
screen_title: string;
|
138
|
+
id: string;
|
139
|
+
cancelActionId: string;
|
140
|
+
data: {
|
141
|
+
children: any[];
|
142
|
+
height: string;
|
143
|
+
order: number;
|
144
|
+
}[];
|
145
|
+
actionName: string;
|
146
|
+
};
|
147
|
+
static type(fieldType: string): string;
|
148
|
+
static addUpdateTask(firestore: admin.firestore.Firestore, body: any): Promise<{
|
149
|
+
status: string;
|
150
|
+
message: string;
|
151
|
+
id?: undefined;
|
152
|
+
error?: undefined;
|
153
|
+
} | {
|
154
|
+
status: string;
|
155
|
+
id: string;
|
156
|
+
message: string;
|
157
|
+
error?: undefined;
|
158
|
+
} | {
|
159
|
+
error: any;
|
160
|
+
status: any;
|
161
|
+
}>;
|
162
|
+
}
|
163
|
+
export { Task };
|