feat: align docs with code, finish_place, registered status, UI filters, tests, CI
Some checks failed
CI / build-and-test (pull_request) Has been cancelled
Some checks failed
CI / build-and-test (pull_request) Has been cancelled
- Add PLAN.md and sync backend docs, .env.example, API doc (404 details) - Document mock DB and PORT/API_PORT in docs/backend.md; README monorepo + frontend/.env.example - Migration 002: finish_place column, status registered; mapper and mock DB updated - Frontend: registered status, finishPlace, calendar year/month filters, pace sparkline - Extract createApp for tests; supertest + tsx; GitHub Actions CI Made-with: Cursor
This commit is contained in:
17
backend/src/app.ts
Normal file
17
backend/src/app.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import express from "express";
|
||||
import cors from "cors";
|
||||
import { config } from "./config";
|
||||
import healthRouter from "./routes/health";
|
||||
import racesRouter from "./routes/races";
|
||||
|
||||
export function createApp(): express.Express {
|
||||
const app = express();
|
||||
|
||||
app.use(cors({ origin: config.corsOrigin, methods: ["GET", "POST", "PATCH", "DELETE"] }));
|
||||
app.use(express.json());
|
||||
|
||||
app.use(healthRouter);
|
||||
app.use(racesRouter);
|
||||
|
||||
return app;
|
||||
}
|
||||
@@ -29,6 +29,7 @@ function mockRowFromInsert(sql: string, params: unknown[]): RaceRow {
|
||||
bib_pickup: null,
|
||||
bib_number: null,
|
||||
finish_time: null,
|
||||
finish_place: null,
|
||||
notes: null,
|
||||
created_at: now,
|
||||
updated_at: null,
|
||||
@@ -51,6 +52,7 @@ function mockRowFromInsert(sql: string, params: unknown[]): RaceRow {
|
||||
bib_pickup: row.bib_pickup != null ? String(row.bib_pickup) : null,
|
||||
bib_number: row.bib_number != null ? String(row.bib_number) : null,
|
||||
finish_time: row.finish_time != null ? String(row.finish_time) : null,
|
||||
finish_place: row.finish_place != null ? String(row.finish_place) : null,
|
||||
notes: row.notes != null ? String(row.notes) : null,
|
||||
created_at: now,
|
||||
updated_at: null,
|
||||
|
||||
@@ -1,16 +1,7 @@
|
||||
import express from "express";
|
||||
import cors from "cors";
|
||||
import { config } from "./config";
|
||||
import healthRouter from "./routes/health";
|
||||
import racesRouter from "./routes/races";
|
||||
import { createApp } from "./app";
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(cors({ origin: config.corsOrigin, methods: ["GET", "POST", "PATCH", "DELETE"] }));
|
||||
app.use(express.json());
|
||||
|
||||
app.use(healthRouter);
|
||||
app.use(racesRouter);
|
||||
const app = createApp();
|
||||
|
||||
app.listen(config.apiPort, () => {
|
||||
console.log(`[api] Listening on http://localhost:${config.apiPort}`);
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface RaceRow {
|
||||
bib_pickup: string | null;
|
||||
bib_number: string | null;
|
||||
finish_time: string | null;
|
||||
finish_place: string | null;
|
||||
notes: string | null;
|
||||
created_at: string;
|
||||
updated_at: string | null;
|
||||
@@ -29,6 +30,7 @@ export interface RaceDto {
|
||||
bibPickup: string | null;
|
||||
bibNumber: string | null;
|
||||
finishTime: string | null;
|
||||
finishPlace: string | null;
|
||||
notes: string | null;
|
||||
createdAt: string;
|
||||
updatedAt: string | null;
|
||||
@@ -48,6 +50,7 @@ export function rowToDto(row: RaceRow): RaceDto {
|
||||
bibPickup: row.bib_pickup,
|
||||
bibNumber: row.bib_number,
|
||||
finishTime: row.finish_time,
|
||||
finishPlace: row.finish_place,
|
||||
notes: row.notes,
|
||||
createdAt: row.created_at,
|
||||
updatedAt: row.updated_at,
|
||||
@@ -66,6 +69,7 @@ const FIELD_MAP: Record<string, string> = {
|
||||
bibPickup: "bib_pickup",
|
||||
bibNumber: "bib_number",
|
||||
finishTime: "finish_time",
|
||||
finishPlace: "finish_place",
|
||||
notes: "notes",
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user