From 95f0b4dd2e729bada2c1881c2399ea79d0069310 Mon Sep 17 00:00:00 2001 From: Luzefiru Date: Mon, 25 Nov 2024 20:05:35 +0800 Subject: [PATCH 1/6] feat(ci): move environment variables to docker compose --- .docker-compose.dev.yml | 22 ---------------------- README.md | 34 ++++++++++++++++++++++++++++++++++ docker/.env.example | 7 +++++++ docker/docker-compose.dev.yml | 23 +++++++++++++++++++++++ package.json | 4 ++-- 5 files changed, 66 insertions(+), 24 deletions(-) delete mode 100644 .docker-compose.dev.yml create mode 100644 README.md create mode 100644 docker/.env.example create mode 100644 docker/docker-compose.dev.yml diff --git a/.docker-compose.dev.yml b/.docker-compose.dev.yml deleted file mode 100644 index 0ff31ec..0000000 --- a/.docker-compose.dev.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: '3.9' - -services: - - db: - image: postgres - restart: always - shm_size: 128mb - env_file: - - .env - ports: - - 5432:${DB_PORT} - volumes: - - budgeteer-db:/var/lib/postgresql/data - adminer: - image: adminer - restart: always - ports: - - 8080:${ADMINER_PORT} - -volumes: - budgeteer-db: \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..3ccdefa --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# Budgeteer + +## Prerequisites + +To get started with Budgeteer, ensure that you have the following tools installed and properly configured on your system: + +1. **Docker**: A platform to develop, ship, and run applications using containers. + - Installation guide: [Get Docker](https://docs.docker.com/get-docker/) +2. **Docker Compose**: A tool for defining and running multi-container Docker applications. + - Installation guide: [Install Docker Compose](https://docs.docker.com/compose/install/) + +## Usage + +Run the following command to initialize the required services using Docker Compose: + +```bash +# Executes the Docker Compose configuration for development +npm run all:up +``` + +## Setting Up Environment Variables + +> [!TIP] +> By default, the environment variables are set to placeholder fallbacks to ensure the app works without any configuration. + +If you want to setup your own environment variables in the Docker Compose files, make a copy of the `.env.example` first. + +```bash +# creates a .env to read from when executing the Docker Compose file +cp docker/.env.example docker/.env + +# start editing it +nano docker/.env +``` diff --git a/docker/.env.example b/docker/.env.example new file mode 100644 index 0000000..43b6973 --- /dev/null +++ b/docker/.env.example @@ -0,0 +1,7 @@ +POSTGRES_PASSWORD=happy123 +POSTGRES_USER=happy123 +POSTGRES_DB=happy123 +POSTGRES_HOST=localhost +DB_PORT=5432 +ADMINER_PORT=8080 +JWT_SECRET=very_secret_jwt \ No newline at end of file diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml new file mode 100644 index 0000000..54dc0b6 --- /dev/null +++ b/docker/docker-compose.dev.yml @@ -0,0 +1,23 @@ +services: + db: + image: postgres + restart: always + shm_size: 128mb + environment: + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-example} + - POSTGRES_USER=${POSTGRES_USER:-postgres} + - POSTGRES_DB=${POSTGRES_DB:-postgres} + - POSTGRES_HOST=${POSTGRES_HOST:-localhost} + ports: + - 5432:${DB_PORT:-5432} + volumes: + - budgeteer-db:/var/lib/postgresql/data + + adminer: + image: adminer + restart: always + ports: + - 8080:${ADMINER_PORT:-8080} + +volumes: + budgeteer-db: diff --git a/package.json b/package.json index a2f69a5..774c0e5 100644 --- a/package.json +++ b/package.json @@ -36,8 +36,8 @@ "types:format": "bun run --cwd=\"packages/types\" format", "workspace:lint": "bun run server:lint && bun run client:lint && bun run types:lint", "workspace:format": "bun run server:format && bun run client:format && bun run types:format", - "db:up": "docker-compose -f .docker-compose.dev.yml up -d", - "db:down": "docker-compose -f .docker-compose.dev.yml down", + "db:up": "docker-compose -f docker/docker-compose.dev.yml up -d", + "db:down": "docker-compose -f docker/docker-compose.dev.yml down", "db:migration-generate": "bun run --cwd=\"packages/server\" drizzle:generate", "db:migration-migrate": "bun run --cwd=\"packages/server\" drizzle:migrate", "db:migration-push": "bun run --cwd=\"packages/server\" drizzle:push", From ea699d38b6d5dfce59fa9ebda26e83f50a504dc8 Mon Sep 17 00:00:00 2001 From: Luzefiru Date: Mon, 25 Nov 2024 22:26:19 +0800 Subject: [PATCH 2/6] feat(ci): dockerize app & fix imports, dependency issues BREAKING CHANGE: docker-compose scripts are changed --- .dockerignore | 1 + docker/.env.example => .env.example | 2 +- Dockerfile.client | 17 ++++++ Dockerfile.server | 16 ++++++ README.md | 4 +- docker-compose.dev.yml | 52 +++++++++++++++++++ docker/docker-compose.dev.yml | 23 -------- package.json | 9 ++-- packages/client/package.json | 2 +- .../src/features/dashboard/transaction.tsx | 2 +- packages/client/src/hooks/use-toast.ts | 1 + packages/server/package.json | 2 +- packages/server/src/index.ts | 2 + .../src/use-cases/auth/auth.use-cases.ts | 2 + .../repositories/user-repository.abstract.ts | 2 +- .../use-cases/auth-use-cases.abstract.ts | 4 +- .../use-cases/users-use-cases.abstract.ts | 4 +- 17 files changed, 108 insertions(+), 37 deletions(-) create mode 100644 .dockerignore rename docker/.env.example => .env.example (82%) create mode 100644 Dockerfile.client create mode 100644 Dockerfile.server create mode 100644 docker-compose.dev.yml delete mode 100644 docker/docker-compose.dev.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/docker/.env.example b/.env.example similarity index 82% rename from docker/.env.example rename to .env.example index 43b6973..ddfb669 100644 --- a/docker/.env.example +++ b/.env.example @@ -4,4 +4,4 @@ POSTGRES_DB=happy123 POSTGRES_HOST=localhost DB_PORT=5432 ADMINER_PORT=8080 -JWT_SECRET=very_secret_jwt \ No newline at end of file +JWT_SECRET=secret \ No newline at end of file diff --git a/Dockerfile.client b/Dockerfile.client new file mode 100644 index 0000000..303322d --- /dev/null +++ b/Dockerfile.client @@ -0,0 +1,17 @@ +FROM oven/bun:alpine AS base + +FROM base AS builder +WORKDIR /app +RUN apk add --no-cache git +COPY . . + +RUN bun install +RUN bun run client:build + +FROM builder AS runner +WORKDIR /app +ENV NODE_ENV=production + +USER bun +EXPOSE 5173 +CMD ["bun", "run", "client:start"] \ No newline at end of file diff --git a/Dockerfile.server b/Dockerfile.server new file mode 100644 index 0000000..540bd72 --- /dev/null +++ b/Dockerfile.server @@ -0,0 +1,16 @@ +FROM oven/bun:alpine AS base + +FROM base AS builder +WORKDIR /app +RUN apk add --no-cache git +COPY . . + +RUN bun install + +FROM builder AS runner +WORKDIR /app +ENV NODE_ENV=production + +USER bun +EXPOSE 3000 +CMD ["bun", "run", "server:start"] \ No newline at end of file diff --git a/README.md b/README.md index 3ccdefa..3ba8059 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ If you want to setup your own environment variables in the Docker Compose files, ```bash # creates a .env to read from when executing the Docker Compose file -cp docker/.env.example docker/.env +cp .env.example .env # start editing it -nano docker/.env +nano .env ``` diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..3c0abf2 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,52 @@ +services: + client: + depends_on: + - server + build: + context: . + dockerfile: Dockerfile.client + restart: always + ports: + - ${CLIENT_PORT:-5173}:${CLIENT_PORT:-5173} + environment: + - NEXT_PUBLIC_API_BASE_URL=${NEXT_PUBLIC_API_BASE_URL:-http://server:${SERVER_PORT:-3000}/api} + + server: + depends_on: + - db + build: + context: . + dockerfile: Dockerfile.server + restart: always + ports: + - ${SERVER_PORT:-3000}:${SERVER_PORT:-3000} + environment: + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-example} + - POSTGRES_USER=${POSTGRES_USER:-postgres} + - POSTGRES_DB=${POSTGRES_DB:-postgres} + - POSTGRES_HOST=${POSTGRES_HOST:-db} + - JWT_SECRET=${JWT_SECRET:-secret} + + db: + image: postgres + restart: always + shm_size: 128mb + environment: + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-example} + - POSTGRES_USER=${POSTGRES_USER:-postgres} + - POSTGRES_DB=${POSTGRES_DB:-postgres} + volumes: + - budgeteer-db:/var/lib/postgresql/data + # run this script on first DB initialization + - ./packages/server/src/infrastructure/drizzle-data-service/migrations/0000_furry_sheva_callister.sql:/docker-entrypoint-initdb.d/init.sql + + adminer: + depends_on: + - db + image: adminer + restart: always + ports: + - ${ADMINER_PORT:-8080}:${ADMINER_PORT:-8080} + +volumes: + budgeteer-db: diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml deleted file mode 100644 index 54dc0b6..0000000 --- a/docker/docker-compose.dev.yml +++ /dev/null @@ -1,23 +0,0 @@ -services: - db: - image: postgres - restart: always - shm_size: 128mb - environment: - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-example} - - POSTGRES_USER=${POSTGRES_USER:-postgres} - - POSTGRES_DB=${POSTGRES_DB:-postgres} - - POSTGRES_HOST=${POSTGRES_HOST:-localhost} - ports: - - 5432:${DB_PORT:-5432} - volumes: - - budgeteer-db:/var/lib/postgresql/data - - adminer: - image: adminer - restart: always - ports: - - 8080:${ADMINER_PORT:-8080} - -volumes: - budgeteer-db: diff --git a/package.json b/package.json index 774c0e5..f981b18 100644 --- a/package.json +++ b/package.json @@ -36,16 +36,19 @@ "types:format": "bun run --cwd=\"packages/types\" format", "workspace:lint": "bun run server:lint && bun run client:lint && bun run types:lint", "workspace:format": "bun run server:format && bun run client:format && bun run types:format", - "db:up": "docker-compose -f docker/docker-compose.dev.yml up -d", - "db:down": "docker-compose -f docker/docker-compose.dev.yml down", + "db:up": "docker-compose -f docker-compose.dev.yml up -d", + "db:down": "docker-compose -f docker-compose.dev.yml down", "db:migration-generate": "bun run --cwd=\"packages/server\" drizzle:generate", "db:migration-migrate": "bun run --cwd=\"packages/server\" drizzle:migrate", "db:migration-push": "bun run --cwd=\"packages/server\" drizzle:push", "db:seed": "bun run --cwd=\"packages/server\" drizzle:seed", "client:dev": "bun run --cwd=\"packages/client\" dev", + "client:build": "bun run --cwd=\"packages/client\" build", "client:start": "bun run --cwd=\"packages/client\" start", "server:dev": "bun run --cwd=\"packages/server\" dev", - "server:start": "bun run --cwd=\"packages/server\" start" + "server:start": "bun run --cwd=\"packages/server\" start", + "all:up": "docker-compose -f docker-compose.dev.yml up", + "all:down": "docker-compose -f docker-compose.dev.yml down" }, "workspaces": [ "packages/*" diff --git a/packages/client/package.json b/packages/client/package.json index d050bd3..5534366 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -33,7 +33,7 @@ "tailwind-merge": "^2.5.4", "tailwindcss-animate": "^1.0.7", "usehooks-ts": "^3.1.0", - "zod": "^3.23.7" + "zod": "3.23.7" }, "devDependencies": { "@types/node": "^20", diff --git a/packages/client/src/features/dashboard/transaction.tsx b/packages/client/src/features/dashboard/transaction.tsx index cfc9745..af6108c 100644 --- a/packages/client/src/features/dashboard/transaction.tsx +++ b/packages/client/src/features/dashboard/transaction.tsx @@ -3,7 +3,7 @@ import { TransactionTypeEnum } from "@budgeteer/types" import { convertToTitleCase } from "~/lib/convertToTitleCase" interface TransactionProps { - type: TransactionTypeEnum + type: string description: string } diff --git a/packages/client/src/hooks/use-toast.ts b/packages/client/src/hooks/use-toast.ts index 83b19af..3b40a47 100644 --- a/packages/client/src/hooks/use-toast.ts +++ b/packages/client/src/hooks/use-toast.ts @@ -15,6 +15,7 @@ type ToasterToast = ToastProps & { action?: ToastActionElement } +// eslint-disable-next-line const actionTypes = { ADD_TOAST: "ADD_TOAST", UPDATE_TOAST: "UPDATE_TOAST", diff --git a/packages/server/package.json b/packages/server/package.json index aee6e36..e1108c8 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -31,7 +31,7 @@ "drizzle-orm": "^0.36.0", "hono": "^4.6.9", "pg": "^8.13.1", - "zod": "^3.23.7" + "zod": "3.23.7" }, "type": "module" } diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 9159723..df8429a 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -12,6 +12,8 @@ app.use(logger()) app.use(cors()) app.onError((err, c) => { + console.error(err) + const response: ResponseDto = { status: HttpStatusEnum.INTERNAL_SERVER_ERROR, data: null, diff --git a/packages/server/src/use-cases/auth/auth.use-cases.ts b/packages/server/src/use-cases/auth/auth.use-cases.ts index e615779..637c056 100644 --- a/packages/server/src/use-cases/auth/auth.use-cases.ts +++ b/packages/server/src/use-cases/auth/auth.use-cases.ts @@ -53,6 +53,8 @@ export const AuthUseCases: IAuthUseCases = { return response } catch (e) { if (e instanceof Error) { + console.log(e) + throw new HTTPException(HttpStatusEnum.INTERNAL_SERVER_ERROR, { message: e.message }) } diff --git a/packages/types/src/abstracts/repositories/user-repository.abstract.ts b/packages/types/src/abstracts/repositories/user-repository.abstract.ts index 24c1296..a087cac 100644 --- a/packages/types/src/abstracts/repositories/user-repository.abstract.ts +++ b/packages/types/src/abstracts/repositories/user-repository.abstract.ts @@ -1,6 +1,6 @@ import type { UserCreateDto } from "../../entities/users/user-create.dto" import type { UserUpdateDto } from "../../entities/users/user-update.dto" -import type { UserUpdateProfilePictureDto } from "src/entities/users/user-update-profile-picture.dto" +import type { UserUpdateProfilePictureDto } from "../../entities/users/user-update-profile-picture.dto" import type { UserDto, UserPublicDto } from "../../entities/users/user.dto" export type IUserRepository = { diff --git a/packages/types/src/abstracts/use-cases/auth-use-cases.abstract.ts b/packages/types/src/abstracts/use-cases/auth-use-cases.abstract.ts index 40b4f95..b803f05 100644 --- a/packages/types/src/abstracts/use-cases/auth-use-cases.abstract.ts +++ b/packages/types/src/abstracts/use-cases/auth-use-cases.abstract.ts @@ -2,6 +2,6 @@ import type { ResponseDto } from "../../entities/response/response.dto" import type { UserCreateDto } from "../../entities/users/user-create.dto" export type IAuthUseCases = { - register: (dto: UserCreateDto) => Promise> - login: (dto: UserCreateDto) => Promise> + register: (dto: UserCreateDto) => Promise> + login: (dto: UserCreateDto) => Promise> } diff --git a/packages/types/src/abstracts/use-cases/users-use-cases.abstract.ts b/packages/types/src/abstracts/use-cases/users-use-cases.abstract.ts index a6507e6..8151c44 100644 --- a/packages/types/src/abstracts/use-cases/users-use-cases.abstract.ts +++ b/packages/types/src/abstracts/use-cases/users-use-cases.abstract.ts @@ -1,7 +1,7 @@ import type { ResponseDto } from "../../entities/response/response.dto" import type { UserCreateDto } from "../../entities/users/user-create.dto" -import type { UserUpdateProfilePictureDto } from "src/entities/users/user-update-profile-picture.dto" -import type { UserUpdateDto } from "src/entities/users/user-update.dto" +import type { UserUpdateProfilePictureDto } from "../../entities/users/user-update-profile-picture.dto" +import type { UserUpdateDto } from "../../entities/users/user-update.dto" import type { UserDto, UserPublicDto } from "../../entities/users/user.dto" export type IUserUseCases = { From 3ee8bfa151e1db19a0342412ce62187981846f23 Mon Sep 17 00:00:00 2001 From: Luzefiru Date: Mon, 25 Nov 2024 22:30:06 +0800 Subject: [PATCH 3/6] fix(ci): target specific services with db:* scripts --- docker-compose.dev.yml => docker-compose.yml | 2 ++ package.json | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) rename docker-compose.dev.yml => docker-compose.yml (92%) diff --git a/docker-compose.dev.yml b/docker-compose.yml similarity index 92% rename from docker-compose.dev.yml rename to docker-compose.yml index 3c0abf2..b56eca0 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.yml @@ -30,6 +30,8 @@ services: db: image: postgres restart: always + ports: + - ${DB_PORT:-5432}:${DB_PORT:-5432} shm_size: 128mb environment: - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-example} diff --git a/package.json b/package.json index f981b18..6d2c515 100644 --- a/package.json +++ b/package.json @@ -36,8 +36,8 @@ "types:format": "bun run --cwd=\"packages/types\" format", "workspace:lint": "bun run server:lint && bun run client:lint && bun run types:lint", "workspace:format": "bun run server:format && bun run client:format && bun run types:format", - "db:up": "docker-compose -f docker-compose.dev.yml up -d", - "db:down": "docker-compose -f docker-compose.dev.yml down", + "db:up": "docker-compose -f docker-compose.yml up -d db", + "db:down": "docker-compose -f docker-compose.yml down db", "db:migration-generate": "bun run --cwd=\"packages/server\" drizzle:generate", "db:migration-migrate": "bun run --cwd=\"packages/server\" drizzle:migrate", "db:migration-push": "bun run --cwd=\"packages/server\" drizzle:push", @@ -47,8 +47,8 @@ "client:start": "bun run --cwd=\"packages/client\" start", "server:dev": "bun run --cwd=\"packages/server\" dev", "server:start": "bun run --cwd=\"packages/server\" start", - "all:up": "docker-compose -f docker-compose.dev.yml up", - "all:down": "docker-compose -f docker-compose.dev.yml down" + "all:up": "docker-compose -f docker-compose.yml up", + "all:down": "docker-compose -f docker-compose.yml down" }, "workspaces": [ "packages/*" From 282f100c917a0b9c524149d5ce7de5573b25e6cc Mon Sep 17 00:00:00 2001 From: Luzefiru Date: Mon, 25 Nov 2024 22:36:48 +0800 Subject: [PATCH 4/6] feat(ci): make tests run with isolated docker environment --- .husky/pre-push | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.husky/pre-push b/.husky/pre-push index 62b8bf4..e360988 100644 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1 +1 @@ -bun run test --run +bun run test diff --git a/package.json b/package.json index 6d2c515..68d683c 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "private": true, "scripts": { "prepare": "husky", - "test": "vitest", + "test": "docker-compose -f docker-compose.yml up -d db server && vitest --run && docker-compose -f docker-compose.yml down db server", "server:test": "bun run --cwd=\"packages/server\" test", "server:lint": "bun run --cwd=\"packages/server\" lint", "server:format": "bun run --cwd=\"packages/server\" format", From 514546b2d5f5fe833d37262988b8d2d334643c6a Mon Sep 17 00:00:00 2001 From: Luzefiru Date: Mon, 25 Nov 2024 22:50:52 +0800 Subject: [PATCH 5/6] fix(ci): don't typecast to number to prevent NaN on undefined values --- .env.example | 7 +++---- packages/server/src/services/config-service/index.ts | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index ddfb669..38ec7e6 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,6 @@ -POSTGRES_PASSWORD=happy123 -POSTGRES_USER=happy123 -POSTGRES_DB=happy123 -POSTGRES_HOST=localhost +POSTGRES_PASSWORD=example +POSTGRES_USER=postgres +POSTGRES_DB=postgres DB_PORT=5432 ADMINER_PORT=8080 JWT_SECRET=secret \ No newline at end of file diff --git a/packages/server/src/services/config-service/index.ts b/packages/server/src/services/config-service/index.ts index a195223..ab260b8 100644 --- a/packages/server/src/services/config-service/index.ts +++ b/packages/server/src/services/config-service/index.ts @@ -13,7 +13,7 @@ function loadEnvConfig() { DB_USER: process.env["POSTGRES_USER"] ?? "postgres", DB_DB: process.env["POSTGRES_DB"] ?? "postgres", DB_HOST: process.env["POSTGRES_HOST"] ?? "localhost", - DB_PORT: Number(process.env["DB_PORT"]) ?? 5432, + DB_PORT: process.env["DB_PORT"] ?? 5432, JWT_SECRET: process.env["JWT_SECRET"] ?? "secret", } From 65e23dde89ca1b3be8c4bb356b5bcbf30386aa6f Mon Sep 17 00:00:00 2001 From: Luzefiru Date: Tue, 26 Nov 2024 09:26:23 +0800 Subject: [PATCH 6/6] nit: remove redundant logging & add adminer to script --- package.json | 4 ++-- packages/server/src/use-cases/auth/auth.use-cases.ts | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 68d683c..ac692ec 100644 --- a/package.json +++ b/package.json @@ -36,8 +36,8 @@ "types:format": "bun run --cwd=\"packages/types\" format", "workspace:lint": "bun run server:lint && bun run client:lint && bun run types:lint", "workspace:format": "bun run server:format && bun run client:format && bun run types:format", - "db:up": "docker-compose -f docker-compose.yml up -d db", - "db:down": "docker-compose -f docker-compose.yml down db", + "db:up": "docker-compose -f docker-compose.yml up -d db adminer", + "db:down": "docker-compose -f docker-compose.yml down db adminer", "db:migration-generate": "bun run --cwd=\"packages/server\" drizzle:generate", "db:migration-migrate": "bun run --cwd=\"packages/server\" drizzle:migrate", "db:migration-push": "bun run --cwd=\"packages/server\" drizzle:push", diff --git a/packages/server/src/use-cases/auth/auth.use-cases.ts b/packages/server/src/use-cases/auth/auth.use-cases.ts index 637c056..ea0fc2c 100644 --- a/packages/server/src/use-cases/auth/auth.use-cases.ts +++ b/packages/server/src/use-cases/auth/auth.use-cases.ts @@ -53,7 +53,6 @@ export const AuthUseCases: IAuthUseCases = { return response } catch (e) { if (e instanceof Error) { - console.log(e) throw new HTTPException(HttpStatusEnum.INTERNAL_SERVER_ERROR, { message: e.message }) }