@aneuhold/core-ts-db-lib 2.0.0 → 2.0.2
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/lib/documents/common/ApiKey.d.ts +2 -0
- package/lib/documents/common/ApiKey.d.ts.map +1 -1
- package/lib/documents/common/ApiKey.js +2 -0
- package/lib/documents/common/ApiKey.js.map +1 -1
- package/lib/documents/common/ApiKey.ts +2 -0
- package/lib/documents/common/User.d.ts +8 -0
- package/lib/documents/common/User.d.ts.map +1 -1
- package/lib/documents/common/User.js +8 -0
- package/lib/documents/common/User.js.map +1 -1
- package/lib/documents/common/User.ts +8 -0
- package/lib/documents/dashboard/Task.d.ts +3 -0
- package/lib/documents/dashboard/Task.d.ts.map +1 -1
- package/lib/documents/dashboard/Task.js +3 -0
- package/lib/documents/dashboard/Task.js.map +1 -1
- package/lib/documents/dashboard/Task.ts +3 -0
- package/lib/embedded-types/dashboard/task/FilterSettings.d.ts +12 -0
- package/lib/embedded-types/dashboard/task/FilterSettings.d.ts.map +1 -1
- package/lib/embedded-types/dashboard/task/FilterSettings.js +12 -0
- package/lib/embedded-types/dashboard/task/FilterSettings.js.map +1 -1
- package/lib/embedded-types/dashboard/task/FilterSettings.ts +12 -0
- package/lib/embedded-types/dashboard/task/RecurrenceInfo.d.ts +6 -0
- package/lib/embedded-types/dashboard/task/RecurrenceInfo.d.ts.map +1 -1
- package/lib/embedded-types/dashboard/task/RecurrenceInfo.js +7 -1
- package/lib/embedded-types/dashboard/task/RecurrenceInfo.js.map +1 -1
- package/lib/embedded-types/dashboard/task/RecurrenceInfo.ts +11 -2
- package/lib/embedded-types/dashboard/task/SortSettings.d.ts +18 -0
- package/lib/embedded-types/dashboard/task/SortSettings.d.ts.map +1 -1
- package/lib/embedded-types/dashboard/task/SortSettings.js +12 -0
- package/lib/embedded-types/dashboard/task/SortSettings.js.map +1 -1
- package/lib/embedded-types/dashboard/task/SortSettings.ts +18 -0
- package/lib/schemas/type-guards/commonTypeGuards.d.ts +30 -0
- package/lib/schemas/type-guards/commonTypeGuards.d.ts.map +1 -1
- package/lib/schemas/type-guards/commonTypeGuards.js +30 -0
- package/lib/schemas/type-guards/commonTypeGuards.js.map +1 -1
- package/lib/schemas/type-guards/commonTypeGuards.ts +30 -0
- package/lib/schemas/validators/ValidateUtil.d.ts +75 -0
- package/lib/schemas/validators/ValidateUtil.d.ts.map +1 -1
- package/lib/schemas/validators/ValidateUtil.js +75 -0
- package/lib/schemas/validators/ValidateUtil.js.map +1 -1
- package/lib/schemas/validators/ValidateUtil.ts +75 -0
- package/lib/services/dashboard/Task/TaskFilterService.d.ts +10 -4
- package/lib/services/dashboard/Task/TaskFilterService.d.ts.map +1 -1
- package/lib/services/dashboard/Task/TaskFilterService.js +10 -4
- package/lib/services/dashboard/Task/TaskFilterService.js.map +1 -1
- package/lib/services/dashboard/Task/TaskFilterService.ts +10 -4
- package/lib/services/dashboard/Task/TaskRecurrenceService.d.ts +14 -2
- package/lib/services/dashboard/Task/TaskRecurrenceService.d.ts.map +1 -1
- package/lib/services/dashboard/Task/TaskRecurrenceService.js +14 -2
- package/lib/services/dashboard/Task/TaskRecurrenceService.js.map +1 -1
- package/lib/services/dashboard/Task/TaskRecurrenceService.ts +18 -3
- package/lib/services/dashboard/Task/TaskService.d.ts +33 -4
- package/lib/services/dashboard/Task/TaskService.d.ts.map +1 -1
- package/lib/services/dashboard/Task/TaskService.js +33 -4
- package/lib/services/dashboard/Task/TaskService.js.map +1 -1
- package/lib/services/dashboard/Task/TaskService.spec.ts +31 -0
- package/lib/services/dashboard/Task/TaskService.ts +33 -4
- package/lib/services/dashboard/Task/TaskSortService.d.ts +44 -0
- package/lib/services/dashboard/Task/TaskSortService.d.ts.map +1 -1
- package/lib/services/dashboard/Task/TaskSortService.js +44 -0
- package/lib/services/dashboard/Task/TaskSortService.js.map +1 -1
- package/lib/services/dashboard/Task/TaskSortService.ts +47 -3
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskRecurrenceService.js","sourceRoot":"./src/","sources":["services/dashboard/Task/TaskRecurrenceService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EACL,eAAe,EAEf,uBAAuB,EACxB,MAAM,0DAA0D,CAAC;AAElE,MAAM,CAAC,OAAO,OAAO,8BAA8B;IACjD
|
|
1
|
+
{"version":3,"file":"TaskRecurrenceService.js","sourceRoot":"./src/","sources":["services/dashboard/Task/TaskRecurrenceService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EACL,eAAe,EAEf,uBAAuB,EACxB,MAAM,0DAA0D,CAAC;AAElE,MAAM,CAAC,OAAO,OAAO,8BAA8B;IACjD;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CACzB,SAAe,EACf,SAA8B;QAE9B,oBAAoB;QACpB,IAAI,SAAS,CAAC,IAAI,KAAK,uBAAuB,CAAC,cAAc,EAAE,CAAC;YAC9D,OAAO,WAAW,CAAC,sBAAsB,CAAC,SAAS,CAAC,CAAC;QACvD,CAAC;QACD,oBAAoB;QACpB,IAAI,SAAS,CAAC,IAAI,KAAK,uBAAuB,CAAC,cAAc,EAAE,CAAC;YAC9D,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC;gBAC9B,OAAO,IAAI,CAAC;YACd,CAAC;YACD,IAAI,SAAS,CAAC,cAAc,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;gBAChD,OAAO,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;YACpE,CAAC;YACD,IAAI,SAAS,CAAC,cAAc,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;gBACjD,OAAO,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC,GAAG,CAA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,CAAC;QAC7D,CAAC;QACD,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,OAAO,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACK,MAAM,CAAC,oBAAoB,CACjC,SAA2B,EAC3B,SAA8B;QAE9B,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,CAAC,CAAC;QACX,CAAC;QACD,MAAM,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAC1E,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACvB,OAAO,CAAC,CAAC;QACX,CAAC;QACD,OAAO,iBAAiB,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;IAC3D,CAAC;CACF"}
|
|
@@ -8,10 +8,16 @@ import {
|
|
|
8
8
|
|
|
9
9
|
export default class DashboardTaskRecurrenceService {
|
|
10
10
|
/**
|
|
11
|
-
* Gets the next frequency date from the provided basis date.
|
|
12
|
-
*
|
|
11
|
+
* Gets the next frequency date from the provided basis date.
|
|
12
|
+
*
|
|
13
|
+
* @param basisDate - The date from which to calculate the next frequency date.
|
|
14
|
+
* @param frequency - The recurrence frequency details.
|
|
15
|
+
* @returns The next frequency date or null if the frequency is in an invalid state.
|
|
13
16
|
*/
|
|
14
|
-
static getNextFrequencyDate(
|
|
17
|
+
static getNextFrequencyDate(
|
|
18
|
+
basisDate: Date,
|
|
19
|
+
frequency: RecurrenceFrequency
|
|
20
|
+
): Date | null {
|
|
15
21
|
// Last day of month
|
|
16
22
|
if (frequency.type === RecurrenceFrequencyType.lastDayOfMonth) {
|
|
17
23
|
return DateService.getLastDayOfGivenMonth(basisDate);
|
|
@@ -89,6 +95,8 @@ export default class DashboardTaskRecurrenceService {
|
|
|
89
95
|
*
|
|
90
96
|
* Makes no changes if the state of the task is invalid for recurrence or
|
|
91
97
|
* there isn't recurrence info.
|
|
98
|
+
*
|
|
99
|
+
* @param task - The task whose dates need to be updated.
|
|
92
100
|
*/
|
|
93
101
|
static updateDatesForRecurrence(task: DashboardTask): void {
|
|
94
102
|
// Initial basic validation
|
|
@@ -156,6 +164,13 @@ export default class DashboardTaskRecurrenceService {
|
|
|
156
164
|
}
|
|
157
165
|
}
|
|
158
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Calculates the difference in time between the basis date and the next frequency date.
|
|
169
|
+
*
|
|
170
|
+
* @param basisDate - The date from which to calculate the difference.
|
|
171
|
+
* @param frequency - The recurrence frequency details.
|
|
172
|
+
* @returns The difference in time in milliseconds.
|
|
173
|
+
*/
|
|
159
174
|
private static getDiffForDateUpdate(
|
|
160
175
|
basisDate: Date | undefined,
|
|
161
176
|
frequency: RecurrenceFrequency
|
|
@@ -23,11 +23,19 @@ export type DashboardTaskFilterAndSortResult = {
|
|
|
23
23
|
export default class DashboardTaskService {
|
|
24
24
|
/**
|
|
25
25
|
* Gets all the children task IDs for the given parent task IDs.
|
|
26
|
+
*
|
|
27
|
+
* @param allUserTasks - All tasks of the user.
|
|
28
|
+
* @param parentTaskIds - The IDs of the parent tasks.
|
|
29
|
+
* @returns An array of ObjectId representing the children task IDs.
|
|
26
30
|
*/
|
|
27
31
|
static getChildrenIds: (allUserTasks: DashboardTask[], parentTaskIds: ObjectId[]) => ObjectId[];
|
|
28
32
|
/**
|
|
29
33
|
* Gets the next frequency date from the provided basis date. Returns null
|
|
30
34
|
* if the provided frequency is in an invalid state.
|
|
35
|
+
*
|
|
36
|
+
* @param basisDate - The basis date to calculate the next frequency date.
|
|
37
|
+
* @param frequency - The recurrence frequency.
|
|
38
|
+
* @returns The next frequency date or null if the frequency is invalid.
|
|
31
39
|
*/
|
|
32
40
|
static getNextFrequencyDate(basisDate: Date, frequency: RecurrenceFrequency): Date | null;
|
|
33
41
|
/**
|
|
@@ -38,23 +46,44 @@ export default class DashboardTaskService {
|
|
|
38
46
|
*
|
|
39
47
|
* Makes no changes if the state of the task is invalid for recurrence or
|
|
40
48
|
* there isn't recurrence info.
|
|
49
|
+
*
|
|
50
|
+
* @param task - The task to update dates for.
|
|
41
51
|
*/
|
|
42
52
|
static updateDatesForRecurrence(task: DashboardTask): void;
|
|
43
53
|
/**
|
|
44
54
|
* Gets the filtered and sorted set of task ids for a particular category.
|
|
45
55
|
*
|
|
46
|
-
* @param
|
|
47
|
-
* @param
|
|
48
|
-
*
|
|
49
|
-
*
|
|
56
|
+
* @param taskMap - The map of tasks.
|
|
57
|
+
* @param category - The category of the tasks to filter.
|
|
58
|
+
* @param filterSettings - The filter settings for a task.
|
|
59
|
+
* @param sortSettings - The sort settings for the tasks.
|
|
60
|
+
* @param tagSettings - The tag settings for the user.
|
|
61
|
+
* @param taskInfo - Optional task info for filtering.
|
|
62
|
+
* @returns The filtered and sorted task IDs and the removed task IDs.
|
|
50
63
|
*/
|
|
51
64
|
static getFilteredAndSortedTaskIds(taskMap: DashboardTaskMap, category: string, filterSettings: DashboardTaskListFilterSettings, sortSettings: DashboardTaskListSortSettings, tagSettings: DashboardTagSettings, taskInfo?: DashboardTaskFilterTaskInfo): DashboardTaskFilterAndSortResult;
|
|
52
65
|
/**
|
|
53
66
|
* Gets a map of task IDs to tag header names. Used only for when sorting by
|
|
54
67
|
* tags. If the first task in the list has no high-priority tags, then
|
|
55
68
|
* noPriorityTagsIndicator will be used as the header name.
|
|
69
|
+
*
|
|
70
|
+
* @param taskMap - The map of tasks.
|
|
71
|
+
* @param taskIds - The IDs of the tasks.
|
|
72
|
+
* @param userId - The ID of the user.
|
|
73
|
+
* @param tagSettings - The tag settings for the user.
|
|
74
|
+
* @param noPriorityTagsIndicator - The indicator for no priority tags.
|
|
75
|
+
* @param sortDirection - The direction to sort the tasks.
|
|
76
|
+
* @returns A map of task IDs to tag header names.
|
|
56
77
|
*/
|
|
57
78
|
static getTagHeaderMap(taskMap: DashboardTaskMap, taskIds: string[], userId: string, tagSettings: DashboardTagSettings, noPriorityTagsIndicator: string, sortDirection: DashboardTaskSortDirection): Record<string, string>;
|
|
79
|
+
/**
|
|
80
|
+
* Gets all the children task IDs for a given task ID.
|
|
81
|
+
*
|
|
82
|
+
* @param taskIdToTaskDict - A dictionary mapping task IDs to tasks.
|
|
83
|
+
* @param parentToTaskIdsDict - A dictionary mapping parent task IDs to their children task IDs.
|
|
84
|
+
* @param taskId - The ID of the task to get children for.
|
|
85
|
+
* @returns An array of strings representing the children task IDs.
|
|
86
|
+
*/
|
|
58
87
|
private static getChildrenTaskIds;
|
|
59
88
|
}
|
|
60
89
|
//# sourceMappingURL=TaskService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskService.d.ts","sourceRoot":"./src/","sources":["services/dashboard/Task/TaskService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,aAAa,EAAE,EACpB,gBAAgB,EACjB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,+BAA+B,EAAE,MAAM,0DAA0D,CAAC;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,0DAA0D,CAAC;AAC/F,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC3B,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAO5F;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B;;;;OAIG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,oBAAoB;IACvC
|
|
1
|
+
{"version":3,"file":"TaskService.d.ts","sourceRoot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A8BnC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,eAAe,CACpB,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,oBAAoB,EACjC,uBAAuB,EAAE,MAAM,EAC/B,aAAa,EAAE,0BAA0B,GACxC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAWzB;;;;;;;OAOG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;CAsBlC"}
|
|
@@ -5,6 +5,10 @@ import DashboardTaskSortService from './TaskSortService.js';
|
|
|
5
5
|
export default class DashboardTaskService {
|
|
6
6
|
/**
|
|
7
7
|
* Gets all the children task IDs for the given parent task IDs.
|
|
8
|
+
*
|
|
9
|
+
* @param allUserTasks - All tasks of the user.
|
|
10
|
+
* @param parentTaskIds - The IDs of the parent tasks.
|
|
11
|
+
* @returns An array of ObjectId representing the children task IDs.
|
|
8
12
|
*/
|
|
9
13
|
static getChildrenIds = (allUserTasks, parentTaskIds) => {
|
|
10
14
|
const parentToTaskIdsDict = {};
|
|
@@ -31,6 +35,10 @@ export default class DashboardTaskService {
|
|
|
31
35
|
/**
|
|
32
36
|
* Gets the next frequency date from the provided basis date. Returns null
|
|
33
37
|
* if the provided frequency is in an invalid state.
|
|
38
|
+
*
|
|
39
|
+
* @param basisDate - The basis date to calculate the next frequency date.
|
|
40
|
+
* @param frequency - The recurrence frequency.
|
|
41
|
+
* @returns The next frequency date or null if the frequency is invalid.
|
|
34
42
|
*/
|
|
35
43
|
static getNextFrequencyDate(basisDate, frequency) {
|
|
36
44
|
return DashboardTaskRecurrenceService.getNextFrequencyDate(basisDate, frequency);
|
|
@@ -43,6 +51,8 @@ export default class DashboardTaskService {
|
|
|
43
51
|
*
|
|
44
52
|
* Makes no changes if the state of the task is invalid for recurrence or
|
|
45
53
|
* there isn't recurrence info.
|
|
54
|
+
*
|
|
55
|
+
* @param task - The task to update dates for.
|
|
46
56
|
*/
|
|
47
57
|
static updateDatesForRecurrence(task) {
|
|
48
58
|
DashboardTaskRecurrenceService.updateDatesForRecurrence(task);
|
|
@@ -50,10 +60,13 @@ export default class DashboardTaskService {
|
|
|
50
60
|
/**
|
|
51
61
|
* Gets the filtered and sorted set of task ids for a particular category.
|
|
52
62
|
*
|
|
53
|
-
* @param
|
|
54
|
-
* @param
|
|
55
|
-
*
|
|
56
|
-
*
|
|
63
|
+
* @param taskMap - The map of tasks.
|
|
64
|
+
* @param category - The category of the tasks to filter.
|
|
65
|
+
* @param filterSettings - The filter settings for a task.
|
|
66
|
+
* @param sortSettings - The sort settings for the tasks.
|
|
67
|
+
* @param tagSettings - The tag settings for the user.
|
|
68
|
+
* @param taskInfo - Optional task info for filtering.
|
|
69
|
+
* @returns The filtered and sorted task IDs and the removed task IDs.
|
|
57
70
|
*/
|
|
58
71
|
static getFilteredAndSortedTaskIds(taskMap, category, filterSettings, sortSettings, tagSettings, taskInfo) {
|
|
59
72
|
let filterResult;
|
|
@@ -72,10 +85,26 @@ export default class DashboardTaskService {
|
|
|
72
85
|
* Gets a map of task IDs to tag header names. Used only for when sorting by
|
|
73
86
|
* tags. If the first task in the list has no high-priority tags, then
|
|
74
87
|
* noPriorityTagsIndicator will be used as the header name.
|
|
88
|
+
*
|
|
89
|
+
* @param taskMap - The map of tasks.
|
|
90
|
+
* @param taskIds - The IDs of the tasks.
|
|
91
|
+
* @param userId - The ID of the user.
|
|
92
|
+
* @param tagSettings - The tag settings for the user.
|
|
93
|
+
* @param noPriorityTagsIndicator - The indicator for no priority tags.
|
|
94
|
+
* @param sortDirection - The direction to sort the tasks.
|
|
95
|
+
* @returns A map of task IDs to tag header names.
|
|
75
96
|
*/
|
|
76
97
|
static getTagHeaderMap(taskMap, taskIds, userId, tagSettings, noPriorityTagsIndicator, sortDirection) {
|
|
77
98
|
return DashboardTaskSortService.getTagHeaderMap(taskMap, taskIds, userId, tagSettings, noPriorityTagsIndicator, sortDirection);
|
|
78
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Gets all the children task IDs for a given task ID.
|
|
102
|
+
*
|
|
103
|
+
* @param taskIdToTaskDict - A dictionary mapping task IDs to tasks.
|
|
104
|
+
* @param parentToTaskIdsDict - A dictionary mapping parent task IDs to their children task IDs.
|
|
105
|
+
* @param taskId - The ID of the task to get children for.
|
|
106
|
+
* @returns An array of strings representing the children task IDs.
|
|
107
|
+
*/
|
|
79
108
|
static getChildrenTaskIds(taskIdToTaskDict, parentToTaskIdsDict, taskId) {
|
|
80
109
|
const childrenIds = parentToTaskIdsDict[taskId];
|
|
81
110
|
if (!childrenIds) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskService.js","sourceRoot":"./src/","sources":["services/dashboard/Task/TaskService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAWhC,OAAO,0BAEN,MAAM,wBAAwB,CAAC;AAChC,OAAO,8BAA8B,MAAM,4BAA4B,CAAC;AACxE,OAAO,wBAAwB,MAAM,sBAAsB,CAAC;AAoB5D,MAAM,CAAC,OAAO,OAAO,oBAAoB;IACvC
|
|
1
|
+
{"version":3,"file":"TaskService.js","sourceRoot":"./src/","sources":["services/dashboard/Task/TaskService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAWhC,OAAO,0BAEN,MAAM,wBAAwB,CAAC;AAChC,OAAO,8BAA8B,MAAM,4BAA4B,CAAC;AACxE,OAAO,wBAAwB,MAAM,sBAAsB,CAAC;AAoB5D,MAAM,CAAC,OAAO,OAAO,oBAAoB;IACvC;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,GAAG,CACtB,YAA6B,EAC7B,aAAyB,EACb,EAAE;QACd,MAAM,mBAAmB,GAA6B,EAAE,CAAC;QACzD,MAAM,gBAAgB,GAAkC,EAAE,CAAC;QAC3D,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC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AE;YAC9B,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,gBAAgB,GAAG,IAAI,CAAC,kBAAkB,CAC9C,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,CACR,CAAC;gBACF,WAAW,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,CAAC;YACxC,CAAC;QACH,CAAC,CAAC,CAAC;QACH,OAAO,WAAW,CAAC;IACrB,CAAC"}
|
|
@@ -595,6 +595,12 @@ describe('DashboardTaskService', () => {
|
|
|
595
595
|
});
|
|
596
596
|
});
|
|
597
597
|
|
|
598
|
+
/**
|
|
599
|
+
* Sets up the test environment for sorting and filtering tasks.
|
|
600
|
+
*
|
|
601
|
+
* @param numTasks - The number of tasks to create for the test.
|
|
602
|
+
* @returns An object containing tasksList, taskMap, taskIds, filterSettings, sortSettings, and tagSettings.
|
|
603
|
+
*/
|
|
598
604
|
function setupSortAndFilterTest(numTasks = 5) {
|
|
599
605
|
const userId = new ObjectId();
|
|
600
606
|
const tasksList = createTasksList(numTasks, userId);
|
|
@@ -613,6 +619,13 @@ function setupSortAndFilterTest(numTasks = 5) {
|
|
|
613
619
|
};
|
|
614
620
|
}
|
|
615
621
|
|
|
622
|
+
/**
|
|
623
|
+
* Creates a list of tasks for the given user.
|
|
624
|
+
*
|
|
625
|
+
* @param numTasks - The number of tasks to create.
|
|
626
|
+
* @param userId - The ID of the user for whom the tasks are created.
|
|
627
|
+
* @returns An array of DashboardTask objects.
|
|
628
|
+
*/
|
|
616
629
|
function createTasksList(numTasks: number, userId: ObjectId): DashboardTask[] {
|
|
617
630
|
const tasks: DashboardTask[] = [];
|
|
618
631
|
for (let i = 0; i < numTasks; i += 1) {
|
|
@@ -622,6 +635,12 @@ function createTasksList(numTasks: number, userId: ObjectId): DashboardTask[] {
|
|
|
622
635
|
return tasks;
|
|
623
636
|
}
|
|
624
637
|
|
|
638
|
+
/**
|
|
639
|
+
* Creates a map of tasks from a list of tasks.
|
|
640
|
+
*
|
|
641
|
+
* @param tasks - The list of tasks to convert into a map.
|
|
642
|
+
* @returns A map where the keys are task IDs and the values are DashboardTask objects.
|
|
643
|
+
*/
|
|
625
644
|
function createTaskMapFromList(tasks: DashboardTask[]) {
|
|
626
645
|
return tasks.reduce<Record<string, DashboardTask>>((acc, task) => {
|
|
627
646
|
acc[task._id.toString()] = task;
|
|
@@ -629,6 +648,12 @@ function createTaskMapFromList(tasks: DashboardTask[]) {
|
|
|
629
648
|
}, {});
|
|
630
649
|
}
|
|
631
650
|
|
|
651
|
+
/**
|
|
652
|
+
* Gets the filter settings for the given user.
|
|
653
|
+
*
|
|
654
|
+
* @param userId - The ID of the user for whom the filter settings are retrieved.
|
|
655
|
+
* @returns The filter settings for the user.
|
|
656
|
+
*/
|
|
632
657
|
function getFilterSettings(userId: ObjectId): DashboardTaskListFilterSettings {
|
|
633
658
|
return {
|
|
634
659
|
userId: userId.toString(),
|
|
@@ -645,6 +670,12 @@ function getFilterSettings(userId: ObjectId): DashboardTaskListFilterSettings {
|
|
|
645
670
|
};
|
|
646
671
|
}
|
|
647
672
|
|
|
673
|
+
/**
|
|
674
|
+
* Gets the sort settings for the given user.
|
|
675
|
+
*
|
|
676
|
+
* @param userId - The ID of the user for whom the sort settings are retrieved.
|
|
677
|
+
* @returns The sort settings for the user.
|
|
678
|
+
*/
|
|
648
679
|
function getSortSettings(userId: ObjectId): DashboardTaskListSortSettings {
|
|
649
680
|
return {
|
|
650
681
|
userId: userId.toString(),
|
|
@@ -36,6 +36,10 @@ export type DashboardTaskFilterAndSortResult = {
|
|
|
36
36
|
export default class DashboardTaskService {
|
|
37
37
|
/**
|
|
38
38
|
* Gets all the children task IDs for the given parent task IDs.
|
|
39
|
+
*
|
|
40
|
+
* @param allUserTasks - All tasks of the user.
|
|
41
|
+
* @param parentTaskIds - The IDs of the parent tasks.
|
|
42
|
+
* @returns An array of ObjectId representing the children task IDs.
|
|
39
43
|
*/
|
|
40
44
|
static getChildrenIds = (
|
|
41
45
|
allUserTasks: DashboardTask[],
|
|
@@ -72,6 +76,10 @@ export default class DashboardTaskService {
|
|
|
72
76
|
/**
|
|
73
77
|
* Gets the next frequency date from the provided basis date. Returns null
|
|
74
78
|
* if the provided frequency is in an invalid state.
|
|
79
|
+
*
|
|
80
|
+
* @param basisDate - The basis date to calculate the next frequency date.
|
|
81
|
+
* @param frequency - The recurrence frequency.
|
|
82
|
+
* @returns The next frequency date or null if the frequency is invalid.
|
|
75
83
|
*/
|
|
76
84
|
static getNextFrequencyDate(
|
|
77
85
|
basisDate: Date,
|
|
@@ -91,6 +99,8 @@ export default class DashboardTaskService {
|
|
|
91
99
|
*
|
|
92
100
|
* Makes no changes if the state of the task is invalid for recurrence or
|
|
93
101
|
* there isn't recurrence info.
|
|
102
|
+
*
|
|
103
|
+
* @param task - The task to update dates for.
|
|
94
104
|
*/
|
|
95
105
|
static updateDatesForRecurrence(task: DashboardTask): void {
|
|
96
106
|
DashboardTaskRecurrenceService.updateDatesForRecurrence(task);
|
|
@@ -99,10 +109,13 @@ export default class DashboardTaskService {
|
|
|
99
109
|
/**
|
|
100
110
|
* Gets the filtered and sorted set of task ids for a particular category.
|
|
101
111
|
*
|
|
102
|
-
* @param
|
|
103
|
-
* @param
|
|
104
|
-
*
|
|
105
|
-
*
|
|
112
|
+
* @param taskMap - The map of tasks.
|
|
113
|
+
* @param category - The category of the tasks to filter.
|
|
114
|
+
* @param filterSettings - The filter settings for a task.
|
|
115
|
+
* @param sortSettings - The sort settings for the tasks.
|
|
116
|
+
* @param tagSettings - The tag settings for the user.
|
|
117
|
+
* @param taskInfo - Optional task info for filtering.
|
|
118
|
+
* @returns The filtered and sorted task IDs and the removed task IDs.
|
|
106
119
|
*/
|
|
107
120
|
static getFilteredAndSortedTaskIds(
|
|
108
121
|
taskMap: DashboardTaskMap,
|
|
@@ -145,6 +158,14 @@ export default class DashboardTaskService {
|
|
|
145
158
|
* Gets a map of task IDs to tag header names. Used only for when sorting by
|
|
146
159
|
* tags. If the first task in the list has no high-priority tags, then
|
|
147
160
|
* noPriorityTagsIndicator will be used as the header name.
|
|
161
|
+
*
|
|
162
|
+
* @param taskMap - The map of tasks.
|
|
163
|
+
* @param taskIds - The IDs of the tasks.
|
|
164
|
+
* @param userId - The ID of the user.
|
|
165
|
+
* @param tagSettings - The tag settings for the user.
|
|
166
|
+
* @param noPriorityTagsIndicator - The indicator for no priority tags.
|
|
167
|
+
* @param sortDirection - The direction to sort the tasks.
|
|
168
|
+
* @returns A map of task IDs to tag header names.
|
|
148
169
|
*/
|
|
149
170
|
static getTagHeaderMap(
|
|
150
171
|
taskMap: DashboardTaskMap,
|
|
@@ -164,6 +185,14 @@ export default class DashboardTaskService {
|
|
|
164
185
|
);
|
|
165
186
|
}
|
|
166
187
|
|
|
188
|
+
/**
|
|
189
|
+
* Gets all the children task IDs for a given task ID.
|
|
190
|
+
*
|
|
191
|
+
* @param taskIdToTaskDict - A dictionary mapping task IDs to tasks.
|
|
192
|
+
* @param parentToTaskIdsDict - A dictionary mapping parent task IDs to their children task IDs.
|
|
193
|
+
* @param taskId - The ID of the task to get children for.
|
|
194
|
+
* @returns An array of strings representing the children task IDs.
|
|
195
|
+
*/
|
|
167
196
|
private static getChildrenTaskIds(
|
|
168
197
|
taskIdToTaskDict: Record<string, DashboardTask>,
|
|
169
198
|
parentToTaskIdsDict: Record<string, string[]>,
|
|
@@ -7,24 +7,68 @@ import { DashboardTagSettings } from '../../../embedded-types/dashboard/userConf
|
|
|
7
7
|
export default class DashboardTaskSortService {
|
|
8
8
|
/**
|
|
9
9
|
* Sorts the provided task IDs based on the provided sort settings.
|
|
10
|
+
*
|
|
11
|
+
* @param taskMap The map of tasks.
|
|
12
|
+
* @param taskIds The IDs of the tasks to sort.
|
|
13
|
+
* @param sortSettings The settings to sort by.
|
|
14
|
+
* @param tagSettings The tag settings.
|
|
15
|
+
* @returns The sorted task IDs.
|
|
10
16
|
*/
|
|
11
17
|
static sort(taskMap: DashboardTaskMap, taskIds: string[], sortSettings: DashboardTaskListSortSettings, tagSettings: DashboardTagSettings): string[];
|
|
12
18
|
/**
|
|
13
19
|
* Gets a map of task IDs to tag header names. Used only for when sorting by
|
|
14
20
|
* tags. If the first task in the list has no high-priority tags, then
|
|
15
21
|
* noPriorityTagsIndicator will be used as the header name.
|
|
22
|
+
*
|
|
23
|
+
* @param taskMap The map of tasks.
|
|
24
|
+
* @param taskIds The IDs of the tasks.
|
|
25
|
+
* @param userId The user ID.
|
|
26
|
+
* @param tagSettings The tag settings.
|
|
27
|
+
* @param noPriorityTagsIndicator The indicator for no priority tags.
|
|
28
|
+
* @param sortDirection The sort direction.
|
|
29
|
+
* @returns A map of task IDs to tag header names.
|
|
16
30
|
*/
|
|
17
31
|
static getTagHeaderMap(taskMap: DashboardTaskMap, taskIds: string[], userId: string, tagSettings: DashboardTagSettings, noPriorityTagsIndicator: string, sortDirection: DashboardTaskSortDirection): Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Gets the task sort function based on the sort by and sort direction.
|
|
34
|
+
*
|
|
35
|
+
* @param sortBy The field to sort by.
|
|
36
|
+
* @param sortDirection The direction to sort.
|
|
37
|
+
* @param tagSettings The tag settings.
|
|
38
|
+
* @param userId The user ID.
|
|
39
|
+
* @returns A function that compares two tasks.
|
|
40
|
+
*/
|
|
18
41
|
private static getTaskSortFunction;
|
|
19
42
|
/**
|
|
20
43
|
* Gets the highest priority tag for the provided task. If there are no tags,
|
|
21
44
|
* or if there are no tags with a priority, then this will return null.
|
|
45
|
+
*
|
|
46
|
+
* @param task The task.
|
|
47
|
+
* @param userId The user ID.
|
|
48
|
+
* @param tagSettings The tag settings.
|
|
49
|
+
* @param sortDirection The sort direction.
|
|
50
|
+
* @returns The highest priority tag or null.
|
|
22
51
|
*/
|
|
23
52
|
private static getHighestPriorityTag;
|
|
24
53
|
/**
|
|
25
54
|
* Gets the highest priority tag value for the provided task.
|
|
55
|
+
*
|
|
56
|
+
* @param task The task.
|
|
57
|
+
* @param userId The user ID.
|
|
58
|
+
* @param tagSettings The tag settings.
|
|
59
|
+
* @param sortDirection The sort direction.
|
|
60
|
+
* @returns The highest priority tag value.
|
|
26
61
|
*/
|
|
27
62
|
private static getHighestPriorityTagValue;
|
|
63
|
+
/**
|
|
64
|
+
* Gets the priority tag for the provided task.
|
|
65
|
+
*
|
|
66
|
+
* @param task The task.
|
|
67
|
+
* @param userId The user ID.
|
|
68
|
+
* @param tagSettings The tag settings.
|
|
69
|
+
* @param sortDirection The sort direction.
|
|
70
|
+
* @returns The priority tag or null.
|
|
71
|
+
*/
|
|
28
72
|
private static getPriorityTagForTask;
|
|
29
73
|
}
|
|
30
74
|
//# sourceMappingURL=TaskSortService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskSortService.d.ts","sourceRoot":"./src/","sources":["services/dashboard/Task/TaskSortService.ts"],"names":[],"mappings":"AAAA,OAAsB,EACpB,gBAAgB,EACjB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,6BAA6B,EAE7B,0BAA0B,EAC3B,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAE5F;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,wBAAwB;IAC3C
|
|
1
|
+
{"version":3,"file":"TaskSortService.d.ts","sourceRoot":"./src/","sources":["services/dashboard/Task/TaskSortService.ts"],"names":[],"mappings":"AAAA,OAAsB,EACpB,gBAAgB,EACjB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,6BAA6B,EAE7B,0BAA0B,EAC3B,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAE5F;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,wBAAwB;IAC3C;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAI,CACT,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,MAAM,EAAE,EACjB,YAAY,EAAE,6BAA6B,EAC3C,WAAW,EAAE,oBAAoB,GAChC,MAAM,EAAE;IAyBX;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,eAAe,CACpB,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,oBAAoB,EACjC,uBAAuB,EAAE,MAAM,EAC/B,aAAa,EAAE,0BAA0B,GACxC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAkCzB;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IAkElC;;;;;;;;;OASG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAepC;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAezC;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;CAgCrC"}
|
|
@@ -5,6 +5,12 @@ import { DashboardTaskSortBy, DashboardTaskSortDirection } from '../../../embedd
|
|
|
5
5
|
export default class DashboardTaskSortService {
|
|
6
6
|
/**
|
|
7
7
|
* Sorts the provided task IDs based on the provided sort settings.
|
|
8
|
+
*
|
|
9
|
+
* @param taskMap The map of tasks.
|
|
10
|
+
* @param taskIds The IDs of the tasks to sort.
|
|
11
|
+
* @param sortSettings The settings to sort by.
|
|
12
|
+
* @param tagSettings The tag settings.
|
|
13
|
+
* @returns The sorted task IDs.
|
|
8
14
|
*/
|
|
9
15
|
static sort(taskMap, taskIds, sortSettings, tagSettings) {
|
|
10
16
|
return taskIds.sort((idA, idB) => {
|
|
@@ -27,6 +33,14 @@ export default class DashboardTaskSortService {
|
|
|
27
33
|
* Gets a map of task IDs to tag header names. Used only for when sorting by
|
|
28
34
|
* tags. If the first task in the list has no high-priority tags, then
|
|
29
35
|
* noPriorityTagsIndicator will be used as the header name.
|
|
36
|
+
*
|
|
37
|
+
* @param taskMap The map of tasks.
|
|
38
|
+
* @param taskIds The IDs of the tasks.
|
|
39
|
+
* @param userId The user ID.
|
|
40
|
+
* @param tagSettings The tag settings.
|
|
41
|
+
* @param noPriorityTagsIndicator The indicator for no priority tags.
|
|
42
|
+
* @param sortDirection The sort direction.
|
|
43
|
+
* @returns A map of task IDs to tag header names.
|
|
30
44
|
*/
|
|
31
45
|
static getTagHeaderMap(taskMap, taskIds, userId, tagSettings, noPriorityTagsIndicator, sortDirection) {
|
|
32
46
|
const tagHeaderMap = {};
|
|
@@ -54,6 +68,15 @@ export default class DashboardTaskSortService {
|
|
|
54
68
|
}
|
|
55
69
|
return tagHeaderMap;
|
|
56
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Gets the task sort function based on the sort by and sort direction.
|
|
73
|
+
*
|
|
74
|
+
* @param sortBy The field to sort by.
|
|
75
|
+
* @param sortDirection The direction to sort.
|
|
76
|
+
* @param tagSettings The tag settings.
|
|
77
|
+
* @param userId The user ID.
|
|
78
|
+
* @returns A function that compares two tasks.
|
|
79
|
+
*/
|
|
57
80
|
static getTaskSortFunction(sortBy, sortDirection, tagSettings, userId) {
|
|
58
81
|
switch (sortBy) {
|
|
59
82
|
case DashboardTaskSortBy.tags:
|
|
@@ -110,6 +133,12 @@ export default class DashboardTaskSortService {
|
|
|
110
133
|
/**
|
|
111
134
|
* Gets the highest priority tag for the provided task. If there are no tags,
|
|
112
135
|
* or if there are no tags with a priority, then this will return null.
|
|
136
|
+
*
|
|
137
|
+
* @param task The task.
|
|
138
|
+
* @param userId The user ID.
|
|
139
|
+
* @param tagSettings The tag settings.
|
|
140
|
+
* @param sortDirection The sort direction.
|
|
141
|
+
* @returns The highest priority tag or null.
|
|
113
142
|
*/
|
|
114
143
|
static getHighestPriorityTag(task, userId, tagSettings, sortDirection) {
|
|
115
144
|
const priorityTag = this.getPriorityTagForTask(task, userId, tagSettings, sortDirection);
|
|
@@ -117,11 +146,26 @@ export default class DashboardTaskSortService {
|
|
|
117
146
|
}
|
|
118
147
|
/**
|
|
119
148
|
* Gets the highest priority tag value for the provided task.
|
|
149
|
+
*
|
|
150
|
+
* @param task The task.
|
|
151
|
+
* @param userId The user ID.
|
|
152
|
+
* @param tagSettings The tag settings.
|
|
153
|
+
* @param sortDirection The sort direction.
|
|
154
|
+
* @returns The highest priority tag value.
|
|
120
155
|
*/
|
|
121
156
|
static getHighestPriorityTagValue(task, userId, tagSettings, sortDirection) {
|
|
122
157
|
const priorityTag = this.getPriorityTagForTask(task, userId, tagSettings, sortDirection);
|
|
123
158
|
return priorityTag ? priorityTag.priority : 0;
|
|
124
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Gets the priority tag for the provided task.
|
|
162
|
+
*
|
|
163
|
+
* @param task The task.
|
|
164
|
+
* @param userId The user ID.
|
|
165
|
+
* @param tagSettings The tag settings.
|
|
166
|
+
* @param sortDirection The sort direction.
|
|
167
|
+
* @returns The priority tag or null.
|
|
168
|
+
*/
|
|
125
169
|
static getPriorityTagForTask(task, userId, tagSettings, sortDirection) {
|
|
126
170
|
let priorityTag = null;
|
|
127
171
|
const tags = task.tags[userId];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskSortService.js","sourceRoot":"./src/","sources":["services/dashboard/Task/TaskSortService.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,wDAAwD,CAAC;AAGhE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,wBAAwB;IAC3C
|
|
1
|
+
{"version":3,"file":"TaskSortService.js","sourceRoot":"./src/","sources":["services/dashboard/Task/TaskSortService.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,wDAAwD,CAAC;AAGhE;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,wBAAwB;IAC3C;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAI,CACT,OAAyB,EACzB,OAAiB,EACjB,YAA2C,EAC3C,WAAiC;QAEjC,OAA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