@aneuhold/core-ts-db-lib 3.0.3 → 4.0.0
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/CHANGELOG.md +27 -0
- package/lib/browser.d.ts +19 -16
- package/lib/browser.d.ts.map +1 -1
- package/lib/browser.js +10 -12
- package/lib/browser.js.map +1 -1
- package/lib/browser.ts +46 -36
- package/lib/documents/BaseDocument.d.ts +22 -9
- package/lib/documents/BaseDocument.d.ts.map +1 -1
- package/lib/documents/BaseDocument.js +16 -7
- package/lib/documents/BaseDocument.js.map +1 -1
- package/lib/documents/BaseDocument.ts +27 -7
- package/lib/documents/common/ApiKey.d.ts +8 -25
- package/lib/documents/common/ApiKey.d.ts.map +1 -1
- package/lib/documents/common/ApiKey.js +7 -36
- package/lib/documents/common/ApiKey.js.map +1 -1
- package/lib/documents/common/ApiKey.ts +11 -41
- package/lib/documents/common/User.d.ts +25 -31
- package/lib/documents/common/User.d.ts.map +1 -1
- package/lib/documents/common/User.js +22 -39
- package/lib/documents/common/User.js.map +1 -1
- package/lib/documents/common/User.ts +29 -53
- package/lib/documents/dashboard/NonogramKatanaItem.d.ts +18 -27
- package/lib/documents/dashboard/NonogramKatanaItem.d.ts.map +1 -1
- package/lib/documents/dashboard/NonogramKatanaItem.js +17 -31
- package/lib/documents/dashboard/NonogramKatanaItem.js.map +1 -1
- package/lib/documents/dashboard/NonogramKatanaItem.ts +21 -45
- package/lib/documents/dashboard/NonogramKatanaUpgrade.d.ts +16 -41
- package/lib/documents/dashboard/NonogramKatanaUpgrade.d.ts.map +1 -1
- package/lib/documents/dashboard/NonogramKatanaUpgrade.js +17 -43
- package/lib/documents/dashboard/NonogramKatanaUpgrade.js.map +1 -1
- package/lib/documents/dashboard/NonogramKatanaUpgrade.ts +21 -55
- package/lib/documents/dashboard/Task.d.ts +73 -97
- package/lib/documents/dashboard/Task.d.ts.map +1 -1
- package/lib/documents/dashboard/Task.js +38 -80
- package/lib/documents/dashboard/Task.js.map +1 -1
- package/lib/documents/dashboard/Task.ts +71 -111
- package/lib/documents/dashboard/UserConfig.d.ts +49 -69
- package/lib/documents/dashboard/UserConfig.d.ts.map +1 -1
- package/lib/documents/dashboard/UserConfig.js +31 -51
- package/lib/documents/dashboard/UserConfig.js.map +1 -1
- package/lib/documents/dashboard/UserConfig.ts +41 -87
- package/lib/embedded-types/dashboard/nonogramKatanaItem/ItemName.d.ts +5 -0
- package/lib/embedded-types/dashboard/nonogramKatanaItem/ItemName.d.ts.map +1 -1
- package/lib/embedded-types/dashboard/nonogramKatanaItem/ItemName.js +5 -0
- package/lib/embedded-types/dashboard/nonogramKatanaItem/ItemName.js.map +1 -1
- package/lib/embedded-types/dashboard/nonogramKatanaItem/ItemName.ts +7 -0
- package/lib/embedded-types/dashboard/nonogramKatanaUpgrade/UpgradeName.d.ts +5 -0
- package/lib/embedded-types/dashboard/nonogramKatanaUpgrade/UpgradeName.d.ts.map +1 -1
- package/lib/embedded-types/dashboard/nonogramKatanaUpgrade/UpgradeName.js +5 -0
- package/lib/embedded-types/dashboard/nonogramKatanaUpgrade/UpgradeName.js.map +1 -1
- package/lib/embedded-types/dashboard/nonogramKatanaUpgrade/UpgradeName.ts +7 -0
- package/lib/embedded-types/dashboard/task/FilterSettings.d.ts +69 -41
- package/lib/embedded-types/dashboard/task/FilterSettings.d.ts.map +1 -1
- package/lib/embedded-types/dashboard/task/FilterSettings.js +29 -36
- package/lib/embedded-types/dashboard/task/FilterSettings.js.map +1 -1
- package/lib/embedded-types/dashboard/task/FilterSettings.ts +51 -74
- package/lib/embedded-types/dashboard/task/RecurrenceInfo.d.ts +74 -52
- package/lib/embedded-types/dashboard/task/RecurrenceInfo.d.ts.map +1 -1
- package/lib/embedded-types/dashboard/task/RecurrenceInfo.js +66 -28
- package/lib/embedded-types/dashboard/task/RecurrenceInfo.js.map +1 -1
- package/lib/embedded-types/dashboard/task/RecurrenceInfo.ts +83 -77
- package/lib/embedded-types/dashboard/task/SortSettings.d.ts +61 -42
- package/lib/embedded-types/dashboard/task/SortSettings.d.ts.map +1 -1
- package/lib/embedded-types/dashboard/task/SortSettings.js +34 -31
- package/lib/embedded-types/dashboard/task/SortSettings.js.map +1 -1
- package/lib/embedded-types/dashboard/task/SortSettings.ts +66 -61
- package/lib/embedded-types/dashboard/userConfig/Tags.d.ts +18 -11
- package/lib/embedded-types/dashboard/userConfig/Tags.d.ts.map +1 -1
- package/lib/embedded-types/dashboard/userConfig/Tags.js +15 -1
- package/lib/embedded-types/dashboard/userConfig/Tags.js.map +1 -1
- package/lib/embedded-types/dashboard/userConfig/Tags.ts +21 -9
- package/lib/schemas/required-refs/RequiredUserId.d.ts +9 -5
- package/lib/schemas/required-refs/RequiredUserId.d.ts.map +1 -1
- package/lib/schemas/required-refs/RequiredUserId.js +9 -4
- package/lib/schemas/required-refs/RequiredUserId.js.map +1 -1
- package/lib/schemas/required-refs/RequiredUserId.ts +13 -4
- package/lib/services/DocumentService.d.ts +1 -1
- package/lib/services/DocumentService.d.ts.map +1 -1
- package/lib/services/DocumentService.js +0 -1
- package/lib/services/DocumentService.js.map +1 -1
- package/lib/services/DocumentService.ts +1 -1
- package/lib/services/dashboard/Task/TaskRecurrenceService.d.ts +4 -4
- package/lib/services/dashboard/Task/TaskRecurrenceService.d.ts.map +1 -1
- package/lib/services/dashboard/Task/TaskRecurrenceService.js +3 -4
- package/lib/services/dashboard/Task/TaskRecurrenceService.js.map +1 -1
- package/lib/services/dashboard/Task/TaskRecurrenceService.ts +8 -5
- package/lib/services/dashboard/Task/TaskService.d.ts +1 -2
- package/lib/services/dashboard/Task/TaskService.d.ts.map +1 -1
- package/lib/services/dashboard/Task/TaskService.js +0 -1
- package/lib/services/dashboard/Task/TaskService.js.map +1 -1
- package/lib/services/dashboard/Task/TaskService.ts +1 -2
- package/lib/services/dashboard/Task/TaskSortService.d.ts.map +1 -1
- package/lib/services/dashboard/Task/TaskSortService.js +0 -1
- package/lib/services/dashboard/Task/TaskSortService.js.map +1 -1
- package/lib/services/dashboard/Task/TaskSortService.ts +1 -2
- package/package.json +10 -10
- package/lib/documents/BaseDocumentWithType.d.ts +0 -8
- package/lib/documents/BaseDocumentWithType.d.ts.map +0 -1
- package/lib/documents/BaseDocumentWithType.js +0 -7
- package/lib/documents/BaseDocumentWithType.js.map +0 -1
- package/lib/documents/BaseDocumentWithType.ts +0 -8
- package/lib/schemas/type-guards/commonTypeGuards.d.ts +0 -36
- package/lib/schemas/type-guards/commonTypeGuards.d.ts.map +0 -1
- package/lib/schemas/type-guards/commonTypeGuards.js +0 -46
- package/lib/schemas/type-guards/commonTypeGuards.js.map +0 -1
- package/lib/schemas/type-guards/commonTypeGuards.ts +0 -49
- package/lib/schemas/validators/DocumentValidator.d.ts +0 -9
- package/lib/schemas/validators/DocumentValidator.d.ts.map +0 -1
- package/lib/schemas/validators/DocumentValidator.js +0 -2
- package/lib/schemas/validators/DocumentValidator.js.map +0 -1
- package/lib/schemas/validators/DocumentValidator.ts +0 -9
- package/lib/schemas/validators/ValidateUtil.d.ts +0 -122
- package/lib/schemas/validators/ValidateUtil.d.ts.map +0 -1
- package/lib/schemas/validators/ValidateUtil.js +0 -216
- package/lib/schemas/validators/ValidateUtil.js.map +0 -1
- package/lib/schemas/validators/ValidateUtil.ts +0 -240
|
@@ -1,66 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import NonogramKatanaItemName from '../../embedded-types/dashboard/nonogramKatanaItem/ItemName.js';
|
|
1
|
+
import { z } from 'zod';
|
|
3
2
|
import NonogramKatanaUpgradeName from '../../embedded-types/dashboard/nonogramKatanaUpgrade/UpgradeName.js';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import BaseDocumentWithType from '../BaseDocumentWithType.js';
|
|
3
|
+
import { RequiredUserIdSchema } from '../../schemas/required-refs/RequiredUserId.js';
|
|
4
|
+
import { BaseDocumentWithTypeSchema } from '../BaseDocument.js';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param upgrade The {@link NonogramKatanaUpgrade} document to validate.
|
|
12
|
-
* @returns An object containing the updated document and any validation errors.
|
|
7
|
+
* The docType value for NonogramKatanaUpgrade documents.
|
|
13
8
|
*/
|
|
14
|
-
export const
|
|
15
|
-
upgrade: NonogramKatanaUpgrade
|
|
16
|
-
) => {
|
|
17
|
-
const errors: string[] = [];
|
|
18
|
-
|
|
19
|
-
// No validation at the moment.
|
|
20
|
-
|
|
21
|
-
return { updatedDoc: upgrade, errors };
|
|
22
|
-
};
|
|
9
|
+
export const NonogramKatanaUpgrade_docType = 'nonogramKatanaUpgrade';
|
|
23
10
|
|
|
24
11
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
* ```typescript
|
|
29
|
-
* const upgrade = new NonogramKatanaUpgrade(ownerId, upgradeName);
|
|
30
|
-
* upgrade.completed = true;
|
|
31
|
-
* upgrade.priority = 5;
|
|
32
|
-
* ```
|
|
12
|
+
* The schema for {@link NonogramKatanaUpgrade} documents.
|
|
33
13
|
*/
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
docType
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
upgradeName: NonogramKatanaUpgradeName;
|
|
45
|
-
|
|
46
|
-
completed: boolean = false;
|
|
47
|
-
|
|
48
|
-
currentItemAmounts: { [key in NonogramKatanaItemName]?: number } = {};
|
|
49
|
-
|
|
14
|
+
export const NonogramKatanaUpgradeSchema = z.object({
|
|
15
|
+
...BaseDocumentWithTypeSchema.shape,
|
|
16
|
+
...RequiredUserIdSchema.shape,
|
|
17
|
+
docType: z.literal(NonogramKatanaUpgrade_docType).default(NonogramKatanaUpgrade_docType),
|
|
18
|
+
upgradeName: z.enum(NonogramKatanaUpgradeName),
|
|
19
|
+
completed: z.boolean().default(false),
|
|
20
|
+
currentItemAmounts: z
|
|
21
|
+
.partialRecord(z.enum(NonogramKatanaUpgradeName), z.int().nullish())
|
|
22
|
+
.default({}),
|
|
50
23
|
/**
|
|
51
24
|
* Priority, where the higher the number, the higher up the list it is.
|
|
52
25
|
*/
|
|
53
|
-
priority:
|
|
26
|
+
priority: z.int().default(0)
|
|
27
|
+
});
|
|
54
28
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
* @param upgradeName - The name of the upgrade.
|
|
60
|
-
*/
|
|
61
|
-
constructor(ownerId: UUID, upgradeName: NonogramKatanaUpgradeName) {
|
|
62
|
-
super();
|
|
63
|
-
this.userId = ownerId;
|
|
64
|
-
this.upgradeName = upgradeName;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
29
|
+
/**
|
|
30
|
+
* Represents an upgrade for a Nonogram Katana.
|
|
31
|
+
*/
|
|
32
|
+
export type NonogramKatanaUpgrade = z.infer<typeof NonogramKatanaUpgradeSchema>;
|
|
@@ -1,18 +1,77 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import type { ParentRecurringTaskInfo, RecurrenceInfo } from '../../embedded-types/dashboard/task/RecurrenceInfo.js';
|
|
4
|
-
import type { DashboardTaskSortSettings } from '../../embedded-types/dashboard/task/SortSettings.js';
|
|
5
|
-
import RequiredUserId from '../../schemas/required-refs/RequiredUserId.js';
|
|
6
|
-
import type { DocumentValidator } from '../../schemas/validators/DocumentValidator.js';
|
|
7
|
-
import { type DocumentMap } from '../../services/DocumentService.js';
|
|
8
|
-
import BaseDocumentWithType from '../BaseDocumentWithType.js';
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { DocumentMap } from '../../services/DocumentService.js';
|
|
9
3
|
/**
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
* The docType value for DashboardTask documents.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DashboardTask_docType = "task";
|
|
7
|
+
/**
|
|
8
|
+
* The schema for {@link DashboardTask} documents.
|
|
14
9
|
*/
|
|
15
|
-
export declare const
|
|
10
|
+
export declare const DashboardTaskSchema: z.ZodObject<{
|
|
11
|
+
docType: z.ZodDefault<z.ZodLiteral<"task">>;
|
|
12
|
+
sharedWith: z.ZodDefault<z.ZodArray<z.ZodPipe<z.ZodUUID, z.ZodTransform<`${string}-${string}-${string}-${string}-${string}`, string>>>>;
|
|
13
|
+
assignedTo: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUUID, z.ZodTransform<`${string}-${string}-${string}-${string}-${string}`, string>>>>;
|
|
14
|
+
recurrenceInfo: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
15
|
+
frequency: z.ZodObject<{
|
|
16
|
+
type: z.ZodEnum<typeof import("../../embedded-types/dashboard/task/RecurrenceInfo.js").RecurrenceFrequencyType>;
|
|
17
|
+
everyXTimeUnit: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
18
|
+
timeUnit: z.ZodEnum<{
|
|
19
|
+
day: "day";
|
|
20
|
+
week: "week";
|
|
21
|
+
month: "month";
|
|
22
|
+
year: "year";
|
|
23
|
+
}>;
|
|
24
|
+
x: z.ZodInt;
|
|
25
|
+
}, z.core.$strip>>>;
|
|
26
|
+
weekDaySet: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodInt>>>;
|
|
27
|
+
everyXWeekdayOfMonth: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
28
|
+
weekDay: z.ZodInt;
|
|
29
|
+
weekOfMonth: z.ZodUnion<readonly [z.ZodInt, z.ZodLiteral<"last">]>;
|
|
30
|
+
}, z.core.$strip>>>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
recurrenceBasis: z.ZodEnum<typeof import("../../embedded-types/dashboard/task/RecurrenceInfo.js").RecurrenceBasis>;
|
|
33
|
+
recurrenceEffect: z.ZodEnum<typeof import("../../embedded-types/dashboard/task/RecurrenceInfo.js").RecurrenceEffect>;
|
|
34
|
+
}, z.core.$strip>>>;
|
|
35
|
+
parentRecurringTaskInfo: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
36
|
+
taskId: z.ZodPipe<z.ZodUUID, z.ZodTransform<`${string}-${string}-${string}-${string}-${string}`, string>>;
|
|
37
|
+
startDate: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
38
|
+
dueDate: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
39
|
+
}, z.core.$strip>>>;
|
|
40
|
+
title: z.ZodDefault<z.ZodString>;
|
|
41
|
+
completed: z.ZodDefault<z.ZodBoolean>;
|
|
42
|
+
parentTaskId: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUUID, z.ZodTransform<`${string}-${string}-${string}-${string}-${string}`, string>>>>;
|
|
43
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
44
|
+
createdDate: z.ZodDefault<z.ZodDate>;
|
|
45
|
+
lastUpdatedDate: z.ZodDefault<z.ZodDate>;
|
|
46
|
+
startDate: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
47
|
+
dueDate: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
48
|
+
tags: z.ZodDefault<z.ZodRecord<z.ZodPipe<z.ZodUUID, z.ZodTransform<`${string}-${string}-${string}-${string}-${string}`, string>>, z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>>>;
|
|
49
|
+
category: z.ZodDefault<z.ZodString>;
|
|
50
|
+
filterSettings: z.ZodDefault<z.ZodRecord<z.ZodPipe<z.ZodUUID, z.ZodTransform<`${string}-${string}-${string}-${string}-${string}`, string>>, z.ZodObject<{
|
|
51
|
+
userId: z.ZodPipe<z.ZodUUID, z.ZodTransform<`${string}-${string}-${string}-${string}-${string}`, string>>;
|
|
52
|
+
completed: z.ZodObject<{
|
|
53
|
+
show: z.ZodBoolean;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
grandChildrenTasks: z.ZodObject<{
|
|
56
|
+
show: z.ZodBoolean;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
startDate: z.ZodObject<{
|
|
59
|
+
showFutureTasks: z.ZodBoolean;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
tags: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
62
|
+
show: z.ZodBoolean;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
}, z.core.$strip>>>;
|
|
65
|
+
sortSettings: z.ZodDefault<z.ZodRecord<z.ZodPipe<z.ZodUUID, z.ZodTransform<`${string}-${string}-${string}-${string}-${string}`, string>>, z.ZodObject<{
|
|
66
|
+
userId: z.ZodPipe<z.ZodUUID, z.ZodTransform<`${string}-${string}-${string}-${string}-${string}`, string>>;
|
|
67
|
+
sortList: z.ZodArray<z.ZodObject<{
|
|
68
|
+
sortBy: z.ZodEnum<typeof import("../../embedded-types/dashboard/task/SortSettings.js").DashboardTaskSortBy>;
|
|
69
|
+
sortDirection: z.ZodEnum<typeof import("../../embedded-types/dashboard/task/SortSettings.js").DashboardTaskSortDirection>;
|
|
70
|
+
}, z.core.$strip>>;
|
|
71
|
+
}, z.core.$strip>>>;
|
|
72
|
+
_id: z.ZodPipe<z.ZodDefault<z.ZodUUID>, z.ZodTransform<`${string}-${string}-${string}-${string}-${string}`, string>>;
|
|
73
|
+
userId: z.ZodPipe<z.ZodUUID, z.ZodTransform<`${string}-${string}-${string}-${string}-${string}`, string>>;
|
|
74
|
+
}, z.core.$strip>;
|
|
16
75
|
/**
|
|
17
76
|
* A utility type for a map of tasks.
|
|
18
77
|
*/
|
|
@@ -38,88 +97,5 @@ export type DashboardTaskMap = DocumentMap<DashboardTask>;
|
|
|
38
97
|
* - 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.
|
|
39
98
|
* - 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.
|
|
40
99
|
*/
|
|
41
|
-
export
|
|
42
|
-
static docType: string;
|
|
43
|
-
docType: string;
|
|
44
|
-
/**
|
|
45
|
-
* The owner of this task.
|
|
46
|
-
*/
|
|
47
|
-
userId: UUID;
|
|
48
|
-
/**
|
|
49
|
-
* What happens when:
|
|
50
|
-
*
|
|
51
|
-
* - 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.
|
|
52
|
-
* - A subtask of a shared task is deleted? It is deleted like normal
|
|
53
|
-
* - A user that has been shared a task adds a subtask? The subtask gets the same owner as the parent shared task.
|
|
54
|
-
* - A shared task with subtasks is unshared? The frontend will need to make the updates and send them to the backend.
|
|
55
|
-
* - A user removes a collaborator and they have shared tasks with that
|
|
56
|
-
* collaborator? Nothing happens to the tasks. That way, if they add the
|
|
57
|
-
* collaborator back it will return to normal. But the frontend needs to
|
|
58
|
-
* double check for this when displaying things.
|
|
59
|
-
*/
|
|
60
|
-
sharedWith: UUID[];
|
|
61
|
-
/**
|
|
62
|
-
* The user ID that this task is assigned to.
|
|
63
|
-
*/
|
|
64
|
-
assignedTo?: UUID;
|
|
65
|
-
/**
|
|
66
|
-
* The recurrence info for this task if there is any.
|
|
67
|
-
*/
|
|
68
|
-
recurrenceInfo?: RecurrenceInfo;
|
|
69
|
-
/**
|
|
70
|
-
* The recurring task info for the parent recurring task if there is one.
|
|
71
|
-
*
|
|
72
|
-
* If this is set, then the current tasks's recurrence info should be the
|
|
73
|
-
* same as the parent recurring task.
|
|
74
|
-
*/
|
|
75
|
-
parentRecurringTaskInfo?: ParentRecurringTaskInfo;
|
|
76
|
-
/**
|
|
77
|
-
* The title of the task.
|
|
78
|
-
*/
|
|
79
|
-
title: string;
|
|
80
|
-
completed: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* The ID of the parent task if there is one.
|
|
83
|
-
*/
|
|
84
|
-
parentTaskId?: UUID;
|
|
85
|
-
/**
|
|
86
|
-
* The description of the task. This is purposefully optional in case the
|
|
87
|
-
* user wants to just use the title. This also helps the frontend
|
|
88
|
-
* differentiate between a task that has no description and a task that has
|
|
89
|
-
* an empty description.
|
|
90
|
-
*/
|
|
91
|
-
description?: string;
|
|
92
|
-
/**
|
|
93
|
-
* The date this task was created.
|
|
94
|
-
*/
|
|
95
|
-
createdDate: Date;
|
|
96
|
-
/**
|
|
97
|
-
* The date this task was last updated.
|
|
98
|
-
*/
|
|
99
|
-
lastUpdatedDate: Date;
|
|
100
|
-
startDate?: Date;
|
|
101
|
-
dueDate?: Date;
|
|
102
|
-
/**
|
|
103
|
-
* User-assigned tags for this task.
|
|
104
|
-
*/
|
|
105
|
-
tags: {
|
|
106
|
-
[userId: UUID]: string[] | undefined;
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* System-assigned category for this task. This should be used to determine
|
|
110
|
-
* where this task should be displayed.
|
|
111
|
-
*/
|
|
112
|
-
category: string;
|
|
113
|
-
/**
|
|
114
|
-
* The filter settings for subtasks of this task specifically, keyed on
|
|
115
|
-
* each user.
|
|
116
|
-
*/
|
|
117
|
-
filterSettings: DashboardTaskFilterSettings;
|
|
118
|
-
/**
|
|
119
|
-
* The sort settings for subtasks of this task specifically, keyed on
|
|
120
|
-
* each user.
|
|
121
|
-
*/
|
|
122
|
-
sortSettings: DashboardTaskSortSettings;
|
|
123
|
-
constructor(ownerId: UUID);
|
|
124
|
-
}
|
|
100
|
+
export type DashboardTask = z.infer<typeof DashboardTaskSchema>;
|
|
125
101
|
//# sourceMappingURL=Task.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/documents/dashboard/Task.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Task.d.ts","sourceRoot":"","sources":["../../../src/documents/dashboard/Task.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAGrE;;GAEG;AACH,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwF9B,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -1,63 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DashboardTaskFilterSettingsSchema } from '../../embedded-types/dashboard/task/FilterSettings.js';
|
|
3
|
+
import { ParentRecurringTaskInfoSchema, RecurrenceInfoSchema } from '../../embedded-types/dashboard/task/RecurrenceInfo.js';
|
|
4
|
+
import { DashboardTaskSortSettingsSchema } from '../../embedded-types/dashboard/task/SortSettings.js';
|
|
5
|
+
import { RequiredUserIdSchema } from '../../schemas/required-refs/RequiredUserId.js';
|
|
6
|
+
import { BaseDocumentWithTypeSchema } from '../BaseDocument.js';
|
|
6
7
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @param task - The {@link DashboardTask} object to validate.
|
|
10
|
-
* @returns An object containing the updated document and any validation errors.
|
|
8
|
+
* The docType value for DashboardTask documents.
|
|
11
9
|
*/
|
|
12
|
-
export const
|
|
13
|
-
const errors = [];
|
|
14
|
-
const validate = new Validate(task, errors);
|
|
15
|
-
const exampleTask = new DashboardTask(DocumentService.generateID());
|
|
16
|
-
validate.string('title', exampleTask.title);
|
|
17
|
-
validate.boolean('completed', exampleTask.completed);
|
|
18
|
-
validate.optionalString('description');
|
|
19
|
-
validate.array('sharedWith', exampleTask.sharedWith);
|
|
20
|
-
validate.optionalObject('recurrenceInfo');
|
|
21
|
-
validate.object('tags', {});
|
|
22
|
-
validate.string('category', exampleTask.category);
|
|
23
|
-
validate.object('createdDate', exampleTask.createdDate);
|
|
24
|
-
validate.object('lastUpdatedDate', exampleTask.lastUpdatedDate);
|
|
25
|
-
validate.optionalObject('startDate');
|
|
26
|
-
validate.optionalObject('dueDate');
|
|
27
|
-
validate.optionalObject('parentRecurringTaskInfo');
|
|
28
|
-
validate.object('filterSettings', {});
|
|
29
|
-
validate.object('sortSettings', {});
|
|
30
|
-
validateRecurrenceInfo(task, errors);
|
|
31
|
-
return { updatedDoc: task, errors };
|
|
32
|
-
};
|
|
10
|
+
export const DashboardTask_docType = 'task';
|
|
33
11
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* What would you expect a task manager to do in the case that you have a task
|
|
37
|
-
* with a bunch of subtasks, and you share that single task with another person?
|
|
38
|
-
*
|
|
39
|
-
* - Should the subtasks be automatically shared as well no matter what? (Would make behavior simpler for the user)
|
|
40
|
-
* - Should there instead be an option to share the subtasks automatically?
|
|
41
|
-
* - In the case that the other user adds a subtask to the original task you shared, would you expect to see that subtask?
|
|
42
|
-
* - 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?
|
|
43
|
-
*
|
|
44
|
-
* Because of the complexity for the user in not automatically sharing subtasks,
|
|
45
|
-
* it seems better to always automatically share subtasks. In a theoretical sense,
|
|
46
|
-
* sharing a task with someone seems to imply the shared ownership of completing
|
|
47
|
-
* the overall task, including all the subtasks.
|
|
48
|
-
*
|
|
49
|
-
* Recurring Tasks:
|
|
50
|
-
*
|
|
51
|
-
* - 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.
|
|
52
|
-
* - 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.
|
|
12
|
+
* The schema for {@link DashboardTask} documents.
|
|
53
13
|
*/
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
* The owner of this task.
|
|
59
|
-
*/
|
|
60
|
-
userId;
|
|
14
|
+
export const DashboardTaskSchema = z.object({
|
|
15
|
+
...BaseDocumentWithTypeSchema.shape,
|
|
16
|
+
...RequiredUserIdSchema.shape,
|
|
17
|
+
docType: z.literal(DashboardTask_docType).default(DashboardTask_docType),
|
|
61
18
|
/**
|
|
62
19
|
* What happens when:
|
|
63
20
|
*
|
|
@@ -70,73 +27,74 @@ export default class DashboardTask extends BaseDocumentWithType {
|
|
|
70
27
|
* collaborator back it will return to normal. But the frontend needs to
|
|
71
28
|
* double check for this when displaying things.
|
|
72
29
|
*/
|
|
73
|
-
sharedWith
|
|
30
|
+
sharedWith: z.array(z.uuidv7().transform((val) => val)).default([]),
|
|
74
31
|
/**
|
|
75
32
|
* The user ID that this task is assigned to.
|
|
76
33
|
*/
|
|
77
|
-
assignedTo
|
|
34
|
+
assignedTo: z
|
|
35
|
+
.uuidv7()
|
|
36
|
+
.transform((val) => val)
|
|
37
|
+
.nullish(),
|
|
78
38
|
/**
|
|
79
39
|
* The recurrence info for this task if there is any.
|
|
80
40
|
*/
|
|
81
|
-
recurrenceInfo
|
|
41
|
+
recurrenceInfo: RecurrenceInfoSchema.nullish(),
|
|
82
42
|
/**
|
|
83
43
|
* The recurring task info for the parent recurring task if there is one.
|
|
84
44
|
*
|
|
85
45
|
* If this is set, then the current tasks's recurrence info should be the
|
|
86
46
|
* same as the parent recurring task.
|
|
87
47
|
*/
|
|
88
|
-
parentRecurringTaskInfo
|
|
48
|
+
parentRecurringTaskInfo: ParentRecurringTaskInfoSchema.nullish(),
|
|
89
49
|
/**
|
|
90
50
|
* The title of the task.
|
|
91
51
|
*/
|
|
92
|
-
title
|
|
93
|
-
completed
|
|
52
|
+
title: z.string().default(''),
|
|
53
|
+
completed: z.boolean().default(false),
|
|
94
54
|
/**
|
|
95
55
|
* The ID of the parent task if there is one.
|
|
96
56
|
*/
|
|
97
|
-
parentTaskId
|
|
57
|
+
parentTaskId: z
|
|
58
|
+
.uuidv7()
|
|
59
|
+
.transform((val) => val)
|
|
60
|
+
.nullish(),
|
|
98
61
|
/**
|
|
99
62
|
* The description of the task. This is purposefully optional in case the
|
|
100
63
|
* user wants to just use the title. This also helps the frontend
|
|
101
64
|
* differentiate between a task that has no description and a task that has
|
|
102
65
|
* an empty description.
|
|
103
66
|
*/
|
|
104
|
-
description
|
|
67
|
+
description: z.string().nullish(),
|
|
105
68
|
/**
|
|
106
69
|
* The date this task was created.
|
|
107
70
|
*/
|
|
108
|
-
createdDate
|
|
71
|
+
createdDate: z.date().default(() => new Date()),
|
|
109
72
|
/**
|
|
110
73
|
* The date this task was last updated.
|
|
111
74
|
*/
|
|
112
|
-
lastUpdatedDate
|
|
113
|
-
startDate
|
|
114
|
-
dueDate
|
|
75
|
+
lastUpdatedDate: z.date().default(() => new Date()),
|
|
76
|
+
startDate: z.date().nullish(),
|
|
77
|
+
dueDate: z.date().nullish(),
|
|
115
78
|
/**
|
|
116
79
|
* User-assigned tags for this task.
|
|
117
80
|
*/
|
|
118
|
-
tags
|
|
81
|
+
tags: z
|
|
82
|
+
.record(z.uuidv7().transform((id) => id), z.array(z.string()).nullish())
|
|
83
|
+
.default({}),
|
|
119
84
|
/**
|
|
120
85
|
* System-assigned category for this task. This should be used to determine
|
|
121
86
|
* where this task should be displayed.
|
|
122
87
|
*/
|
|
123
|
-
category
|
|
88
|
+
category: z.string().default('default'),
|
|
124
89
|
/**
|
|
125
90
|
* The filter settings for subtasks of this task specifically, keyed on
|
|
126
91
|
* each user.
|
|
127
92
|
*/
|
|
128
|
-
filterSettings
|
|
93
|
+
filterSettings: DashboardTaskFilterSettingsSchema.default({}),
|
|
129
94
|
/**
|
|
130
95
|
* The sort settings for subtasks of this task specifically, keyed on
|
|
131
96
|
* each user.
|
|
132
97
|
*/
|
|
133
|
-
sortSettings
|
|
134
|
-
|
|
135
|
-
super();
|
|
136
|
-
this.userId = ownerId;
|
|
137
|
-
this.tags = {
|
|
138
|
-
[ownerId]: []
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
}
|
|
98
|
+
sortSettings: DashboardTaskSortSettingsSchema.default({})
|
|
99
|
+
});
|
|
142
100
|
//# sourceMappingURL=Task.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Task.js","sourceRoot":"","sources":["../../../src/documents/dashboard/Task.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Task.js","sourceRoot":"","sources":["../../../src/documents/dashboard/Task.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iCAAiC,EAAE,MAAM,uDAAuD,CAAC;AAC1G,OAAO,EACL,6BAA6B,EAC7B,oBAAoB,EACrB,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAErF,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,GAAG,0BAA0B,CAAC,KAAK;IACnC,GAAG,oBAAoB,CAAC,KAAK;IAC7B,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC;IACxE;;;;;;;;;;;OAWG;IACH,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3E;;OAEG;IACH,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAW,CAAC;SAC/B,OAAO,EAAE;IACZ;;OAEG;IACH,cAAc,EAAE,oBAAoB,CAAC,OAAO,EAAE;IAC9C;;;;;OAKG;IACH,uBAAuB,EAAE,6BAA6B,CAAC,OAAO,EAAE;IAChE;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC7B,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACrC;;OAEG;IACH,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAW,CAAC;SAC/B,OAAO,EAAE;IACZ;;;;;OAKG;IACH,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IACjC;;OAEG;IACH,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;IAC/C;;OAEG;IACH,eAAe,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;IACnD,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE;IAC7B,OAAO,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE;IAC3B;;OAEG;IACH,IAAI,EAAE,CAAC;SACJ,MAAM,CACL,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAU,CAAC,EACxC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAC9B;SACA,OAAO,CAAC,EAAE,CAAC;IACd;;;OAGG;IACH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;IACvC;;;OAGG;IACH,cAAc,EAAE,iCAAiC,CAAC,OAAO,CAAC,EAAE,CAAC;IAC7D;;;OAGG;IACH,YAAY,EAAE,+BAA+B,CAAC,OAAO,CAAC,EAAE,CAAC;CAC1D,CAAC,CAAC"}
|