From 655ec610fcce8dd7748f10772d520bdff4f7c78e Mon Sep 17 00:00:00 2001 From: Arne Rief Date: Fri, 19 Dec 2025 20:03:03 +0100 Subject: Basic setup & login --- backend/src/types/database.ts | 7 +++++++ backend/src/types/express.d.ts | 11 +++++++++++ backend/src/types/request.ts | 4 ++++ backend/src/types/user.ts | 18 ++++++++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 backend/src/types/database.ts create mode 100644 backend/src/types/express.d.ts create mode 100644 backend/src/types/request.ts create mode 100644 backend/src/types/user.ts (limited to 'backend/src/types') 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; +}; -- cgit v1.2.3