@aneuhold/core-ts-db-lib 1.0.35 → 1.0.37
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/services/dashboard/Task/TaskService.d.ts +8 -3
- package/lib/services/dashboard/Task/TaskService.d.ts.map +1 -1
- package/lib/services/dashboard/Task/TaskService.js +6 -6
- package/lib/services/dashboard/Task/TaskSortService.d.ts +5 -2
- package/lib/services/dashboard/Task/TaskSortService.d.ts.map +1 -1
- package/lib/services/dashboard/Task/TaskSortService.js +15 -12
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ObjectId } from 'bson';
|
|
2
2
|
import DashboardTask, { DashboardTaskMap } from '../../../documents/dashboard/Task';
|
|
3
|
-
import
|
|
3
|
+
import DashboardTaskRecurrenceService from './TaskRecurrenceService';
|
|
4
4
|
import { DashboardTaskListFilterSettings } from '../../../embedded-types/dashboard/task/FilterSettings';
|
|
5
5
|
import { DashboardTaskListSortSettings } from '../../../embedded-types/dashboard/task/SortSettings';
|
|
6
|
+
import DashboardTaskSortService from './TaskSortService';
|
|
6
7
|
import { DashboardTagSettings } from '../../../embedded-types/dashboard/userConfig/Tags';
|
|
7
8
|
/**
|
|
8
9
|
* A type for the task filter settings for a particular task.
|
|
@@ -20,7 +21,7 @@ export default class DashboardTaskService {
|
|
|
20
21
|
* Gets the next frequency date from the provided basis date. Returns null
|
|
21
22
|
* if the provided frequency is in an invalid state.
|
|
22
23
|
*/
|
|
23
|
-
static getNextFrequencyDate
|
|
24
|
+
static getNextFrequencyDate: typeof DashboardTaskRecurrenceService.getNextFrequencyDate;
|
|
24
25
|
/**
|
|
25
26
|
* Moves the start and due date forward by one frequency.
|
|
26
27
|
*
|
|
@@ -30,7 +31,7 @@ export default class DashboardTaskService {
|
|
|
30
31
|
* Makes no changes if the state of the task is invalid for recurrence or
|
|
31
32
|
* there isn't recurrence info.
|
|
32
33
|
*/
|
|
33
|
-
static updateDatesForRecurrence
|
|
34
|
+
static updateDatesForRecurrence: typeof DashboardTaskRecurrenceService.updateDatesForRecurrence;
|
|
34
35
|
/**
|
|
35
36
|
* Gets the filtered and sorted set of task ids for a particular category.
|
|
36
37
|
*
|
|
@@ -40,6 +41,10 @@ export default class DashboardTaskService {
|
|
|
40
41
|
* the user does not have filter settings, then it will use the default.
|
|
41
42
|
*/
|
|
42
43
|
static getFilteredAndSortedTaskIds(taskMap: DashboardTaskMap, category: string, filterSettings: DashboardTaskListFilterSettings, sortSettings: DashboardTaskListSortSettings, tagSettings: DashboardTagSettings, taskInfo?: DashboardTaskFilterTaskInfo): string[];
|
|
44
|
+
/**
|
|
45
|
+
* Gets the highest priority tag value for the provided task.
|
|
46
|
+
*/
|
|
47
|
+
static getHighestPriorityTagValue: typeof DashboardTaskSortService.getHighestPriorityTagValue;
|
|
43
48
|
private static getChildrenTaskIds;
|
|
44
49
|
}
|
|
45
50
|
//# sourceMappingURL=TaskService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskService.d.ts","sourceRoot":"","sources":["../../../../src/services/dashboard/Task/TaskService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,aAAa,EAAE,EACpB,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,
|
|
1
|
+
{"version":3,"file":"TaskService.d.ts","sourceRoot":"","sources":["../../../../src/services/dashboard/Task/TaskService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,aAAa,EAAE,EACpB,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,8BAA8B,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,+BAA+B,EAAE,MAAM,uDAAuD,CAAC;AACxG,OAAO,EAAE,6BAA6B,EAAE,MAAM,qDAAqD,CAAC;AAEpG,OAAO,wBAAwB,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAEzF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,oBAAoB;IACvC;;OAEG;IACH,MAAM,CAAC,cAAc,iBACL,aAAa,EAAE,iBACd,QAAQ,EAAE,KACxB,QAAQ,EAAE,CA2BX;IAEF;;;OAGG;IACH,MAAM,CAAC,oBAAoB,6DAC2B;IAEtD;;;;;;;;OAQG;IACH,MAAM,CAAC,wBAAwB,iEAC2B;IAE1D;;;;;;;OAOG;IACH,MAAM,CAAC,2BAA2B,CAChC,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,+BAA+B,EAC/C,YAAY,EAAE,6BAA6B,EAC3C,WAAW,EAAE,oBAAoB,EACjC,QAAQ,CAAC,EAAE,2BAA2B,GACrC,MAAM,EAAE;IA2BX;;OAEG;IACH,MAAM,CAAC,0BAA0B,6DACqB;IAEtD,OAAO,CAAC,MAAM,CAAC,kBAAkB;CAsBlC"}
|
|
@@ -37,9 +37,7 @@ class DashboardTaskService {
|
|
|
37
37
|
* Gets the next frequency date from the provided basis date. Returns null
|
|
38
38
|
* if the provided frequency is in an invalid state.
|
|
39
39
|
*/
|
|
40
|
-
static getNextFrequencyDate
|
|
41
|
-
return TaskRecurrenceService_1.default.getNextFrequencyDate(basisDate, frequency);
|
|
42
|
-
}
|
|
40
|
+
static getNextFrequencyDate = TaskRecurrenceService_1.default.getNextFrequencyDate;
|
|
43
41
|
/**
|
|
44
42
|
* Moves the start and due date forward by one frequency.
|
|
45
43
|
*
|
|
@@ -49,9 +47,7 @@ class DashboardTaskService {
|
|
|
49
47
|
* Makes no changes if the state of the task is invalid for recurrence or
|
|
50
48
|
* there isn't recurrence info.
|
|
51
49
|
*/
|
|
52
|
-
static updateDatesForRecurrence
|
|
53
|
-
return TaskRecurrenceService_1.default.updateDatesForRecurrence(task);
|
|
54
|
-
}
|
|
50
|
+
static updateDatesForRecurrence = TaskRecurrenceService_1.default.updateDatesForRecurrence;
|
|
55
51
|
/**
|
|
56
52
|
* Gets the filtered and sorted set of task ids for a particular category.
|
|
57
53
|
*
|
|
@@ -70,6 +66,10 @@ class DashboardTaskService {
|
|
|
70
66
|
}
|
|
71
67
|
return TaskSortService_1.default.sort(taskMap, filterResult, sortSettings, tagSettings);
|
|
72
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Gets the highest priority tag value for the provided task.
|
|
71
|
+
*/
|
|
72
|
+
static getHighestPriorityTagValue = TaskSortService_1.default.getHighestPriorityTagValue;
|
|
73
73
|
static getChildrenTaskIds(taskIdToTaskDict, parentToTaskIdsDict, taskId) {
|
|
74
74
|
const childrenIds = parentToTaskIdsDict[taskId];
|
|
75
75
|
if (!childrenIds) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DashboardTaskMap } from '../../../documents/dashboard/Task';
|
|
1
|
+
import DashboardTask, { DashboardTaskMap } from '../../../documents/dashboard/Task';
|
|
2
2
|
import { DashboardTaskListSortSettings } from '../../../embedded-types/dashboard/task/SortSettings';
|
|
3
3
|
import { DashboardTagSettings } from '../../../embedded-types/dashboard/userConfig/Tags';
|
|
4
4
|
/**
|
|
@@ -9,7 +9,10 @@ export default class DashboardTaskSortService {
|
|
|
9
9
|
* Sorts the provided task IDs based on the provided sort settings.
|
|
10
10
|
*/
|
|
11
11
|
static sort(taskMap: DashboardTaskMap, taskIds: string[], sortSettings: DashboardTaskListSortSettings, tagSettings: DashboardTagSettings): string[];
|
|
12
|
+
/**
|
|
13
|
+
* Gets the highest priority tag value for the provided task.
|
|
14
|
+
*/
|
|
15
|
+
static getHighestPriorityTagValue(task: DashboardTask, userId: string, tagSettings: DashboardTagSettings): number;
|
|
12
16
|
private static getTaskSortFunction;
|
|
13
|
-
private static getHighestPriorityTagValue;
|
|
14
17
|
}
|
|
15
18
|
//# sourceMappingURL=TaskSortService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskSortService.d.ts","sourceRoot":"","sources":["../../../../src/services/dashboard/Task/TaskSortService.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"TaskSortService.d.ts","sourceRoot":"","sources":["../../../../src/services/dashboard/Task/TaskSortService.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,EAAE,EACpB,gBAAgB,EACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,6BAA6B,EAG9B,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAEzF;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,wBAAwB;IAC3C;;OAEG;IACH,MAAM,CAAC,IAAI,CACT,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,MAAM,EAAE,EACjB,YAAY,EAAE,6BAA6B,EAC3C,WAAW,EAAE,oBAAoB;IA0BnC;;OAEG;IACH,MAAM,CAAC,0BAA0B,CAC/B,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,oBAAoB;IAcnC,OAAO,CAAC,MAAM,CAAC,mBAAmB;CA+DnC"}
|
|
@@ -25,6 +25,21 @@ class DashboardTaskSortService {
|
|
|
25
25
|
return 0;
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Gets the highest priority tag value for the provided task.
|
|
30
|
+
*/
|
|
31
|
+
static getHighestPriorityTagValue(task, userId, tagSettings) {
|
|
32
|
+
const tags = task.tags[userId];
|
|
33
|
+
if (!tags || tags.length === 0)
|
|
34
|
+
return 0;
|
|
35
|
+
return tags.reduce((highestPriority, tag) => {
|
|
36
|
+
const priority = tagSettings[tag]?.priority;
|
|
37
|
+
if (priority && priority > highestPriority) {
|
|
38
|
+
return priority;
|
|
39
|
+
}
|
|
40
|
+
return highestPriority;
|
|
41
|
+
}, 0);
|
|
42
|
+
}
|
|
28
43
|
static getTaskSortFunction(sortBy, sortDirection, tagSettings, userId) {
|
|
29
44
|
switch (sortBy) {
|
|
30
45
|
case SortSettings_1.DashboardTaskSortBy.tags:
|
|
@@ -78,17 +93,5 @@ class DashboardTaskSortService {
|
|
|
78
93
|
};
|
|
79
94
|
}
|
|
80
95
|
}
|
|
81
|
-
static getHighestPriorityTagValue(task, userId, tagSettings) {
|
|
82
|
-
const tags = task.tags[userId];
|
|
83
|
-
if (!tags || tags.length === 0)
|
|
84
|
-
return 0;
|
|
85
|
-
return tags.reduce((highestPriority, tag) => {
|
|
86
|
-
const priority = tagSettings[tag]?.priority;
|
|
87
|
-
if (priority && priority > highestPriority) {
|
|
88
|
-
return priority;
|
|
89
|
-
}
|
|
90
|
-
return highestPriority;
|
|
91
|
-
}, 0);
|
|
92
|
-
}
|
|
93
96
|
}
|
|
94
97
|
exports.default = DashboardTaskSortService;
|