summaryrefslogtreecommitdiff
path: root/backend/src/types
diff options
context:
space:
mode:
authorArne Rief <riearn@proton.me>2025-12-19 20:03:03 +0100
committerArne Rief <riearn@proton.me>2025-12-19 20:03:03 +0100
commit655ec610fcce8dd7748f10772d520bdff4f7c78e (patch)
tree35b79f30d2cb5aea88cf76ce27f480da93cefd32 /backend/src/types
Basic setup & login
Diffstat (limited to 'backend/src/types')
-rw-r--r--backend/src/types/database.ts7
-rw-r--r--backend/src/types/express.d.ts11
-rw-r--r--backend/src/types/request.ts4
-rw-r--r--backend/src/types/user.ts18
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;
+};