@timothyw/pat-common 1.0.4 → 1.0.6
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/dist/types/api/account/get-user-config-types.d.ts +4 -0
- package/dist/types/api/account/get-user-config-types.js +2 -0
- package/dist/types/api/account/index.d.ts +2 -0
- package/dist/types/api/account/index.js +18 -0
- package/dist/types/api/account/update-user-config-types.d.ts +87 -0
- package/dist/types/api/account/update-user-config-types.js +35 -0
- package/dist/types/api/auth/index.d.ts +5 -0
- package/dist/types/api/auth/index.js +21 -0
- package/dist/types/api/auth/login-types.d.ts +19 -0
- package/dist/types/api/auth/login-types.js +8 -0
- package/dist/types/api/auth/refresh-auth-types.d.ts +15 -0
- package/dist/types/api/auth/refresh-auth-types.js +7 -0
- package/dist/types/api/auth/register-types.d.ts +23 -0
- package/dist/types/api/auth/register-types.js +10 -0
- package/dist/types/api/auth/resend-verification-types.d.ts +3 -0
- package/dist/types/api/auth/resend-verification-types.js +2 -0
- package/dist/types/api/auth/verify-email-types.d.ts +3 -0
- package/dist/types/api/auth/verify-email-types.js +2 -0
- package/dist/types/api/index.d.ts +5 -0
- package/dist/types/api/index.js +21 -0
- package/dist/types/api/items/complete-item-types.d.ts +18 -0
- package/dist/types/api/items/complete-item-types.js +7 -0
- package/dist/types/api/items/create-item-types.d.ts +36 -0
- package/dist/types/api/items/create-item-types.js +12 -0
- package/dist/types/api/items/delete-item-types.d.ts +3 -0
- package/dist/types/api/items/delete-item-types.js +2 -0
- package/dist/types/api/items/get-items-types.d.ts +4 -0
- package/dist/types/api/items/get-items-types.js +2 -0
- package/dist/types/api/items/index.d.ts +5 -0
- package/dist/types/api/items/index.js +21 -0
- package/dist/types/api/items/update-item-types.d.ts +36 -0
- package/dist/types/api/items/update-item-types.js +12 -0
- package/dist/types/api/people/create-person-types.d.ts +55 -0
- package/dist/types/api/people/create-person-types.js +14 -0
- package/dist/types/api/people/delete-person-types.d.ts +3 -0
- package/dist/types/api/people/delete-person-types.js +2 -0
- package/dist/types/api/people/get-people-types.d.ts +15 -0
- package/dist/types/api/people/get-people-types.js +2 -0
- package/dist/types/api/people/index.d.ts +4 -0
- package/dist/types/api/people/index.js +20 -0
- package/dist/types/api/people/update-person-types.d.ts +55 -0
- package/dist/types/api/people/update-person-types.js +14 -0
- package/dist/types/api/thoguhts/create-thought-types.d.ts +15 -0
- package/dist/types/api/thoguhts/create-thought-types.js +7 -0
- package/dist/types/api/thoguhts/delete-thought-types.d.ts +3 -0
- package/dist/types/api/thoguhts/delete-thought-types.js +2 -0
- package/dist/types/api/thoguhts/get-thoughts-types.d.ts +6 -0
- package/dist/types/api/thoguhts/get-thoughts-types.js +2 -0
- package/dist/types/api/thoguhts/index.d.ts +4 -0
- package/dist/types/api/thoguhts/index.js +20 -0
- package/dist/types/api/thoguhts/update-thought-types.d.ts +15 -0
- package/dist/types/api/thoguhts/update-thought-types.js +7 -0
- package/dist/types/id-types.d.ts +15 -0
- package/dist/types/id-types.js +2 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +4 -0
- package/dist/types/models/auth-data.d.ts +14 -0
- package/dist/types/models/auth-data.js +9 -0
- package/dist/types/models/index.d.ts +6 -0
- package/dist/types/models/index.js +22 -0
- package/dist/types/models/item-data.d.ts +14 -0
- package/dist/types/models/item-data.js +2 -0
- package/dist/types/models/person-data.d.ts +19 -0
- package/dist/types/models/person-data.js +2 -0
- package/dist/types/models/program-config.d.ts +17 -0
- package/dist/types/models/program-config.js +2 -0
- package/dist/types/models/thought-data.d.ts +8 -0
- package/dist/types/models/thought-data.js +2 -0
- package/dist/types/models/user-config.d.ts +24 -0
- package/dist/types/models/user-config.js +2 -0
- package/dist/types/panels.d.ts +2 -0
- package/dist/types/panels.js +4 -0
- package/package.json +5 -2
- package/src/types/api/account/get-user-config-types.ts +5 -0
- package/src/types/api/account/index.ts +2 -0
- package/src/types/api/account/update-user-config-types.ts +40 -0
- package/src/types/api/auth/index.ts +5 -0
- package/src/types/api/auth/login-types.ts +16 -0
- package/src/types/api/auth/refresh-auth-types.ts +14 -0
- package/src/types/api/auth/register-types.ts +16 -0
- package/src/types/api/auth/resend-verification-types.ts +3 -0
- package/src/types/api/auth/verify-email-types.ts +3 -0
- package/src/types/api/index.ts +5 -0
- package/src/types/api/items/complete-item-types.ts +17 -0
- package/src/types/api/items/create-item-types.ts +25 -0
- package/src/types/api/items/delete-item-types.ts +3 -0
- package/src/types/api/items/get-items-types.ts +5 -0
- package/src/types/api/items/index.ts +5 -0
- package/src/types/api/items/update-item-types.ts +25 -0
- package/src/types/api/people/create-person-types.ts +30 -0
- package/src/types/api/people/delete-person-types.ts +3 -0
- package/src/types/api/people/get-people-types.ts +15 -0
- package/src/types/api/people/index.ts +4 -0
- package/src/types/api/people/update-person-types.ts +30 -0
- package/src/types/api/thoguhts/create-thought-types.ts +14 -0
- package/src/types/api/thoguhts/delete-thought-types.ts +3 -0
- package/src/types/api/thoguhts/get-thoughts-types.ts +6 -0
- package/src/types/api/thoguhts/index.ts +4 -0
- package/src/types/api/thoguhts/update-thought-types.ts +14 -0
- package/src/types/id-types.ts +6 -0
- package/src/types/index.ts +5 -1
- package/src/types/models/auth-data.ts +21 -0
- package/src/types/models/index.ts +6 -0
- package/src/types/models/item-data.ts +17 -0
- package/src/types/models/person-data.ts +22 -0
- package/src/types/models/program-config.ts +17 -0
- package/src/types/models/thought-data.ts +9 -0
- package/src/types/models/user-config.ts +27 -0
- package/src/types/panels.ts +3 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const updatePersonRequestSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodOptional<z.ZodString>;
|
|
4
|
+
properties: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
value: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
value: string;
|
|
9
|
+
key: string;
|
|
10
|
+
}, {
|
|
11
|
+
value: string;
|
|
12
|
+
key: string;
|
|
13
|
+
}>, "many">>;
|
|
14
|
+
notes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
+
content: z.ZodString;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
content: string;
|
|
18
|
+
}, {
|
|
19
|
+
content: string;
|
|
20
|
+
}>, "many">>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
name?: string | undefined;
|
|
23
|
+
notes?: {
|
|
24
|
+
content: string;
|
|
25
|
+
}[] | undefined;
|
|
26
|
+
properties?: {
|
|
27
|
+
value: string;
|
|
28
|
+
key: string;
|
|
29
|
+
}[] | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
name?: string | undefined;
|
|
32
|
+
notes?: {
|
|
33
|
+
content: string;
|
|
34
|
+
}[] | undefined;
|
|
35
|
+
properties?: {
|
|
36
|
+
value: string;
|
|
37
|
+
key: string;
|
|
38
|
+
}[] | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
export type UpdatePersonRequest = z.infer<typeof updatePersonRequestSchema>;
|
|
41
|
+
export interface UpdatePersonResponse {
|
|
42
|
+
person: {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
properties: Array<{
|
|
46
|
+
key: string;
|
|
47
|
+
value: string;
|
|
48
|
+
}>;
|
|
49
|
+
notes: Array<{
|
|
50
|
+
content: string;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
updatedAt: string;
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updatePersonRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.updatePersonRequestSchema = zod_1.z.object({
|
|
6
|
+
name: zod_1.z.string().min(1).optional(),
|
|
7
|
+
properties: zod_1.z.array(zod_1.z.object({
|
|
8
|
+
key: zod_1.z.string().min(1),
|
|
9
|
+
value: zod_1.z.string().min(1)
|
|
10
|
+
})).optional(),
|
|
11
|
+
notes: zod_1.z.array(zod_1.z.object({
|
|
12
|
+
content: zod_1.z.string().min(1)
|
|
13
|
+
})).optional()
|
|
14
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createThoughtRequestSchema: z.ZodObject<{
|
|
3
|
+
content: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
content: string;
|
|
6
|
+
}, {
|
|
7
|
+
content: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type CreateThoughtRequest = z.infer<typeof createThoughtRequestSchema>;
|
|
10
|
+
export interface CreateThoughtResponse {
|
|
11
|
+
thought: {
|
|
12
|
+
id: string;
|
|
13
|
+
content: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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("./create-thought-types"), exports);
|
|
18
|
+
__exportStar(require("./delete-thought-types"), exports);
|
|
19
|
+
__exportStar(require("./get-thoughts-types"), exports);
|
|
20
|
+
__exportStar(require("./update-thought-types"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const updateThoughtRequestSchema: z.ZodObject<{
|
|
3
|
+
content: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
content: string;
|
|
6
|
+
}, {
|
|
7
|
+
content: string;
|
|
8
|
+
}>;
|
|
9
|
+
export type UpdateThoughtRequest = z.infer<typeof updateThoughtRequestSchema>;
|
|
10
|
+
export interface UpdateThoughtResponse {
|
|
11
|
+
thought: {
|
|
12
|
+
id: string;
|
|
13
|
+
content: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type UserId = string & {
|
|
2
|
+
readonly __brand: unique symbol;
|
|
3
|
+
};
|
|
4
|
+
export type AuthId = string & {
|
|
5
|
+
readonly __brand: unique symbol;
|
|
6
|
+
};
|
|
7
|
+
export type ItemId = string & {
|
|
8
|
+
readonly __brand: unique symbol;
|
|
9
|
+
};
|
|
10
|
+
export type PersonId = string & {
|
|
11
|
+
readonly __brand: unique symbol;
|
|
12
|
+
};
|
|
13
|
+
export type ThoughtId = string & {
|
|
14
|
+
readonly __brand: unique symbol;
|
|
15
|
+
};
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -14,4 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./api"), exports);
|
|
18
|
+
__exportStar(require("./models"), exports);
|
|
17
19
|
__exportStar(require("./auth-tokens"), exports);
|
|
20
|
+
__exportStar(require("./id-types"), exports);
|
|
21
|
+
__exportStar(require("./panels"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AuthId, UserId } from "../id-types";
|
|
2
|
+
export interface AuthData {
|
|
3
|
+
_id: AuthId;
|
|
4
|
+
createdAt: Date;
|
|
5
|
+
updatedAt: Date;
|
|
6
|
+
userId: UserId;
|
|
7
|
+
email: string;
|
|
8
|
+
passwordHash: string;
|
|
9
|
+
emailVerified: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type PublicAuthData = Pick<AuthData, 'email' | 'emailVerified'> & {
|
|
12
|
+
readonly __brand: unique symbol;
|
|
13
|
+
};
|
|
14
|
+
export declare function toPublicAuthData(data: AuthData): PublicAuthData;
|
|
@@ -0,0 +1,22 @@
|
|
|
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("./auth-data"), exports);
|
|
18
|
+
__exportStar(require("./item-data"), exports);
|
|
19
|
+
__exportStar(require("./person-data"), exports);
|
|
20
|
+
__exportStar(require("./program-config"), exports);
|
|
21
|
+
__exportStar(require("./thought-data"), exports);
|
|
22
|
+
__exportStar(require("./user-config"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ItemId, UserId } from "../id-types";
|
|
2
|
+
export interface ItemData {
|
|
3
|
+
_id: ItemId;
|
|
4
|
+
userId: UserId;
|
|
5
|
+
createdAt: Date;
|
|
6
|
+
updatedAt: Date;
|
|
7
|
+
name: string;
|
|
8
|
+
dueDate?: Date | null;
|
|
9
|
+
notes?: string;
|
|
10
|
+
completed: boolean;
|
|
11
|
+
urgent: boolean;
|
|
12
|
+
category?: string | null;
|
|
13
|
+
type?: string | null;
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PersonId, UserId } from "../id-types";
|
|
2
|
+
export interface PersonProperty {
|
|
3
|
+
key: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PersonNote {
|
|
7
|
+
content: string;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
updatedAt: Date;
|
|
10
|
+
}
|
|
11
|
+
export interface PersonData {
|
|
12
|
+
_id: PersonId;
|
|
13
|
+
userId: UserId;
|
|
14
|
+
createdAt: Date;
|
|
15
|
+
updatedAt: Date;
|
|
16
|
+
name: string;
|
|
17
|
+
properties: PersonProperty[];
|
|
18
|
+
notes: PersonNote[];
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ProgramConfigData extends Document {
|
|
2
|
+
dev: {
|
|
3
|
+
authorizedEmails: string[];
|
|
4
|
+
};
|
|
5
|
+
discord: {
|
|
6
|
+
token: string;
|
|
7
|
+
clientId: string;
|
|
8
|
+
guildId: string;
|
|
9
|
+
logChannelId?: string;
|
|
10
|
+
};
|
|
11
|
+
mailjet: {
|
|
12
|
+
apiKey: string;
|
|
13
|
+
secretKey: string;
|
|
14
|
+
};
|
|
15
|
+
updatedAt: Date;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PanelType } from "../panels";
|
|
2
|
+
import { UserId } from "../id-types";
|
|
3
|
+
export interface Panel {
|
|
4
|
+
type: PanelType;
|
|
5
|
+
visible: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface UserConfig {
|
|
8
|
+
_id: UserId;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
updatedAt: Date;
|
|
11
|
+
name: string;
|
|
12
|
+
timezone: string;
|
|
13
|
+
discordID?: string;
|
|
14
|
+
itemListTracking?: {
|
|
15
|
+
channelId: string;
|
|
16
|
+
messageId: string;
|
|
17
|
+
};
|
|
18
|
+
iosApp: {
|
|
19
|
+
panels: Panel[];
|
|
20
|
+
itemCategories: string[];
|
|
21
|
+
itemTypes: string[];
|
|
22
|
+
propertyKeys?: string[];
|
|
23
|
+
};
|
|
24
|
+
}
|
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.
|
|
5
|
+
"version": "1.0.6",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
@@ -17,5 +17,8 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"typescript": "^5.5.3"
|
|
19
19
|
},
|
|
20
|
-
"license": "ISC"
|
|
20
|
+
"license": "ISC",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"zod": "^3.24.3"
|
|
23
|
+
}
|
|
21
24
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PANEL_TYPES } from "../../panels";
|
|
3
|
+
|
|
4
|
+
export const updateUserConfigRequestSchema = z.object({
|
|
5
|
+
name: z.string().min(1).nullish(),
|
|
6
|
+
timezone: z.string()
|
|
7
|
+
.refine((tz: string) => {
|
|
8
|
+
try {
|
|
9
|
+
Intl.DateTimeFormat(undefined, { timeZone: tz });
|
|
10
|
+
return true;
|
|
11
|
+
} catch (e) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}, {
|
|
15
|
+
message: "Invalid timezone"
|
|
16
|
+
})
|
|
17
|
+
.nullish(),
|
|
18
|
+
discordID: z.string().nullish(),
|
|
19
|
+
itemListTracking: z.object({
|
|
20
|
+
channelId: z.string(),
|
|
21
|
+
messageId: z.string()
|
|
22
|
+
}).nullish(),
|
|
23
|
+
iosApp: z.object({
|
|
24
|
+
panels: z.array(z.object({
|
|
25
|
+
panel: z.enum(PANEL_TYPES),
|
|
26
|
+
visible: z.boolean()
|
|
27
|
+
})).optional(),
|
|
28
|
+
itemCategories: z.array(z.string()).optional(),
|
|
29
|
+
itemTypes: z.array(z.string()).optional(),
|
|
30
|
+
propertyKeys: z.array(z.string()).optional()
|
|
31
|
+
}).nullish()
|
|
32
|
+
}).strict();
|
|
33
|
+
|
|
34
|
+
export type UpdateUserConfigRequest = z.infer<typeof updateUserConfigRequestSchema>;
|
|
35
|
+
|
|
36
|
+
export interface UpdateUserConfigResponse {
|
|
37
|
+
user: UpdateUserConfigRequest & {
|
|
38
|
+
id: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AuthTokens } from "../../auth-tokens";
|
|
3
|
+
import { PublicAuthData, UserConfig } from "../../models";
|
|
4
|
+
|
|
5
|
+
export const loginRequestSchema = z.object({
|
|
6
|
+
email: z.string().email(),
|
|
7
|
+
password: z.string()
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type LoginRequest = z.infer<typeof loginRequestSchema>;
|
|
11
|
+
|
|
12
|
+
export interface LoginResponse {
|
|
13
|
+
tokenData: AuthTokens;
|
|
14
|
+
authData: PublicAuthData;
|
|
15
|
+
user: UserConfig;
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AuthTokens } from "../../auth-tokens";
|
|
3
|
+
import { PublicAuthData } from "../../models";
|
|
4
|
+
|
|
5
|
+
export const refreshAuthRequestSchema = z.object({
|
|
6
|
+
refreshToken: z.string()
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type RefreshAuthRequest = z.infer<typeof refreshAuthRequestSchema>;
|
|
10
|
+
|
|
11
|
+
export interface RefreshAuthResponse {
|
|
12
|
+
tokenData: AuthTokens;
|
|
13
|
+
authData: PublicAuthData;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const registerRequestSchema = z.object({
|
|
4
|
+
name: z.string().trim().min(1),
|
|
5
|
+
email: z.string().trim().email(),
|
|
6
|
+
password: z.string().min(4),
|
|
7
|
+
skipVerificationEmail: z.boolean().optional()
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type RegisterRequest = z.infer<typeof registerRequestSchema>;
|
|
11
|
+
|
|
12
|
+
export interface RegisterResponse {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
email: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const completeItemRequestSchema = z.object({
|
|
4
|
+
completed: z.boolean()
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
export type CompleteItemRequest = z.infer<typeof completeItemRequestSchema>;
|
|
8
|
+
|
|
9
|
+
export interface CompleteItemResponse {
|
|
10
|
+
item: {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
completed: boolean;
|
|
14
|
+
dueDate?: string;
|
|
15
|
+
notes?: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const createItemRequestSchema = z.object({
|
|
4
|
+
name: z.string().min(1),
|
|
5
|
+
dueDate: z.string().nullish(),
|
|
6
|
+
notes: z.string().optional(),
|
|
7
|
+
urgent: z.boolean().optional().default(false),
|
|
8
|
+
category: z.string().nullish(),
|
|
9
|
+
type: z.string().nullish()
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type CreateItemRequest = z.infer<typeof createItemRequestSchema>;
|
|
13
|
+
|
|
14
|
+
export interface CreateItemResponse {
|
|
15
|
+
item: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
dueDate?: string;
|
|
19
|
+
notes?: string;
|
|
20
|
+
completed: boolean;
|
|
21
|
+
urgent: boolean;
|
|
22
|
+
category?: string;
|
|
23
|
+
type?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const updateItemRequestSchema = z.object({
|
|
4
|
+
name: z.string().min(1).optional(),
|
|
5
|
+
dueDate: z.string().nullish(),
|
|
6
|
+
notes: z.string().optional(),
|
|
7
|
+
urgent: z.boolean().optional(),
|
|
8
|
+
category: z.string().nullish(),
|
|
9
|
+
type: z.string().nullish()
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type UpdateItemRequest = z.infer<typeof updateItemRequestSchema>;
|
|
13
|
+
|
|
14
|
+
export interface UpdateItemResponse {
|
|
15
|
+
item: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
dueDate?: string;
|
|
19
|
+
notes?: string;
|
|
20
|
+
completed: boolean;
|
|
21
|
+
urgent: boolean;
|
|
22
|
+
category?: string;
|
|
23
|
+
type?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const createPersonRequestSchema = z.object({
|
|
4
|
+
name: z.string().min(1),
|
|
5
|
+
properties: z.array(z.object({
|
|
6
|
+
key: z.string().min(1),
|
|
7
|
+
value: z.string().min(1)
|
|
8
|
+
})).optional(),
|
|
9
|
+
notes: z.array(z.object({
|
|
10
|
+
content: z.string().min(1)
|
|
11
|
+
})).optional()
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type CreatePersonRequest = z.infer<typeof createPersonRequestSchema>;
|
|
15
|
+
|
|
16
|
+
export interface CreatePersonResponse {
|
|
17
|
+
person: {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
properties: Array<{
|
|
21
|
+
key: string;
|
|
22
|
+
value: string;
|
|
23
|
+
}>;
|
|
24
|
+
notes: Array<{
|
|
25
|
+
content: string;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
updatedAt: string;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
}
|