diff options
Diffstat (limited to 'backend/src/types')
| -rw-r--r-- | backend/src/types/database.ts | 7 | ||||
| -rw-r--r-- | backend/src/types/express.d.ts | 11 | ||||
| -rw-r--r-- | backend/src/types/request.ts | 4 | ||||
| -rw-r--r-- | backend/src/types/user.ts | 18 |
4 files changed, 40 insertions, 0 deletions
diff --git a/backend/src/types/database.ts b/backend/src/types/database.ts new file mode 100644 index 0000000..fff88a1 --- /dev/null +++ b/backend/src/types/database.ts @@ -0,0 +1,7 @@ +export interface PostgresError extends Error { + code: string; + detail?: string; + schema?: string; + table?: string; + constraint?: string; +} diff --git a/backend/src/types/express.d.ts b/backend/src/types/express.d.ts new file mode 100644 index 0000000..7ac6ca0 --- /dev/null +++ b/backend/src/types/express.d.ts @@ -0,0 +1,11 @@ +import type { AuthorizedUser } from "./user.js"; + +declare global { + namespace Express { + interface Request { + user?: AuthorizedUser; + } + } +} + +export {}; diff --git a/backend/src/types/request.ts b/backend/src/types/request.ts new file mode 100644 index 0000000..ef80738 --- /dev/null +++ b/backend/src/types/request.ts @@ -0,0 +1,4 @@ +export type LoginRequest = { + email: string; + password: string; +}; diff --git a/backend/src/types/user.ts b/backend/src/types/user.ts new file mode 100644 index 0000000..875072c --- /dev/null +++ b/backend/src/types/user.ts @@ -0,0 +1,18 @@ +export type AdminCreationResult = { + id: string; + email: string; + created_at: Date; +}; + +export type AuthorizedUser = { + id: string; + email: string; + createdAt: Date; +}; + +export type DatabaseUser = { + id: string; + email: string; + password_hash: string; + created_at: Date; +}; |
