@aneuhold/core-ts-db-lib 1.0.17 → 1.0.19
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/User.d.ts +8 -0
- package/lib/documents/common/User.d.ts.map +1 -1
- package/lib/documents/dashboard/Task.d.ts +16 -0
- package/lib/documents/dashboard/Task.d.ts.map +1 -1
- package/lib/documents/dashboard/Task.js +17 -0
- package/lib/documents/dashboard/UserConfig.d.ts +5 -0
- package/lib/documents/dashboard/UserConfig.d.ts.map +1 -1
- package/lib/documents/dashboard/UserConfig.js +6 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { ObjectId } from 'bson';
|
|
2
2
|
import BaseDocument from '../BaseDocument';
|
|
3
3
|
import { DocumentValidator } from '../../schemas/validators/DocumentValidator';
|
|
4
|
+
/**
|
|
5
|
+
* A User CTO which can be used to reference a User with only the necessary
|
|
6
|
+
* information.
|
|
7
|
+
*/
|
|
8
|
+
export type UserCTO = {
|
|
9
|
+
_id: ObjectId;
|
|
10
|
+
userName: string;
|
|
11
|
+
};
|
|
4
12
|
export declare const validateUser: DocumentValidator<User>;
|
|
5
13
|
/**
|
|
6
14
|
* A standard user of all personal projects. This should be linked to from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../../src/documents/common/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAG/E,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,IAAI,CAkBhD,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IAC5C,GAAG,WAAkB;IAErB,QAAQ,EAAE,MAAM,CAAC;IAEjB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,IAAI,EAAE;QACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAM;IAEP,aAAa;;MAEX;IAEF;;OAEG;gBACS,QAAQ,EAAE,MAAM;CAI7B"}
|
|
1
|
+
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../../src/documents/common/User.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAG/E;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,QAAQ,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,iBAAiB,CAAC,IAAI,CAkBhD,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IAC5C,GAAG,WAAkB;IAErB,QAAQ,EAAE,MAAM,CAAC;IAEjB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,IAAI,EAAE;QACJ,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAM;IAEP,aAAa;;MAEX;IAEF;;OAEG;gBACS,QAAQ,EAAE,MAAM;CAI7B"}
|
|
@@ -7,6 +7,22 @@ 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
|
+
*/
|
|
10
26
|
export default class DashboardTask extends BaseDocumentWithType implements RequiredUserId {
|
|
11
27
|
static docType: string;
|
|
12
28
|
docType: 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;;;;;;;;;;;;;;;GAeG;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;;;OAGG;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,22 @@ 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
|
+
*/
|
|
66
83
|
class DashboardTask extends BaseDocumentWithType_1.default {
|
|
67
84
|
static docType = 'task';
|
|
68
85
|
docType = DashboardTask.docType;
|
|
@@ -10,6 +10,11 @@ export default class DashboardUserConfig extends BaseDocumentWithType implements
|
|
|
10
10
|
* The owner of this config.
|
|
11
11
|
*/
|
|
12
12
|
userId: ObjectId;
|
|
13
|
+
/**
|
|
14
|
+
* The different users that the owner of this config is collaborating with
|
|
15
|
+
* on the dashboard.
|
|
16
|
+
*/
|
|
17
|
+
collaborators: ObjectId[];
|
|
13
18
|
/**
|
|
14
19
|
* Whether or not to enable dev mode for the user.
|
|
15
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserConfig.d.ts","sourceRoot":"","sources":["../../../src/documents/dashboard/UserConfig.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,2BAA2B,EAAE,iBAAiB,CACzD,mBAAmB,
|
|
1
|
+
{"version":3,"file":"UserConfig.d.ts","sourceRoot":"","sources":["../../../src/documents/dashboard/UserConfig.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,2BAA2B,EAAE,iBAAiB,CACzD,mBAAmB,CAUpB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,mBACnB,SAAQ,oBACR,YAAW,cAAc;IAEzB,MAAM,CAAC,OAAO,SAAgB;IAE9B,OAAO,SAA+B;IAEtC;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC;IAEjB;;;OAGG;IACH,aAAa,EAAE,QAAQ,EAAE,CAAM;IAE/B;;OAEG;IACH,aAAa,UAAS;gBAEV,OAAO,EAAE,QAAQ;CAI9B"}
|
|
@@ -12,6 +12,7 @@ const validateDashboardUserConfig = (config) => {
|
|
|
12
12
|
const validate = new ValidateUtil_1.default(config, errors);
|
|
13
13
|
const exampleConfig = new DashboardUserConfig(new bson_1.ObjectId());
|
|
14
14
|
validate.boolean('enableDevMode', exampleConfig.enableDevMode);
|
|
15
|
+
validate.array('collaborators', exampleConfig.collaborators);
|
|
15
16
|
return { updatedDoc: config, errors };
|
|
16
17
|
};
|
|
17
18
|
exports.validateDashboardUserConfig = validateDashboardUserConfig;
|
|
@@ -22,6 +23,11 @@ class DashboardUserConfig extends BaseDocumentWithType_1.default {
|
|
|
22
23
|
* The owner of this config.
|
|
23
24
|
*/
|
|
24
25
|
userId;
|
|
26
|
+
/**
|
|
27
|
+
* The different users that the owner of this config is collaborating with
|
|
28
|
+
* on the dashboard.
|
|
29
|
+
*/
|
|
30
|
+
collaborators = [];
|
|
25
31
|
/**
|
|
26
32
|
* Whether or not to enable dev mode for the user.
|
|
27
33
|
*/
|
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import BaseDocument from './documents/BaseDocument';
|
|
2
2
|
import BaseDocumentWithType from './documents/BaseDocumentWithType';
|
|
3
3
|
import ApiKey, { validateApiKey } from './documents/common/ApiKey';
|
|
4
|
-
import User, { validateUser } from './documents/common/User';
|
|
4
|
+
import User, { UserCTO, validateUser } from './documents/common/User';
|
|
5
5
|
import DashboardTask, { getDashboardTaskChildrenIds, validateDashboardTask } from './documents/dashboard/Task';
|
|
6
6
|
import DashboardUserConfig, { validateDashboardUserConfig } from './documents/dashboard/UserConfig';
|
|
7
7
|
import RequiredUserId from './schemas/required-refs/RequiredUserId';
|
|
8
8
|
import { DocumentValidator } from './schemas/validators/DocumentValidator';
|
|
9
9
|
export { User, validateUser, ApiKey, validateApiKey, DashboardUserConfig, validateDashboardUserConfig, DashboardTask, validateDashboardTask, getDashboardTaskChildrenIds, BaseDocument, BaseDocumentWithType, RequiredUserId };
|
|
10
|
-
export type { DocumentValidator };
|
|
10
|
+
export type { DocumentValidator, UserCTO };
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,MAAM,EAAE,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,MAAM,EAAE,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,IAAI,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,aAAa,EAAE,EACpB,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,mBAAmB,EAAE,EAC1B,2BAA2B,EAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAG3E,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,2BAA2B,EAC3B,aAAa,EACb,qBAAqB,EACrB,2BAA2B,EAC3B,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACf,CAAC;AAGF,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC"}
|