Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
*
!apps/*
!packages/*
*
!apps/
!apps/**
!lib/
!lib/**
!package.json
!pnpm-lock.yaml
!pnpm-workspace.yaml
!pnpm-workspace.yaml
20 changes: 5 additions & 15 deletions .github/workflows/backend-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,9 @@ jobs:
run: |
pnpm install

- name: Prisma generate
run: |
cd apps/backend
pnpm prisma:generate

- name: Build
run: |
cd apps/backend
cd apps/backend
pnpm build

- name: Test
Expand Down Expand Up @@ -110,20 +105,15 @@ jobs:
cat ".env.local"
echo "----------------------"

- name: Prisma generate
run: |
cd apps/backend
pnpm prisma:generate

- name: Run migrations
run: |
cd apps/backend
pnpm prisma:migrate:deploy
cd apps/database
pnpm migrate:deploy

- name: Run seeds
run: |
cd apps/backend
pnpm prisma:seed
cd apps/database
pnpm seed

- name: Test e2e
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

- uses: pnpm/action-setup@v3

- name: Check JS format
- name: Check Biome
run: |
pnpm install
pnpm format:check
pnpm biome:check
11 changes: 0 additions & 11 deletions .prettierignore

This file was deleted.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

```shell
pnpm i

# Start PostgreSQL and Redis for development
pnpm docker:up:dev

pnpm dev

cd apps/backend
Expand Down
8 changes: 0 additions & 8 deletions apps/backend/.env.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ DB_HOST=localhost
DB_PORT=5432
DB_SCHEMA=public

# This was inserted by `prisma init`:
# Environment variables declared in this file are automatically made available to Prisma.
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema

# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings


DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${DB_HOST}:${DB_PORT}/${POSTGRES_DB}?schema=${DB_SCHEMA}"

# redis
Expand Down
1 change: 0 additions & 1 deletion apps/backend/.eslintignore

This file was deleted.

68 changes: 0 additions & 68 deletions apps/backend/.eslintrc.js

This file was deleted.

33 changes: 0 additions & 33 deletions apps/backend/e2e/tests/import.e2e-spec.ts

This file was deleted.

4 changes: 2 additions & 2 deletions apps/backend/e2e/tests/platform.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
} from "e2e/utils/generate-test-urls";
import { cacheModuleConfig } from "src/config/cache-module.config";
import { configModuleConfig } from "src/config/config-module.config";
import { DatabaseModule } from "src/modules/database/database.module";
import { PlatformModule } from "src/modules/platform/platform.module";
import { PrismaModule } from "src/modules/prisma/prisma.module";

describe("Platform Module (e2e)", () => {
let app: INestApplication;
Expand All @@ -22,7 +22,7 @@ describe("Platform Module (e2e)", () => {
imports: [
CacheModule.register(cacheModuleConfig),
ConfigModule.forRoot(configModuleConfig),
PrismaModule,
DatabaseModule,
PlatformModule,
],
}).compile();
Expand Down
4 changes: 2 additions & 2 deletions apps/backend/e2e/tests/stop.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "e2e/utils/generate-test-urls";
import { cacheModuleConfig } from "src/config/cache-module.config";
import { configModuleConfig } from "src/config/config-module.config";
import { PrismaModule } from "src/modules/prisma/prisma.module";
import { DatabaseModule } from "src/modules/database/database.module";
import { StopModule } from "src/modules/stop/stop.module";

describe("Stop Module (e2e)", () => {
Expand All @@ -21,7 +21,7 @@ describe("Stop Module (e2e)", () => {
imports: [
CacheModule.register(cacheModuleConfig),
ConfigModule.forRoot(configModuleConfig),
PrismaModule,
DatabaseModule,
StopModule,
],
}).compile();
Expand Down
101 changes: 37 additions & 64 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,103 +2,76 @@
"name": "@metro-now/backend",
"scripts": {
"typegen": "ts-node ./src/scripts/generate-types.ts",
"prebuild": "rimraf dist && pnpm prisma:generate && pnpm typegen",
"prebuild": "rimraf dist && pnpm --filter @metro-now/shared build && pnpm --filter @metro-now/database build && pnpm typegen",
"build": "nest build",
"start": "nest start",
"dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\"",
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"types:check": "tsc --incremental --noEmit",
"test": "jest",
"lint": "biome check --config-path ../../biome.json ../../apps/backend/src ../../apps/backend/package.json ../../apps/backend/tsconfig.json",
"lint:fix": "biome check --config-path ../../biome.json ../../apps/backend/src ../../apps/backend/package.json ../../apps/backend/tsconfig.json --write",
"format": "biome format --config-path ../../biome.json ../../apps/backend/src ../../apps/backend/package.json ../../apps/backend/tsconfig.json --write",
"format:check": "biome check --config-path ../../biome.json ../../apps/backend/src ../../apps/backend/package.json ../../apps/backend/tsconfig.json",
"types:check": "pnpm --filter @metro-now/shared build && pnpm --filter @metro-now/database build && tsc --incremental --noEmit",
"test": "pnpm --filter @metro-now/shared build && pnpm --filter @metro-now/database build && jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./e2e/jest-e2e.json",
"prisma:studio": "dotenv -e .env.local -- prisma studio",
"prisma:generate": "prisma generate",
"prisma:migrate:create": "dotenv -e .env.local -- prisma migrate dev",
"prisma:migrate:deploy": "dotenv -e .env.local -- prisma migrate deploy",
"prisma:push": "dotenv -e .env.local -- prisma db push",
"prisma:seed": "prisma db seed"
"test:e2e": "jest --config ./e2e/jest-e2e.json"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

test:e2e should prepare workspace deps too.

Line 16 now builds @metro-now/shared and @metro-now/database before Jest, but Line 20 still skips that step. After a clean checkout—or after changing either workspace package—pnpm test:e2e can still run against missing or stale output even though pnpm test passes.

🔁 Suggested fix
-        "test:e2e": "jest --config ./e2e/jest-e2e.json"
+        "test:e2e": "pnpm --filter `@metro-now/shared` build && pnpm --filter `@metro-now/database` build && jest --config ./e2e/jest-e2e.json"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"test:e2e": "jest --config ./e2e/jest-e2e.json"
"test:e2e": "pnpm --filter `@metro-now/shared` build && pnpm --filter `@metro-now/database` build && jest --config ./e2e/jest-e2e.json"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/backend/package.json` at line 20, The test:e2e npm script is missing the
workspace-prebuild step that ensures `@metro-now/shared` and `@metro-now/database`
are built; update the "test:e2e" script in package.json so it runs the same
prebuild command used by the regular test flow (build the workspace packages
`@metro-now/shared` and `@metro-now/database`) before invoking Jest (i.e., prepend
or incorporate the workspace build step that exists for the other test script so
test:e2e always builds those packages first).

},
"dependencies": {
"@apollo/server": "^4.11.3",
"@fast-csv/parse": "^5.0.2",
"@keyv/redis": "^4.3.3",
"@nestjs/apollo": "^13.0.4",
"@nestjs/cache-manager": "^3.0.1",
"@nestjs/common": "^11.0.13",
"@nestjs/config": "^4.0.2",
"@nestjs/core": "^11.0.13",
"@nestjs/graphql": "^13.0.4",
"@nestjs/platform-express": "^11.0.13",
"@nestjs/schedule": "^5.0.1",
"@nestjs/swagger": "^11.1.1",
"@prisma/client": "5.20.0",
"cache-manager": "^6.4.2",
"@apollo/server": "^5.5.0",
"@as-integrations/express5": "^1.1.2",
"@keyv/redis": "^5.1.6",
"@metro-now/database": "workspace:*",
"@metro-now/shared": "workspace:*",
"@nestjs/apollo": "^13.2.4",
"@nestjs/cache-manager": "^3.1.0",
"@nestjs/common": "^11.1.17",
"@nestjs/config": "^4.0.3",
"@nestjs/core": "^11.1.17",
"@nestjs/graphql": "^13.2.4",
"@nestjs/platform-express": "^11.1.17",
"@nestjs/swagger": "^11.2.6",
"cacheable": "^2.3.4",
"cache-manager": "^7.2.8",
"dataloader": "^2.2.3",
"graphql": "^16.10.0",
"radash": "^12.1.0",
"graphql": "^16.13.2",
"keyv": "^5.6.0",
"radash": "^12.1.1",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.2",
"ts-morph": "^25.0.1",
"unzipper": "^0.12.3",
"zod": "^3.24.2"
},
"devDependencies": {
"@nestjs/cli": "^11.0.6",
"@nestjs/schematics": "^11.0.4",
"@nestjs/testing": "^11.0.13",
"@types/express": "^5.0.1",
"@nestjs/cli": "^11.0.16",
"@nestjs/schematics": "^11.0.9",
"@nestjs/testing": "^11.1.17",
"@types/express": "^5.0.6",
"@types/jest": "^29.5.14",
"@types/node": "^22.14.0",
"@types/supertest": "^6.0.3",
"@types/unzipper": "^0.10.11",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.10.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.2.6",
"jest": "^29.7.0",
"prettier": "^3.5.3",
"rimraf": "^6.0.1",
"rimraf": "^6.1.3",
"source-map-support": "^0.5.21",
"supertest": "^7.1.0",
"ts-jest": "^29.3.1",
"ts-loader": "^9.5.2",
"supertest": "^7.2.2",
"ts-jest": "^29.4.6",
"ts-loader": "^9.5.4",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.8.3"
},
"optionalDependencies": {
"dotenv-cli": "^8.0.0",
"prisma": "^5.20.0"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": "./",
"modulePaths": [
"<rootDir>"
],
"modulePaths": ["<rootDir>"],
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"collectCoverageFrom": ["**/*.(t|j)s"],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

In Jest 29 / micromatch glob syntax, does collectCoverageFrom: ["/*.(t|j)s"]match both.tsand.jsfiles, or should it be written as["/.{ts,js}"](or["**/.+(ts|js)"]) instead?

💡 Result:

No, collectCoverageFrom: ["/.(t|j)s"] does NOT match both .ts and .js files in Jest 29 using micromatch glob syntax. The pattern .(t|j)s attempts to use extglob syntax @(t|j) or +(t|j) for alternatives, but the plain (t|j) without a preceding extglob quantifier (?+!@) is treated as a literal group or regex character class, not alternatives. It would match files ending with . followed by 't' or '|' or 'j' then 's' (like .ts, .|s, .js), but not properly .ts and .js as intended. Official Jest docs show the correct brace syntax: /.{js,jsx} or /.[jt]s?(x) for JS/TS files [1,3,4]. Micromatch supports brace expansion {ts,js} which expands to /.ts or /.js [6,7,13]. Use ["/.{ts,js}"] or ["/.+(ts|js)"] (extglob) or ["/.[jt]s"] instead. To match exactly .ts and .js: /*.{ts,js} is recommended and used in Jest examples.

Citations:


Fix the coverage glob pattern to properly match TypeScript and JavaScript files.

The pattern **/*.(t|j)s uses parentheses which are treated literally in micromatch glob syntax, not as alternatives. This will cause Jest to silently miss most source files during coverage collection.

Corrected pattern
-        "collectCoverageFrom": ["**/*.(t|j)s"],
+        "collectCoverageFrom": ["**/*.{ts,js}"],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"collectCoverageFrom": ["**/*.(t|j)s"],
"collectCoverageFrom": ["**/*.{ts,js}"],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/backend/package.json` at line 73, The Jest coverage glob under the
"collectCoverageFrom" key currently uses the literal pattern "**/*.(t|j)s" which
doesn't match files; update the value for "collectCoverageFrom" to a proper glob
that matches .ts and .js files (for example use a brace expansion like
"**/*.{ts,js}") so Jest will collect coverage from TypeScript and JavaScript
sources; locate the string "collectCoverageFrom" and replace the pattern
"**/*.(t|j)s" with the corrected pattern.

"coverageDirectory": "../coverage",
"testEnvironment": "node"
},
"prisma": {
"seed": "dotenv -e .env.local -- ts-node prisma/seed.ts"
}
}
11 changes: 0 additions & 11 deletions apps/backend/prisma/migrations/20240702100916_init/migration.sql

This file was deleted.

Loading
Loading