@aneuhold/core-ts-db-lib 1.0.18 → 1.0.20
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.
|
@@ -7,6 +7,27 @@ export declare const validateDashboardTask: DocumentValidator<DashboardTask>;
|
|
|
7
7
|
* Gets all the children task IDs for the given parent task IDs.
|
|
8
8
|
*/
|
|
9
9
|
export declare const getDashboardTaskChildrenIds: (allUserTasks: DashboardTask[], parentTaskIds: ObjectId[]) => ObjectId[];
|
|
10
|
+
/**
|
|
11
|
+
* When thinking about the logic of tasks, the following thoughts come to mind:
|
|
12
|
+
*
|
|
13
|
+
* What would you expect a task manager to do in the case that you have a task
|
|
14
|
+
* with a bunch of subtasks, and you share that single task with another person?
|
|
15
|
+
*
|
|
16
|
+
* - Should the subtasks be automatically shared as well no matter what? (Would make behavior simpler for the user)
|
|
17
|
+
* - Should there instead be an option to share the subtasks automatically?
|
|
18
|
+
* - In the case that the other user adds a subtask to the original task you shared, would you expect to see that subtask?
|
|
19
|
+
* - If there is an option to not share the subtasks automatically, what happens when the other user adds a subtask to the one you shared?
|
|
20
|
+
*
|
|
21
|
+
* Because of the complexity for the user in not automatically sharing subtasks,
|
|
22
|
+
* it seems better to always automatically share subtasks. In a theoretical sense,
|
|
23
|
+
* sharing a task with someone seems to imply the shared ownership of completing
|
|
24
|
+
* the overall task, including all the subtasks.
|
|
25
|
+
*
|
|
26
|
+
* Recurring Tasks:
|
|
27
|
+
*
|
|
28
|
+
* - The user sets a task as recurring with a frequency? Only that task is marked, because when the recurrence comes up, the frontend will update that task and all sub tasks.
|
|
29
|
+
* - The date + time for the recurrence happens? If the users browser is open, the frontend will trigger the update ideally. This needs to be checked if this can be done in a performant way.
|
|
30
|
+
*/
|
|
10
31
|
export default class DashboardTask extends BaseDocumentWithType implements RequiredUserId {
|
|
11
32
|
static docType: string;
|
|
12
33
|
docType: string;
|
|
@@ -15,8 +36,16 @@ export default class DashboardTask extends BaseDocumentWithType implements Requi
|
|
|
15
36
|
*/
|
|
16
37
|
userId: ObjectId;
|
|
17
38
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
39
|
+
* What happens when:
|
|
40
|
+
*
|
|
41
|
+
* - A task is shared that has sub tasks? All the subtasks are shared as well from the frontend. This in case the frontend fails to make a connection to the backend, the state will still be correct.
|
|
42
|
+
* - A subtask of a shared task is deleted? It is deleted like normal
|
|
43
|
+
* - A user that has been shared a task adds a subtask? The subtask gets the same owner as the parent shared task.
|
|
44
|
+
* - A shared task with subtasks is unshared? The frontend will need to make the updates and send them to the backend.
|
|
45
|
+
* - A user removes a collaborator and they have shared tasks with that
|
|
46
|
+
* collaborator? Nothing happens to the tasks. That way, if they add the
|
|
47
|
+
* collaborator back it will return to normal. But the frontend needs to
|
|
48
|
+
* double check for this when displaying things.
|
|
20
49
|
*/
|
|
21
50
|
sharedWith: ObjectId[];
|
|
22
51
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/documents/dashboard/Task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,cAAc,MAAM,4CAA4C,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAE/E,eAAO,MAAM,qBAAqB,EAAE,iBAAiB,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/documents/dashboard/Task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,cAAc,MAAM,4CAA4C,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAE/E,eAAO,MAAM,qBAAqB,EAAE,iBAAiB,CAAC,aAAa,CAmBlE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,iBACxB,aAAa,EAAE,iBACd,QAAQ,EAAE,KACxB,QAAQ,EA2BV,CAAC;AAyBF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,OAAO,OAAO,aACnB,SAAQ,oBACR,YAAW,cAAc;IAEzB,MAAM,CAAC,OAAO,SAAU;IAExB,OAAO,SAAyB;IAEhC;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC;IAEjB;;;;;;;;;;;OAWG;IACH,UAAU,EAAE,QAAQ,EAAE,CAAM;IAE5B,KAAK,SAAM;IAEX,SAAS,UAAS;IAElB;;OAEG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC;IAExB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,WAAW,OAAc;IAEzB;;OAEG;IACH,eAAe,OAAc;IAE7B,SAAS,CAAC,EAAE,IAAI,CAAC;IAEjB,OAAO,CAAC,EAAE,IAAI,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,EAAE,CAAM;IAEpB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAa;gBAEjB,OAAO,EAAE,QAAQ;CAI9B"}
|
|
@@ -14,6 +14,7 @@ const validateDashboardTask = (task) => {
|
|
|
14
14
|
validate.string('title', exampleTask.title);
|
|
15
15
|
validate.boolean('completed', exampleTask.completed);
|
|
16
16
|
validate.optionalString('description');
|
|
17
|
+
validate.array('sharedWith', exampleTask.sharedWith);
|
|
17
18
|
validate.array('tags', exampleTask.tags);
|
|
18
19
|
validate.string('category', exampleTask.category);
|
|
19
20
|
validate.object('createdDate', exampleTask.createdDate);
|
|
@@ -63,6 +64,27 @@ function getChildrenTaskIds(taskIdToTaskDict, parentToTaskIdsDict, taskId) {
|
|
|
63
64
|
});
|
|
64
65
|
return childrenIds;
|
|
65
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* When thinking about the logic of tasks, the following thoughts come to mind:
|
|
69
|
+
*
|
|
70
|
+
* What would you expect a task manager to do in the case that you have a task
|
|
71
|
+
* with a bunch of subtasks, and you share that single task with another person?
|
|
72
|
+
*
|
|
73
|
+
* - Should the subtasks be automatically shared as well no matter what? (Would make behavior simpler for the user)
|
|
74
|
+
* - Should there instead be an option to share the subtasks automatically?
|
|
75
|
+
* - In the case that the other user adds a subtask to the original task you shared, would you expect to see that subtask?
|
|
76
|
+
* - If there is an option to not share the subtasks automatically, what happens when the other user adds a subtask to the one you shared?
|
|
77
|
+
*
|
|
78
|
+
* Because of the complexity for the user in not automatically sharing subtasks,
|
|
79
|
+
* it seems better to always automatically share subtasks. In a theoretical sense,
|
|
80
|
+
* sharing a task with someone seems to imply the shared ownership of completing
|
|
81
|
+
* the overall task, including all the subtasks.
|
|
82
|
+
*
|
|
83
|
+
* Recurring Tasks:
|
|
84
|
+
*
|
|
85
|
+
* - The user sets a task as recurring with a frequency? Only that task is marked, because when the recurrence comes up, the frontend will update that task and all sub tasks.
|
|
86
|
+
* - The date + time for the recurrence happens? If the users browser is open, the frontend will trigger the update ideally. This needs to be checked if this can be done in a performant way.
|
|
87
|
+
*/
|
|
66
88
|
class DashboardTask extends BaseDocumentWithType_1.default {
|
|
67
89
|
static docType = 'task';
|
|
68
90
|
docType = DashboardTask.docType;
|
|
@@ -71,8 +93,16 @@ class DashboardTask extends BaseDocumentWithType_1.default {
|
|
|
71
93
|
*/
|
|
72
94
|
userId;
|
|
73
95
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
96
|
+
* What happens when:
|
|
97
|
+
*
|
|
98
|
+
* - A task is shared that has sub tasks? All the subtasks are shared as well from the frontend. This in case the frontend fails to make a connection to the backend, the state will still be correct.
|
|
99
|
+
* - A subtask of a shared task is deleted? It is deleted like normal
|
|
100
|
+
* - A user that has been shared a task adds a subtask? The subtask gets the same owner as the parent shared task.
|
|
101
|
+
* - A shared task with subtasks is unshared? The frontend will need to make the updates and send them to the backend.
|
|
102
|
+
* - A user removes a collaborator and they have shared tasks with that
|
|
103
|
+
* collaborator? Nothing happens to the tasks. That way, if they add the
|
|
104
|
+
* collaborator back it will return to normal. But the frontend needs to
|
|
105
|
+
* double check for this when displaying things.
|
|
76
106
|
*/
|
|
77
107
|
sharedWith = [];
|
|
78
108
|
title = '';
|