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
@@ -0,0 +1,603 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Task = void 0;
|
4
|
+
const tags_model_1 = require("./tags.model");
|
5
|
+
const company_model_1 = require("../company.model");
|
6
|
+
const action_model_1 = require("../action.model");
|
7
|
+
class Task {
|
8
|
+
_id;
|
9
|
+
get id() {
|
10
|
+
return this._id;
|
11
|
+
}
|
12
|
+
set id(value) {
|
13
|
+
this._id = value;
|
14
|
+
}
|
15
|
+
_taskGroupId;
|
16
|
+
get taskGroupId() {
|
17
|
+
return this._taskGroupId;
|
18
|
+
}
|
19
|
+
set taskGroupId(value) {
|
20
|
+
this._taskGroupId = value;
|
21
|
+
}
|
22
|
+
_groupId;
|
23
|
+
get groupId() {
|
24
|
+
return this._groupId;
|
25
|
+
}
|
26
|
+
set groupId(value) {
|
27
|
+
this._groupId = value;
|
28
|
+
}
|
29
|
+
_title;
|
30
|
+
get title() {
|
31
|
+
return this._title;
|
32
|
+
}
|
33
|
+
set title(value) {
|
34
|
+
this._title = value;
|
35
|
+
}
|
36
|
+
_description;
|
37
|
+
get description() {
|
38
|
+
return this._description;
|
39
|
+
}
|
40
|
+
set description(value) {
|
41
|
+
this._description = value;
|
42
|
+
}
|
43
|
+
_priority;
|
44
|
+
get priority() {
|
45
|
+
return this._priority;
|
46
|
+
}
|
47
|
+
set priority(value) {
|
48
|
+
this._priority = value;
|
49
|
+
}
|
50
|
+
_assignee;
|
51
|
+
get assignee() {
|
52
|
+
return this._assignee;
|
53
|
+
}
|
54
|
+
set assignee(value) {
|
55
|
+
this._assignee = value;
|
56
|
+
}
|
57
|
+
_assets;
|
58
|
+
get assets() {
|
59
|
+
return this._assets;
|
60
|
+
}
|
61
|
+
set assets(value) {
|
62
|
+
this._assets = value;
|
63
|
+
}
|
64
|
+
_locations;
|
65
|
+
get locations() {
|
66
|
+
return this._locations;
|
67
|
+
}
|
68
|
+
set locations(value) {
|
69
|
+
this._locations = value;
|
70
|
+
}
|
71
|
+
_watchers;
|
72
|
+
get watchers() {
|
73
|
+
return this._watchers;
|
74
|
+
}
|
75
|
+
set watchers(value) {
|
76
|
+
this._watchers = value;
|
77
|
+
}
|
78
|
+
_reminderDate;
|
79
|
+
get reminderDate() {
|
80
|
+
return this._reminderDate;
|
81
|
+
}
|
82
|
+
set reminderDate(value) {
|
83
|
+
this._reminderDate = value;
|
84
|
+
}
|
85
|
+
_deadlineDate;
|
86
|
+
get deadlineDate() {
|
87
|
+
return this._deadlineDate;
|
88
|
+
}
|
89
|
+
set deadlineDate(value) {
|
90
|
+
this._deadlineDate = value;
|
91
|
+
}
|
92
|
+
_tags;
|
93
|
+
get tags() {
|
94
|
+
return this._tags;
|
95
|
+
}
|
96
|
+
set tags(value) {
|
97
|
+
this._tags = value;
|
98
|
+
}
|
99
|
+
_subGroupId;
|
100
|
+
get subGroupId() {
|
101
|
+
return this._subGroupId;
|
102
|
+
}
|
103
|
+
set subGroupId(value) {
|
104
|
+
this._subGroupId = value;
|
105
|
+
}
|
106
|
+
cancelActionId;
|
107
|
+
// private _taskGroup!: TaskGroup | null;
|
108
|
+
// public get taskGroup(): TaskGroup | null {
|
109
|
+
// return this._taskGroup;
|
110
|
+
// }
|
111
|
+
// public set taskGroup(value: TaskGroup | null) {
|
112
|
+
// this._taskGroup = value;
|
113
|
+
// }
|
114
|
+
// private _subTaskGroup!: SubTaskGroup | null;
|
115
|
+
// public get subTaskGroup(): SubTaskGroup | null {
|
116
|
+
// return this._subTaskGroup;
|
117
|
+
// }
|
118
|
+
// public set subTaskGroup(value: SubTaskGroup | null) {
|
119
|
+
// this._subTaskGroup = value;
|
120
|
+
// }
|
121
|
+
_updatedAt;
|
122
|
+
get updatedAt() {
|
123
|
+
return this._updatedAt;
|
124
|
+
}
|
125
|
+
set updatedAt(value) {
|
126
|
+
this._updatedAt = value;
|
127
|
+
}
|
128
|
+
_createdAt;
|
129
|
+
get createdAt() {
|
130
|
+
return this._createdAt;
|
131
|
+
}
|
132
|
+
set createdAt(value) {
|
133
|
+
this._createdAt = value;
|
134
|
+
}
|
135
|
+
_isCompleted;
|
136
|
+
get isCompleted() {
|
137
|
+
return this._isCompleted;
|
138
|
+
}
|
139
|
+
set isCompleted(value) {
|
140
|
+
this._isCompleted = value;
|
141
|
+
}
|
142
|
+
_parentTaskId;
|
143
|
+
get parentTaskId() {
|
144
|
+
return this._parentTaskId;
|
145
|
+
}
|
146
|
+
set parentTaskId(value) {
|
147
|
+
this._parentTaskId = value;
|
148
|
+
}
|
149
|
+
_order;
|
150
|
+
get order() {
|
151
|
+
return this._order;
|
152
|
+
}
|
153
|
+
set order(value) {
|
154
|
+
this._order = value;
|
155
|
+
}
|
156
|
+
_subTasks;
|
157
|
+
get subTasks() {
|
158
|
+
return this._subTasks;
|
159
|
+
}
|
160
|
+
set subTasks(value) {
|
161
|
+
this._subTasks = value;
|
162
|
+
}
|
163
|
+
_companyId;
|
164
|
+
get companyId() {
|
165
|
+
return this._companyId;
|
166
|
+
}
|
167
|
+
set companyId(value) {
|
168
|
+
this._companyId = value;
|
169
|
+
}
|
170
|
+
_actionId;
|
171
|
+
get actionId() {
|
172
|
+
return this._actionId;
|
173
|
+
}
|
174
|
+
set actionId(value) {
|
175
|
+
this._actionId = value;
|
176
|
+
}
|
177
|
+
_csTaskId;
|
178
|
+
get csTaskId() {
|
179
|
+
return this._csTaskId;
|
180
|
+
}
|
181
|
+
set csTaskId(value) {
|
182
|
+
this._csTaskId = value;
|
183
|
+
}
|
184
|
+
constructor() { }
|
185
|
+
argConstructor(id, taskGroupId, groupId, title, description, priority, assignee, assets, locations, watchers, reminderDate, deadlineDate, tags, subGroupId, updatedAt, createdAt, isCompleted, parentTaskId, order, subtasks, actionId, csTaskId, cancelActionId) {
|
186
|
+
this.id = id;
|
187
|
+
this.assignee = assignee;
|
188
|
+
this.deadlineDate = deadlineDate;
|
189
|
+
this.description = description;
|
190
|
+
this.groupId = groupId;
|
191
|
+
this.order = order;
|
192
|
+
this.assets = assets;
|
193
|
+
this.locations = locations;
|
194
|
+
this.taskGroupId = taskGroupId;
|
195
|
+
this.title = title;
|
196
|
+
this.priority = priority;
|
197
|
+
this.watchers = watchers;
|
198
|
+
this.reminderDate = reminderDate;
|
199
|
+
this.tags = tags;
|
200
|
+
this.subGroupId = subGroupId;
|
201
|
+
this.updatedAt = updatedAt;
|
202
|
+
this.createdAt = createdAt;
|
203
|
+
this.isCompleted = isCompleted;
|
204
|
+
this.parentTaskId = parentTaskId;
|
205
|
+
this.subTasks = subtasks;
|
206
|
+
this.actionId = actionId;
|
207
|
+
this.csTaskId = csTaskId;
|
208
|
+
this.cancelActionId = cancelActionId;
|
209
|
+
}
|
210
|
+
fromJSON(task) {
|
211
|
+
let taskJSON = JSON.parse(task);
|
212
|
+
this.id = taskJSON["id"] ?? null;
|
213
|
+
this.assignee = taskJSON["assignee"] ?? null;
|
214
|
+
this.assets = taskJSON["assets"] ?? null;
|
215
|
+
this.locations = taskJSON["locations"] ?? null;
|
216
|
+
this.deadlineDate = taskJSON["deadlineDate"] ?? null;
|
217
|
+
this.description = taskJSON["description"] ?? null;
|
218
|
+
this.groupId = taskJSON["groupId"] ?? null;
|
219
|
+
this.order = parseInt(taskJSON["order"]) ?? null;
|
220
|
+
this.taskGroupId = taskJSON["taskGroupId"] ?? null;
|
221
|
+
this.title = taskJSON["title"] ?? null;
|
222
|
+
this.priority = taskJSON["priority"] ?? null;
|
223
|
+
this.watchers = taskJSON["watchers"] ?? null;
|
224
|
+
this.reminderDate = taskJSON["reminderDate"] ?? null;
|
225
|
+
this.subGroupId = taskJSON["subGroupId"] ?? null;
|
226
|
+
this.updatedAt = taskJSON["updatedAt"] ?? null;
|
227
|
+
this.createdAt = taskJSON["createdAt"] ?? null;
|
228
|
+
this.isCompleted = taskJSON["isCompleted"] ?? null;
|
229
|
+
this.parentTaskId = taskJSON["parentTaskId"] ?? null;
|
230
|
+
this.subTasks = taskJSON["subTasks"] ?? [];
|
231
|
+
this.companyId = taskJSON["companyId"] ?? null;
|
232
|
+
this.actionId = taskJSON["actionId"] ?? null;
|
233
|
+
this.csTaskId = taskJSON["csTaskId"];
|
234
|
+
this.cancelActionId = taskJSON["cancelActionId"];
|
235
|
+
if (taskJSON["tags"] != null) {
|
236
|
+
let allTags = taskJSON["tags"];
|
237
|
+
let arrayOfTagObjs = [];
|
238
|
+
for (let tag of allTags) {
|
239
|
+
let aTag = new tags_model_1.Tag();
|
240
|
+
aTag.fromJSON(JSON.stringify(tag));
|
241
|
+
arrayOfTagObjs.push(aTag);
|
242
|
+
}
|
243
|
+
this.tags = arrayOfTagObjs;
|
244
|
+
}
|
245
|
+
}
|
246
|
+
toJSON() {
|
247
|
+
let allTagJSON = [];
|
248
|
+
if (this.tags != null && this.tags != undefined) {
|
249
|
+
let allTagObjs = this.tags;
|
250
|
+
for (let tag of allTagObjs) {
|
251
|
+
allTagJSON.push(tag.toJSON());
|
252
|
+
}
|
253
|
+
}
|
254
|
+
return {
|
255
|
+
id: this.id,
|
256
|
+
assignee: this.assignee ?? [],
|
257
|
+
deadlineDate: this.deadlineDate ?? null,
|
258
|
+
description: this.description ?? "",
|
259
|
+
groupId: this.groupId ?? "",
|
260
|
+
order: this.order ?? 0,
|
261
|
+
assets: this.assets ?? null,
|
262
|
+
locations: this.locations ?? null,
|
263
|
+
taskGroupId: this.taskGroupId ?? null,
|
264
|
+
title: this.title ?? null,
|
265
|
+
priority: this.priority ?? null,
|
266
|
+
watchers: this.watchers ?? null,
|
267
|
+
reminderDate: this.reminderDate ?? null,
|
268
|
+
tags: allTagJSON ?? null,
|
269
|
+
subGroupId: this.subGroupId ?? null,
|
270
|
+
updatedAt: this.updatedAt ?? null,
|
271
|
+
createdAt: this.createdAt ?? null,
|
272
|
+
isCompleted: this.isCompleted ?? null,
|
273
|
+
parentTaskId: this.parentTaskId ?? "pt",
|
274
|
+
subTasks: this.subTasks ?? null,
|
275
|
+
companyId: this.companyId ?? null,
|
276
|
+
actionId: this.actionId ?? null,
|
277
|
+
csTaskId: this.csTaskId ?? null,
|
278
|
+
cancelActionId: this.cancelActionId ?? null
|
279
|
+
};
|
280
|
+
}
|
281
|
+
async save(firestore) {
|
282
|
+
// Checking if the ID is null
|
283
|
+
if (this.id == null || this.id == "" || this.id == undefined) {
|
284
|
+
return { status: "ERROR", message: "Error Saving Task. ID Not Found" };
|
285
|
+
}
|
286
|
+
else {
|
287
|
+
let taskDoc = firestore
|
288
|
+
.collection("Companies")
|
289
|
+
.doc(this.companyId)
|
290
|
+
.collection("Tasks")
|
291
|
+
.doc(this.id);
|
292
|
+
console.log("id => " + this.id + "company id => " + this.companyId);
|
293
|
+
if (this.parentTaskId != null &&
|
294
|
+
this.parentTaskId != "pt" &&
|
295
|
+
this.parentTaskId != undefined) {
|
296
|
+
let parentTaskDoc = firestore
|
297
|
+
.collection("Companies")
|
298
|
+
.doc(this.companyId)
|
299
|
+
.collection("Tasks")
|
300
|
+
.doc(this.parentTaskId);
|
301
|
+
let parentDoc = (await parentTaskDoc.get()).data();
|
302
|
+
console.log("id => " + this.parentTaskId + "company id => " + this.companyId + "parentTaksDoc =>" + { ...parentDoc });
|
303
|
+
try {
|
304
|
+
parentDoc.subTasks.push(this.id);
|
305
|
+
await parentTaskDoc.update({
|
306
|
+
subTasks: parentDoc.subTasks,
|
307
|
+
});
|
308
|
+
}
|
309
|
+
catch (e) {
|
310
|
+
console.log("Error in task", e);
|
311
|
+
}
|
312
|
+
}
|
313
|
+
try {
|
314
|
+
await taskDoc.set(this.toJSON());
|
315
|
+
}
|
316
|
+
catch (e) {
|
317
|
+
console.log("Error in task", e);
|
318
|
+
}
|
319
|
+
return {
|
320
|
+
status: "OK",
|
321
|
+
id: taskDoc.id,
|
322
|
+
message: "Task Added Successfully",
|
323
|
+
};
|
324
|
+
}
|
325
|
+
}
|
326
|
+
static async markTaskAsCompleted(firestore, companyId, taskId) {
|
327
|
+
try {
|
328
|
+
console.log("TaskId", taskId);
|
329
|
+
const taskDocs = await firestore
|
330
|
+
.collection("Companies")
|
331
|
+
.doc(companyId)
|
332
|
+
.collection("Tasks")
|
333
|
+
.where("id", "==", `${taskId}`)
|
334
|
+
.get();
|
335
|
+
console.log("here---------------");
|
336
|
+
const taskDoc = taskDocs.docs[0];
|
337
|
+
const updationRes = await taskDoc.ref.update({
|
338
|
+
isCompleted: true,
|
339
|
+
});
|
340
|
+
return updationRes;
|
341
|
+
}
|
342
|
+
catch (error) {
|
343
|
+
throw new Error("Something Went wrong while updating");
|
344
|
+
}
|
345
|
+
}
|
346
|
+
static async checkIsParentTaskCompleted(firestore, companyId, taskId) {
|
347
|
+
try {
|
348
|
+
const taskDocs = await firestore.collection("Companies")
|
349
|
+
.doc(companyId)
|
350
|
+
.collection("Tasks")
|
351
|
+
.where("id", "==", taskId)
|
352
|
+
.get();
|
353
|
+
if (taskDocs.docs.length) {
|
354
|
+
const taskInfo = taskDocs.docs[0].data();
|
355
|
+
const parentTaskId = taskInfo.parentTaskId;
|
356
|
+
if (parentTaskId) {
|
357
|
+
const parentTaskList = await firestore.collection("Companies")
|
358
|
+
.doc(companyId)
|
359
|
+
.collection("Tasks")
|
360
|
+
.where("id", "==", parentTaskId)
|
361
|
+
.get();
|
362
|
+
if (parentTaskList.docs.length) {
|
363
|
+
const parentTaskInfo = parentTaskList.docs[0].data();
|
364
|
+
const subTasksIdList = parentTaskInfo.subTasks;
|
365
|
+
const subTasksList = await firestore.collection("Companies")
|
366
|
+
.doc(companyId)
|
367
|
+
.collection("Tasks")
|
368
|
+
.where("id", "in", subTasksIdList)
|
369
|
+
.get();
|
370
|
+
const parentTaskStatus = subTasksList.docs.every((subTaskDoc) => {
|
371
|
+
const subTaskInfo = subTaskDoc.data();
|
372
|
+
return subTaskInfo.isCompleted;
|
373
|
+
});
|
374
|
+
return {
|
375
|
+
status: parentTaskStatus,
|
376
|
+
parentTaskId: parentTaskId
|
377
|
+
};
|
378
|
+
}
|
379
|
+
else {
|
380
|
+
return {
|
381
|
+
parentTaskId: parentTaskId,
|
382
|
+
status: null
|
383
|
+
};
|
384
|
+
}
|
385
|
+
}
|
386
|
+
else {
|
387
|
+
return {
|
388
|
+
parentTaskId: null,
|
389
|
+
status: null
|
390
|
+
};
|
391
|
+
}
|
392
|
+
}
|
393
|
+
else {
|
394
|
+
return null;
|
395
|
+
}
|
396
|
+
}
|
397
|
+
catch (error) {
|
398
|
+
console.log(error.message);
|
399
|
+
throw {
|
400
|
+
message: error.message
|
401
|
+
};
|
402
|
+
}
|
403
|
+
}
|
404
|
+
static async createTaskAction(firestore, body) {
|
405
|
+
try {
|
406
|
+
const nickname = "child_safety";
|
407
|
+
const companyId = await company_model_1.Company.getCompanyIdByNickName(firestore, nickname);
|
408
|
+
console.log(companyId);
|
409
|
+
console.log("-----------------", body.inputsList);
|
410
|
+
let inputTypes = body.inputsList;
|
411
|
+
let docId;
|
412
|
+
let newDoc;
|
413
|
+
if (inputTypes) {
|
414
|
+
docId = inputTypes.join("_");
|
415
|
+
}
|
416
|
+
else {
|
417
|
+
throw {
|
418
|
+
message: "Please Provide inputs list",
|
419
|
+
status: 400
|
420
|
+
};
|
421
|
+
}
|
422
|
+
inputTypes = [
|
423
|
+
"select_location",
|
424
|
+
"select_asset",
|
425
|
+
...body.inputsList,
|
426
|
+
"summary",
|
427
|
+
];
|
428
|
+
const taskActionsDoc = await firestore
|
429
|
+
.collection("Companies")
|
430
|
+
.doc(companyId)
|
431
|
+
.collection("TaskActions")
|
432
|
+
.doc(docId)
|
433
|
+
.get();
|
434
|
+
const actionId = await action_model_1.Action.getActionId(firestore, companyId, "completeTask");
|
435
|
+
if (taskActionsDoc.exists) {
|
436
|
+
return {
|
437
|
+
status: 200,
|
438
|
+
taskActions: docId,
|
439
|
+
message: "Successfully fetched taskActions",
|
440
|
+
};
|
441
|
+
}
|
442
|
+
else {
|
443
|
+
newDoc = firestore
|
444
|
+
.collection("Companies")
|
445
|
+
.doc(companyId)
|
446
|
+
.collection("TaskActions")
|
447
|
+
.doc(docId);
|
448
|
+
const taskActionDoc = await firestore
|
449
|
+
.collection("Companies")
|
450
|
+
.doc(companyId)
|
451
|
+
.collection("Actions")
|
452
|
+
.doc(actionId)
|
453
|
+
.get();
|
454
|
+
const newAction = taskActionDoc.data();
|
455
|
+
newAction.id = newDoc.id;
|
456
|
+
newAction.name = docId;
|
457
|
+
console.log(newAction);
|
458
|
+
await newDoc.set(newAction);
|
459
|
+
console.log("newDocId", newDoc.id);
|
460
|
+
}
|
461
|
+
const feedDetailScreen = this.defFeedObj();
|
462
|
+
feedDetailScreen.screen_title = "Task Details";
|
463
|
+
await Promise.all(inputTypes.map(async (inputType, idx) => {
|
464
|
+
console.log("actionId", actionId);
|
465
|
+
console.log("inputType", inputType);
|
466
|
+
const taskStep = await firestore
|
467
|
+
.collection("Companies")
|
468
|
+
.doc(companyId)
|
469
|
+
.collection("Actions")
|
470
|
+
.doc(actionId)
|
471
|
+
.collection("task_completion_steps")
|
472
|
+
.where("step_selector_key", "==", inputType)
|
473
|
+
.get();
|
474
|
+
// console.log("teskStepdata", taskStep);
|
475
|
+
if (taskStep.empty) {
|
476
|
+
throw "Invalid input type received.";
|
477
|
+
}
|
478
|
+
else {
|
479
|
+
const doc = await firestore
|
480
|
+
.collection("Companies")
|
481
|
+
.doc(companyId)
|
482
|
+
.collection("TaskActions")
|
483
|
+
.doc(docId)
|
484
|
+
.get();
|
485
|
+
const newStep = taskStep.docs[0].data();
|
486
|
+
newStep.order = idx;
|
487
|
+
console.log("newStep =>", newStep);
|
488
|
+
if (newStep.step_selector_key != "summary") {
|
489
|
+
feedDetailScreen.data[0]["children"].push({
|
490
|
+
type: this.type(newStep.fieldType),
|
491
|
+
title: newStep.label,
|
492
|
+
isMultiText: (newStep.fieldType === 'InputField' && !!newStep.field.isMultiInput) || newStep.fieldType === 'CheckList',
|
493
|
+
key: newStep.field["keyForAPI"],
|
494
|
+
});
|
495
|
+
}
|
496
|
+
const newDocRef = doc.ref.collection("task_completion_steps").doc();
|
497
|
+
newStep.id = newDocRef.id;
|
498
|
+
await newDocRef.set(newStep);
|
499
|
+
// await newDoc.set(taskStep.docs[0].data());
|
500
|
+
}
|
501
|
+
}));
|
502
|
+
feedDetailScreen.actionName = docId;
|
503
|
+
console.log(JSON.stringify(feedDetailScreen));
|
504
|
+
const fdsRef = firestore.collection("Companies")
|
505
|
+
.doc(companyId)
|
506
|
+
.collection("Feed-Details-Screen")
|
507
|
+
.doc();
|
508
|
+
feedDetailScreen.id = fdsRef.id;
|
509
|
+
console.log(feedDetailScreen);
|
510
|
+
await fdsRef.set(feedDetailScreen);
|
511
|
+
return {
|
512
|
+
status: 200,
|
513
|
+
taskActions: docId,
|
514
|
+
message: "Successfully created the taskAction"
|
515
|
+
};
|
516
|
+
}
|
517
|
+
catch (error) {
|
518
|
+
return {
|
519
|
+
status: error?.status ?? 500,
|
520
|
+
error: error?.message ?? "Internal Server Error"
|
521
|
+
};
|
522
|
+
}
|
523
|
+
}
|
524
|
+
static defFeedObj() {
|
525
|
+
const children = [];
|
526
|
+
return {
|
527
|
+
"screen_title": "",
|
528
|
+
"id": "",
|
529
|
+
"cancelActionId": "",
|
530
|
+
"data": [
|
531
|
+
{
|
532
|
+
"children": children,
|
533
|
+
"height": "",
|
534
|
+
"order": 0
|
535
|
+
}
|
536
|
+
],
|
537
|
+
"actionName": "worklog"
|
538
|
+
};
|
539
|
+
}
|
540
|
+
static type(fieldType) {
|
541
|
+
console.log(fieldType);
|
542
|
+
if (fieldType === 'InputField' || fieldType === 'CheckList' || fieldType === 'RadioList')
|
543
|
+
return 'text';
|
544
|
+
if (fieldType === 'datePicker')
|
545
|
+
return 'date ';
|
546
|
+
if (fieldType === 'timePicker')
|
547
|
+
return 'time ';
|
548
|
+
if (fieldType === 'ImagePicker' || fieldType === 'Selfie')
|
549
|
+
return 'image';
|
550
|
+
if (fieldType === 'MultiImagePicker')
|
551
|
+
return 'multiImage';
|
552
|
+
return "text";
|
553
|
+
}
|
554
|
+
static async addUpdateTask(firestore, body) {
|
555
|
+
try {
|
556
|
+
let taskModel = body["extra"];
|
557
|
+
console.log("The Task Model is ", taskModel);
|
558
|
+
console.log("--------taskModel-------", taskModel);
|
559
|
+
let newTask = new Task();
|
560
|
+
try {
|
561
|
+
newTask.fromJSON(JSON.stringify(taskModel)); // id == ""
|
562
|
+
}
|
563
|
+
catch (e) {
|
564
|
+
console.log("Error running newTask.fromJSON()", e);
|
565
|
+
throw {
|
566
|
+
message: "Error running newTask.fromJSON()",
|
567
|
+
status: 500
|
568
|
+
};
|
569
|
+
}
|
570
|
+
console.log("the newTask is ", newTask.toJSON());
|
571
|
+
let response;
|
572
|
+
try {
|
573
|
+
console.log("newTask.id => ", newTask.id, "newTask.companyId => ", newTask.companyId);
|
574
|
+
response = await newTask.save(firestore);
|
575
|
+
}
|
576
|
+
catch (e) {
|
577
|
+
console.log("ERROR saving task ", e);
|
578
|
+
throw {
|
579
|
+
message: "ERROR saving task"
|
580
|
+
};
|
581
|
+
}
|
582
|
+
// Delete Incoming Ref
|
583
|
+
if (body["id"] != "") {
|
584
|
+
if (response?.["status"] == "OK") {
|
585
|
+
await firestore
|
586
|
+
.collection("Incoming")
|
587
|
+
.doc(body["id"])
|
588
|
+
.delete();
|
589
|
+
}
|
590
|
+
}
|
591
|
+
return {
|
592
|
+
...response
|
593
|
+
};
|
594
|
+
}
|
595
|
+
catch (error) {
|
596
|
+
return {
|
597
|
+
error: error?.message ?? "Internal Server Error",
|
598
|
+
status: error?.status ?? 500
|
599
|
+
};
|
600
|
+
}
|
601
|
+
}
|
602
|
+
}
|
603
|
+
exports.Task = Task;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import * as admin from "firebase-admin";
|
2
|
+
declare class TempCollection {
|
3
|
+
static createTempCollection(firestore: admin.firestore.Firestore, uniqueId: string, data: any): Promise<string>;
|
4
|
+
static verifyTakaList(firestore: admin.firestore.Firestore, uniqueId: string, takaId: string, arrayInstance: any, scanType: string): Promise<{
|
5
|
+
data: string;
|
6
|
+
message: string;
|
7
|
+
} | {
|
8
|
+
statusCode: number;
|
9
|
+
message: string;
|
10
|
+
error: any;
|
11
|
+
}>;
|
12
|
+
static checkIfAlreadyScanned(itemDetailsDoc: any, takaId: string, scanType: string): Promise<boolean>;
|
13
|
+
static createCountRow(summary: any, serialNo: number): Promise<any>;
|
14
|
+
static updateInfoInDB(docFromDB: any, takaId: string, summaryToSave: string, arrayInstance: any): Promise<void>;
|
15
|
+
static checkIfTakaIsAdded(firestore: admin.firestore.Firestore, fullTakaId: string, uniqueId: string): Promise<boolean>;
|
16
|
+
static createResponseToSend(summary: any, serialNo: number, message: string): Promise<{
|
17
|
+
data: string;
|
18
|
+
message: string;
|
19
|
+
}>;
|
20
|
+
static resetReferenceDoc(arrayInstance: any, docFromDB: any, fullTakaId: string): Promise<void>;
|
21
|
+
static matchTakaInTakaList(takaId: string, takaList: string[], scanType: string): Promise<{
|
22
|
+
status: string;
|
23
|
+
id: string;
|
24
|
+
}>;
|
25
|
+
static verifyTakaNUpdate(firestore: admin.firestore.Firestore, takaNo: string, uniqueId: string, arrayInstance: any, payLoadInfo: any, gradeInfoList: any): Promise<{
|
26
|
+
data: any;
|
27
|
+
message: string;
|
28
|
+
}>;
|
29
|
+
static getGradeFromId(id: string, gradeInfoList: any): Promise<any>;
|
30
|
+
static getNewScanRow(takaDetails: any, currTaka: string, oldSummary: any, gradeInfoList: any): Promise<any>;
|
31
|
+
static createTotalRow(summary: any): Promise<any>;
|
32
|
+
static createResponseObj(responseInfo: any, takaId: string, serialNo: string): Promise<any>;
|
33
|
+
static getStockListbyUserId(firestore: admin.firestore.Firestore, userId: string): Promise<admin.firestore.DocumentData | undefined>;
|
34
|
+
static createTempCollectionOnlyWithSerialNo(firestore: admin.firestore.Firestore, uniqueId: string, doc: any): Promise<string>;
|
35
|
+
static deleteTempCollection(firestore: admin.firestore.Firestore, uniqueId: string): Promise<string>;
|
36
|
+
static isDocPresent(firestore: admin.firestore.Firestore, uniqueId: string): Promise<boolean>;
|
37
|
+
static getDocInfo(firestore: admin.firestore.Firestore, uniqueId: string): Promise<admin.firestore.DocumentData | undefined>;
|
38
|
+
static storeResponseInTemp(firestore: admin.firestore.Firestore, data: any): Promise<string>;
|
39
|
+
}
|
40
|
+
export { TempCollection };
|