@timothyw/pat-common 1.0.106 → 1.0.107

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.
Files changed (47) hide show
  1. package/dist/types/api/index.d.ts +1 -1
  2. package/dist/types/api/index.js +1 -1
  3. package/dist/types/api/lists/complete-list-item-types.d.ts +14 -0
  4. package/dist/types/api/lists/complete-list-item-types.js +7 -0
  5. package/dist/types/api/lists/create-list-item-types.d.ts +22 -0
  6. package/dist/types/api/lists/create-list-item-types.js +10 -0
  7. package/dist/types/api/lists/create-list-types.d.ts +17 -0
  8. package/dist/types/api/lists/create-list-types.js +9 -0
  9. package/dist/types/api/lists/get-list-item-types.d.ts +5 -0
  10. package/dist/types/api/lists/get-list-item-types.js +2 -0
  11. package/dist/types/api/lists/get-lists-types.d.ts +5 -0
  12. package/dist/types/api/lists/get-lists-types.js +2 -0
  13. package/dist/types/api/lists/index.d.ts +7 -0
  14. package/dist/types/api/lists/index.js +23 -0
  15. package/dist/types/api/lists/update-list-item-types.d.ts +23 -0
  16. package/dist/types/api/lists/update-list-item-types.js +11 -0
  17. package/dist/types/api/lists/update-list-types.d.ts +17 -0
  18. package/dist/types/api/lists/update-list-types.js +9 -0
  19. package/dist/types/id-types.d.ts +8 -8
  20. package/dist/types/id-types.js +3 -3
  21. package/dist/types/models/index.d.ts +1 -1
  22. package/dist/types/models/index.js +1 -1
  23. package/dist/types/models/list-data.d.ts +23 -0
  24. package/dist/types/models/list-data.js +8 -0
  25. package/dist/utils/serializing-utils.d.ts +5 -5
  26. package/package.json +1 -1
  27. package/src/types/api/index.ts +1 -1
  28. package/src/types/api/lists/complete-list-item-types.ts +13 -0
  29. package/src/types/api/lists/create-list-item-types.ts +16 -0
  30. package/src/types/api/lists/create-list-types.ts +14 -0
  31. package/src/types/api/lists/get-list-item-types.ts +6 -0
  32. package/src/types/api/lists/get-lists-types.ts +6 -0
  33. package/src/types/api/lists/index.ts +7 -0
  34. package/src/types/api/lists/update-list-item-types.ts +17 -0
  35. package/src/types/api/lists/update-list-types.ts +14 -0
  36. package/src/types/id-types.ts +6 -6
  37. package/src/types/models/index.ts +1 -1
  38. package/src/types/models/{task-data.ts → list-data.ts} +8 -8
  39. package/src/utils/serializing-utils.ts +7 -7
  40. package/src/types/api/tasks/complete-task-types.ts +0 -13
  41. package/src/types/api/tasks/create-task-list-types.ts +0 -14
  42. package/src/types/api/tasks/create-task-types.ts +0 -16
  43. package/src/types/api/tasks/get-task-lists-types.ts +0 -6
  44. package/src/types/api/tasks/get-tasks-types.ts +0 -6
  45. package/src/types/api/tasks/index.ts +0 -7
  46. package/src/types/api/tasks/update-task-list-types.ts +0 -14
  47. package/src/types/api/tasks/update-task-types.ts +0 -17
@@ -5,5 +5,5 @@ export * from './items';
5
5
  export * from './misc';
6
6
  export * from './notifications';
7
7
  export * from './people';
8
- export * from './tasks';
8
+ export * from './lists';
9
9
  export * from './thoughts';
@@ -21,5 +21,5 @@ __exportStar(require("./items"), exports);
21
21
  __exportStar(require("./misc"), exports);
22
22
  __exportStar(require("./notifications"), exports);
23
23
  __exportStar(require("./people"), exports);
24
- __exportStar(require("./tasks"), exports);
24
+ __exportStar(require("./lists"), exports);
25
25
  __exportStar(require("./thoughts"), exports);
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { Serialized } from "../../../utils";
3
+ import { ListItemData } from "../../models";
4
+ export declare const completeListItemRequestSchema: z.ZodObject<{
5
+ completed: z.ZodBoolean;
6
+ }, "strip", z.ZodTypeAny, {
7
+ completed: boolean;
8
+ }, {
9
+ completed: boolean;
10
+ }>;
11
+ export type CompleteListItemRequest = z.infer<typeof completeListItemRequestSchema>;
12
+ export interface CompleteListItemResponse {
13
+ listItem: Serialized<ListItemData>;
14
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.completeListItemRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.completeListItemRequestSchema = zod_1.z.object({
6
+ completed: zod_1.z.boolean()
7
+ });
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import { Serialized } from "../../../utils";
3
+ import { ListItemData } from "../../models";
4
+ export declare const createListItemRequestSchema: z.ZodObject<{
5
+ name: z.ZodString;
6
+ notes: z.ZodOptional<z.ZodString>;
7
+ listId: z.ZodEffects<z.ZodString, import("../../id-types").ListId, string>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ name: string;
10
+ listId: string & {
11
+ readonly __brand: "ListId";
12
+ };
13
+ notes?: string | undefined;
14
+ }, {
15
+ name: string;
16
+ listId: string;
17
+ notes?: string | undefined;
18
+ }>;
19
+ export type CreateListItemRequest = z.infer<typeof createListItemRequestSchema>;
20
+ export interface CreateListItemResponse {
21
+ listItem: Serialized<ListItemData>;
22
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createListItemRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const id_types_1 = require("../../id-types");
6
+ exports.createListItemRequestSchema = zod_1.z.object({
7
+ name: zod_1.z.string().min(1),
8
+ notes: zod_1.z.string().optional(),
9
+ listId: id_types_1.listIdSchema
10
+ });
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { Serialized } from "../../../utils";
3
+ import { ListData, ListType } from "../../models";
4
+ export declare const createListRequestSchema: z.ZodObject<{
5
+ name: z.ZodString;
6
+ type: z.ZodNativeEnum<typeof ListType>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ type: ListType;
9
+ name: string;
10
+ }, {
11
+ type: ListType;
12
+ name: string;
13
+ }>;
14
+ export type CreateListRequest = z.infer<typeof createListRequestSchema>;
15
+ export interface CreateListResponse {
16
+ list: Serialized<ListData>;
17
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createListRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ exports.createListRequestSchema = zod_1.z.object({
7
+ name: zod_1.z.string().min(1),
8
+ type: zod_1.z.nativeEnum(models_1.ListType)
9
+ });
@@ -0,0 +1,5 @@
1
+ import { Serialized } from "../../../utils";
2
+ import { ListItemData } from "../../models";
3
+ export interface GetListItemResponse {
4
+ listItems: Serialized<ListItemData>[];
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { Serialized } from "../../../utils";
2
+ import { ListData } from "../../models";
3
+ export interface GetListsResponse {
4
+ lists: Serialized<ListData>[];
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export * from './complete-list-item-types';
2
+ export * from './create-list-item-types';
3
+ export * from './get-list-item-types';
4
+ export * from './update-list-item-types';
5
+ export * from './create-list-types';
6
+ export * from './update-list-types';
7
+ export * from './get-lists-types';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./complete-list-item-types"), exports);
18
+ __exportStar(require("./create-list-item-types"), exports);
19
+ __exportStar(require("./get-list-item-types"), exports);
20
+ __exportStar(require("./update-list-item-types"), exports);
21
+ __exportStar(require("./create-list-types"), exports);
22
+ __exportStar(require("./update-list-types"), exports);
23
+ __exportStar(require("./get-lists-types"), exports);
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { Serialized } from "../../../utils";
3
+ import { ListItemData } from "../../models";
4
+ export declare const updateListItemRequestSchema: z.ZodObject<{
5
+ name: z.ZodOptional<z.ZodString>;
6
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7
+ completed: z.ZodOptional<z.ZodBoolean>;
8
+ listId: z.ZodOptional<z.ZodEffects<z.ZodString, import("../../id-types").ListId, string>>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ completed?: boolean | undefined;
11
+ name?: string | undefined;
12
+ notes?: string | null | undefined;
13
+ listId?: import("../../id-types").ListId | undefined;
14
+ }, {
15
+ completed?: boolean | undefined;
16
+ name?: string | undefined;
17
+ notes?: string | null | undefined;
18
+ listId?: string | undefined;
19
+ }>;
20
+ export type UpdateListItemRequest = z.infer<typeof updateListItemRequestSchema>;
21
+ export interface UpdateListItemResponse {
22
+ listItem: Serialized<ListItemData>;
23
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateListItemRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const id_types_1 = require("../../id-types");
6
+ exports.updateListItemRequestSchema = zod_1.z.object({
7
+ name: zod_1.z.string().min(1).optional(),
8
+ notes: zod_1.z.string().nullish(),
9
+ completed: zod_1.z.boolean().optional(),
10
+ listId: id_types_1.listIdSchema.optional()
11
+ });
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { Serialized } from "../../../utils";
3
+ import { ListData, ListType } from "../../models";
4
+ export declare const updateListRequestSchema: z.ZodObject<{
5
+ name: z.ZodOptional<z.ZodString>;
6
+ type: z.ZodOptional<z.ZodNativeEnum<typeof ListType>>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ type?: ListType | undefined;
9
+ name?: string | undefined;
10
+ }, {
11
+ type?: ListType | undefined;
12
+ name?: string | undefined;
13
+ }>;
14
+ export type UpdateListRequest = z.infer<typeof updateListRequestSchema>;
15
+ export interface UpdateListResponse {
16
+ list: Serialized<ListData>;
17
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateListRequestSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const models_1 = require("../../models");
6
+ exports.updateListRequestSchema = zod_1.z.object({
7
+ name: zod_1.z.string().min(1).optional(),
8
+ type: zod_1.z.nativeEnum(models_1.ListType).optional()
9
+ });
@@ -23,19 +23,19 @@ export declare const thoughtIdSchema: z.ZodEffects<z.ZodString, ThoughtId, strin
23
23
  export type ThoughtId = string & {
24
24
  readonly __brand: "ThoughtId";
25
25
  };
26
- export declare const taskListIdSchema: z.ZodEffects<z.ZodString, TaskListId, string>;
27
- export type TaskListId = string & {
28
- readonly __brand: "TaskListId";
26
+ export declare const listIdSchema: z.ZodEffects<z.ZodString, ListId, string>;
27
+ export type ListId = string & {
28
+ readonly __brand: "ListId";
29
29
  };
30
- export declare const taskIdSchema: z.ZodEffects<z.ZodString, TaskId, string>;
31
- export type TaskId = string & {
32
- readonly __brand: "TaskId";
30
+ export declare const listItemIdSchema: z.ZodEffects<z.ZodString, ListItemId, string>;
31
+ export type ListItemId = string & {
32
+ readonly __brand: "ListItemId";
33
33
  };
34
- export declare const habitIdSchema: z.ZodEffects<z.ZodString, TaskListId, string>;
34
+ export declare const habitIdSchema: z.ZodEffects<z.ZodString, ListId, string>;
35
35
  export type HabitId = string & {
36
36
  readonly __brand: "HabitId";
37
37
  };
38
- export declare const habitEntryIdSchema: z.ZodEffects<z.ZodString, TaskListId, string>;
38
+ export declare const habitEntryIdSchema: z.ZodEffects<z.ZodString, ListId, string>;
39
39
  export type HabitEntryId = string & {
40
40
  readonly __brand: "HabitEntryId";
41
41
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.notificationInstanceIdSchema = exports.notificationTemplateIdSchema = exports.habitEntryIdSchema = exports.habitIdSchema = exports.taskIdSchema = exports.taskListIdSchema = exports.thoughtIdSchema = exports.personNoteIdSchema = exports.personIdSchema = exports.itemIdSchema = exports.authIdSchema = exports.userIdSchema = void 0;
3
+ exports.notificationInstanceIdSchema = exports.notificationTemplateIdSchema = exports.habitEntryIdSchema = exports.habitIdSchema = exports.listItemIdSchema = exports.listIdSchema = exports.thoughtIdSchema = exports.personNoteIdSchema = exports.personIdSchema = exports.itemIdSchema = exports.authIdSchema = exports.userIdSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.userIdSchema = zod_1.z.string().transform((val) => val);
6
6
  exports.authIdSchema = zod_1.z.string().transform((val) => val);
@@ -8,8 +8,8 @@ exports.itemIdSchema = zod_1.z.string().transform((val) => val);
8
8
  exports.personIdSchema = zod_1.z.string().transform((val) => val);
9
9
  exports.personNoteIdSchema = zod_1.z.string().transform((val) => val);
10
10
  exports.thoughtIdSchema = zod_1.z.string().transform((val) => val);
11
- exports.taskListIdSchema = zod_1.z.string().transform((val) => val);
12
- exports.taskIdSchema = zod_1.z.string().transform((val) => val);
11
+ exports.listIdSchema = zod_1.z.string().transform((val) => val);
12
+ exports.listItemIdSchema = zod_1.z.string().transform((val) => val);
13
13
  exports.habitIdSchema = zod_1.z.string().transform((val) => val);
14
14
  exports.habitEntryIdSchema = zod_1.z.string().transform((val) => val);
15
15
  exports.notificationTemplateIdSchema = zod_1.z.string().transform((val) => val);
@@ -5,6 +5,6 @@ export * from './notification-template-data';
5
5
  export * from './notifiable';
6
6
  export * from './person-data';
7
7
  export * from './program-config';
8
- export * from './task-data';
8
+ export * from './list-data';
9
9
  export * from './thought-data';
10
10
  export * from './user-data';
@@ -21,6 +21,6 @@ __exportStar(require("./notification-template-data"), exports);
21
21
  __exportStar(require("./notifiable"), exports);
22
22
  __exportStar(require("./person-data"), exports);
23
23
  __exportStar(require("./program-config"), exports);
24
- __exportStar(require("./task-data"), exports);
24
+ __exportStar(require("./list-data"), exports);
25
25
  __exportStar(require("./thought-data"), exports);
26
26
  __exportStar(require("./user-data"), exports);
@@ -0,0 +1,23 @@
1
+ import { ListItemId, ListId, UserId } from "../id-types";
2
+ export declare enum ListType {
3
+ TASKS = "tasks",
4
+ NOTES = "notes"
5
+ }
6
+ export interface ListItemData {
7
+ _id: ListItemId;
8
+ userId: UserId;
9
+ createdAt: Date;
10
+ updatedAt: Date;
11
+ name: string;
12
+ notes?: string;
13
+ completed: boolean;
14
+ taskListId: ListId;
15
+ }
16
+ export interface ListData {
17
+ _id: ListId;
18
+ userId: UserId;
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ name: string;
22
+ type: ListType;
23
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListType = void 0;
4
+ var ListType;
5
+ (function (ListType) {
6
+ ListType["TASKS"] = "tasks";
7
+ ListType["NOTES"] = "notes";
8
+ })(ListType || (exports.ListType = ListType = {}));
@@ -1,4 +1,4 @@
1
- import { Habit, HabitData, HabitEntry, HabitEntryData, ItemData, Person, PersonData, PersonNoteData, NotificationTemplateData, TaskData, TaskListData, ThoughtData, UserData } from "../types";
1
+ import { Habit, HabitData, HabitEntry, HabitEntryData, ItemData, Person, PersonData, PersonNoteData, NotificationTemplateData, ListItemData, ListData, ThoughtData, UserData } from "../types";
2
2
  export type Serialized<T> = T extends Date ? string : T extends Date | undefined ? string | undefined : T extends Date | null ? string | null : T extends (infer U)[] ? Serialized<U>[] : T extends object ? {
3
3
  [K in keyof T]: Serialized<T[K]>;
4
4
  } : T;
@@ -21,10 +21,10 @@ export declare class Serializer {
21
21
  static deserializePersonData(data: Serialized<PersonData>): PersonData;
22
22
  static serializePersonNoteData(data: PersonNoteData): Serialized<PersonNoteData>;
23
23
  static deserializePersonNoteData(data: Serialized<PersonNoteData>): PersonNoteData;
24
- static serializeTaskData(data: TaskData): Serialized<TaskData>;
25
- static deserializeTaskData(data: Serialized<TaskData>): TaskData;
26
- static serializeTaskListData(data: TaskListData): Serialized<TaskListData>;
27
- static deserializeTaskListData(data: Serialized<TaskListData>): TaskListData;
24
+ static serializeTaskData(data: ListItemData): Serialized<ListItemData>;
25
+ static deserializeTaskData(data: Serialized<ListItemData>): ListItemData;
26
+ static serializeTaskListData(data: ListData): Serialized<ListData>;
27
+ static deserializeTaskListData(data: Serialized<ListData>): ListData;
28
28
  static serializeThoughtData(data: ThoughtData): Serialized<ThoughtData>;
29
29
  static deserializeThoughtData(data: Serialized<ThoughtData>): ThoughtData;
30
30
  static serializeUserData(data: UserData): Serialized<UserData>;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@timothyw/pat-common",
3
3
  "description": "",
4
4
  "author": "Timothy Washburn",
5
- "version": "1.0.106",
5
+ "version": "1.0.107",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -5,5 +5,5 @@ export * from './items'
5
5
  export * from './misc'
6
6
  export * from './notifications'
7
7
  export * from './people'
8
- export * from './tasks'
8
+ export * from './lists'
9
9
  export * from './thoughts'
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { Serialized } from "../../../utils";
3
+ import { ListItemData } from "../../models";
4
+
5
+ export const completeListItemRequestSchema = z.object({
6
+ completed: z.boolean()
7
+ });
8
+
9
+ export type CompleteListItemRequest = z.infer<typeof completeListItemRequestSchema>;
10
+
11
+ export interface CompleteListItemResponse {
12
+ listItem: Serialized<ListItemData>;
13
+ }
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { listIdSchema } from '../../id-types';
3
+ import { Serialized } from "../../../utils";
4
+ import { ListItemData } from "../../models";
5
+
6
+ export const createListItemRequestSchema = z.object({
7
+ name: z.string().min(1),
8
+ notes: z.string().optional(),
9
+ listId: listIdSchema
10
+ });
11
+
12
+ export type CreateListItemRequest = z.infer<typeof createListItemRequestSchema>;
13
+
14
+ export interface CreateListItemResponse {
15
+ listItem: Serialized<ListItemData>;
16
+ }
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { Serialized } from "../../../utils";
3
+ import { ListData, ListType } from "../../models";
4
+
5
+ export const createListRequestSchema = z.object({
6
+ name: z.string().min(1),
7
+ type: z.nativeEnum(ListType)
8
+ });
9
+
10
+ export type CreateListRequest = z.infer<typeof createListRequestSchema>;
11
+
12
+ export interface CreateListResponse {
13
+ list: Serialized<ListData>;
14
+ }
@@ -0,0 +1,6 @@
1
+ import { Serialized } from "../../../utils";
2
+ import { ListItemData } from "../../models";
3
+
4
+ export interface GetListItemResponse {
5
+ listItems: Serialized<ListItemData>[];
6
+ }
@@ -0,0 +1,6 @@
1
+ import { Serialized } from "../../../utils";
2
+ import { ListData } from "../../models";
3
+
4
+ export interface GetListsResponse {
5
+ lists: Serialized<ListData>[];
6
+ }
@@ -0,0 +1,7 @@
1
+ export * from './complete-list-item-types';
2
+ export * from './create-list-item-types';
3
+ export * from './get-list-item-types';
4
+ export * from './update-list-item-types';
5
+ export * from './create-list-types';
6
+ export * from './update-list-types';
7
+ export * from './get-lists-types';
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { listIdSchema } from '../../id-types';
3
+ import { Serialized } from "../../../utils";
4
+ import { ListItemData } from "../../models";
5
+
6
+ export const updateListItemRequestSchema = z.object({
7
+ name: z.string().min(1).optional(),
8
+ notes: z.string().nullish(),
9
+ completed: z.boolean().optional(),
10
+ listId: listIdSchema.optional()
11
+ });
12
+
13
+ export type UpdateListItemRequest = z.infer<typeof updateListItemRequestSchema>;
14
+
15
+ export interface UpdateListItemResponse {
16
+ listItem: Serialized<ListItemData>;
17
+ }
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import { Serialized } from "../../../utils";
3
+ import { ListData, ListType } from "../../models";
4
+
5
+ export const updateListRequestSchema = z.object({
6
+ name: z.string().min(1).optional(),
7
+ type: z.nativeEnum(ListType).optional()
8
+ });
9
+
10
+ export type UpdateListRequest = z.infer<typeof updateListRequestSchema>;
11
+
12
+ export interface UpdateListResponse {
13
+ list: Serialized<ListData>;
14
+ }
@@ -18,16 +18,16 @@ export type PersonNoteId = string & { readonly __brand: "PersonNoteId" };
18
18
  export const thoughtIdSchema = z.string().transform((val): ThoughtId => val as ThoughtId);
19
19
  export type ThoughtId = string & { readonly __brand: "ThoughtId" };
20
20
 
21
- export const taskListIdSchema = z.string().transform((val): TaskListId => val as TaskListId);
22
- export type TaskListId = string & { readonly __brand: "TaskListId" };
21
+ export const listIdSchema = z.string().transform((val): ListId => val as ListId);
22
+ export type ListId = string & { readonly __brand: "ListId" };
23
23
 
24
- export const taskIdSchema = z.string().transform((val): TaskId => val as TaskId);
25
- export type TaskId = string & { readonly __brand: "TaskId" };
24
+ export const listItemIdSchema = z.string().transform((val): ListItemId => val as ListItemId);
25
+ export type ListItemId = string & { readonly __brand: "ListItemId" };
26
26
 
27
- export const habitIdSchema = z.string().transform((val): TaskListId => val as TaskListId);
27
+ export const habitIdSchema = z.string().transform((val): ListId => val as ListId);
28
28
  export type HabitId = string & { readonly __brand: "HabitId" };
29
29
 
30
- export const habitEntryIdSchema = z.string().transform((val): TaskListId => val as TaskListId);
30
+ export const habitEntryIdSchema = z.string().transform((val): ListId => val as ListId);
31
31
  export type HabitEntryId = string & { readonly __brand: "HabitEntryId" };
32
32
 
33
33
  export const notificationTemplateIdSchema = z.string().transform((val): NotificationTemplateId => val as NotificationTemplateId);
@@ -5,6 +5,6 @@ export * from './notification-template-data';
5
5
  export * from './notifiable';
6
6
  export * from './person-data';
7
7
  export * from './program-config';
8
- export * from './task-data';
8
+ export * from './list-data';
9
9
  export * from './thought-data';
10
10
  export * from './user-data';
@@ -1,26 +1,26 @@
1
- import { TaskId, TaskListId, UserId } from "../id-types";
1
+ import { ListItemId, ListId, UserId } from "../id-types";
2
2
 
3
- export enum TaskListType {
3
+ export enum ListType {
4
4
  TASKS = 'tasks',
5
5
  NOTES = 'notes'
6
6
  }
7
7
 
8
- export interface TaskData {
9
- _id: TaskId;
8
+ export interface ListItemData {
9
+ _id: ListItemId;
10
10
  userId: UserId;
11
11
  createdAt: Date;
12
12
  updatedAt: Date;
13
13
  name: string;
14
14
  notes?: string;
15
15
  completed: boolean;
16
- taskListId: TaskListId;
16
+ taskListId: ListId;
17
17
  }
18
18
 
19
- export interface TaskListData {
20
- _id: TaskListId;
19
+ export interface ListData {
20
+ _id: ListId;
21
21
  userId: UserId;
22
22
  createdAt: Date;
23
23
  updatedAt: Date;
24
24
  name: string;
25
- type: TaskListType;
25
+ type: ListType;
26
26
  }
@@ -6,7 +6,7 @@ import {
6
6
  PersonData,
7
7
  PersonNoteData,
8
8
  NotificationTemplateData,
9
- TaskData, TaskListData,
9
+ ListItemData, ListData,
10
10
  ThoughtData,
11
11
  UserData
12
12
  } from "../types";
@@ -96,20 +96,20 @@ export class Serializer {
96
96
  return this.deserialize(data) as unknown as PersonNoteData;
97
97
  }
98
98
 
99
- static serializeTaskData(data: TaskData): Serialized<TaskData> {
99
+ static serializeTaskData(data: ListItemData): Serialized<ListItemData> {
100
100
  return this.serialize(data);
101
101
  }
102
102
 
103
- static deserializeTaskData(data: Serialized<TaskData>): TaskData {
104
- return this.deserialize(data) as unknown as TaskData;
103
+ static deserializeTaskData(data: Serialized<ListItemData>): ListItemData {
104
+ return this.deserialize(data) as unknown as ListItemData;
105
105
  }
106
106
 
107
- static serializeTaskListData(data: TaskListData): Serialized<TaskListData> {
107
+ static serializeTaskListData(data: ListData): Serialized<ListData> {
108
108
  return this.serialize(data);
109
109
  }
110
110
 
111
- static deserializeTaskListData(data: Serialized<TaskListData>): TaskListData {
112
- return this.deserialize(data) as unknown as TaskListData;
111
+ static deserializeTaskListData(data: Serialized<ListData>): ListData {
112
+ return this.deserialize(data) as unknown as ListData;
113
113
  }
114
114
 
115
115
  static serializeThoughtData(data: ThoughtData): Serialized<ThoughtData> {
@@ -1,13 +0,0 @@
1
- import { z } from 'zod';
2
- import { Serialized } from "../../../utils";
3
- import { TaskData } from "../../models";
4
-
5
- export const completeTaskRequestSchema = z.object({
6
- completed: z.boolean()
7
- });
8
-
9
- export type CompleteTaskRequest = z.infer<typeof completeTaskRequestSchema>;
10
-
11
- export interface CompleteTaskResponse {
12
- task: Serialized<TaskData>;
13
- }
@@ -1,14 +0,0 @@
1
- import { z } from 'zod';
2
- import { Serialized } from "../../../utils";
3
- import { TaskListData, TaskListType } from "../../models";
4
-
5
- export const createTaskListRequestSchema = z.object({
6
- name: z.string().min(1),
7
- type: z.nativeEnum(TaskListType)
8
- });
9
-
10
- export type CreateTaskListRequest = z.infer<typeof createTaskListRequestSchema>;
11
-
12
- export interface CreateTaskListResponse {
13
- taskList: Serialized<TaskListData>;
14
- }
@@ -1,16 +0,0 @@
1
- import { z } from 'zod';
2
- import { taskListIdSchema } from '../../id-types';
3
- import { Serialized } from "../../../utils";
4
- import { TaskData } from "../../models";
5
-
6
- export const createTaskRequestSchema = z.object({
7
- name: z.string().min(1),
8
- notes: z.string().optional(),
9
- taskListId: taskListIdSchema
10
- });
11
-
12
- export type CreateTaskRequest = z.infer<typeof createTaskRequestSchema>;
13
-
14
- export interface CreateTaskResponse {
15
- task: Serialized<TaskData>;
16
- }
@@ -1,6 +0,0 @@
1
- import { Serialized } from "../../../utils";
2
- import { TaskListData } from "../../models";
3
-
4
- export interface GetTaskListsResponse {
5
- taskLists: Serialized<TaskListData>[];
6
- }
@@ -1,6 +0,0 @@
1
- import { Serialized } from "../../../utils";
2
- import { TaskData } from "../../models";
3
-
4
- export interface GetTasksResponse {
5
- tasks: Serialized<TaskData>[];
6
- }
@@ -1,7 +0,0 @@
1
- export * from './complete-task-types';
2
- export * from './create-task-types';
3
- export * from './get-tasks-types';
4
- export * from './update-task-types';
5
- export * from './create-task-list-types';
6
- export * from './update-task-list-types';
7
- export * from './get-task-lists-types';
@@ -1,14 +0,0 @@
1
- import { z } from 'zod';
2
- import { Serialized } from "../../../utils";
3
- import { TaskListData, TaskListType } from "../../models";
4
-
5
- export const updateTaskListRequestSchema = z.object({
6
- name: z.string().min(1).optional(),
7
- type: z.nativeEnum(TaskListType).optional()
8
- });
9
-
10
- export type UpdateTaskListRequest = z.infer<typeof updateTaskListRequestSchema>;
11
-
12
- export interface UpdateTaskListResponse {
13
- taskList: Serialized<TaskListData>;
14
- }
@@ -1,17 +0,0 @@
1
- import { z } from 'zod';
2
- import { taskListIdSchema } from '../../id-types';
3
- import { Serialized } from "../../../utils";
4
- import { TaskData } from "../../models";
5
-
6
- export const updateTaskRequestSchema = z.object({
7
- name: z.string().min(1).optional(),
8
- notes: z.string().nullish(),
9
- completed: z.boolean().optional(),
10
- taskListId: taskListIdSchema.optional()
11
- });
12
-
13
- export type UpdateTaskRequest = z.infer<typeof updateTaskRequestSchema>;
14
-
15
- export interface UpdateTaskResponse {
16
- task: Serialized<TaskData>;
17
- }