2.8 KiB
2.8 KiB
Task 4: Health and demo-character API report
RED
-
Re-read every Markdown document below
docs/and inspectedcombat-screen.png,hunting-screen.png, andworld-travel-screen.pngbefore implementation. -
Added focused health and character-service tests, then ran:
npm test --workspace=@ashen-realms/api -- health.controller.spec.ts characters.service.spec.ts --runInBand -
Observed the expected RED result: both suites failed because
HealthControllerandCharactersServicedid not exist.
GREEN
- Replaced the scaffold root controller/service with
HealthModuleandCharactersModule. GET /api/healthreturns{ status: 'ok' }without a database query.GET /api/characters/meobtains the fixed demo ID server-side, loadscurrentLocation, mapsbaseHptomaxHpandbaseAttacktoattack, and raisesNotFoundExceptionwhen the seed is absent.- Preserved the existing tested
configureApplication()global-prefix seam and enabled Nest shutdown hooks inmain.tswithout repeating prefix configuration. - Updated the E2E assertion from the retired hello-world root route to
/api/health; it replaces both database-dependent modules so the health test remains database independent.
Verification
| Command | Result |
|---|---|
npm test --workspace=@ashen-realms/api -- health.controller.spec.ts characters.service.spec.ts --runInBand |
PASS: 2 suites, 3 tests |
npm run test:e2e --workspace=@ashen-realms/api -- --runInBand |
PASS: 1 suite, 2 tests |
npm test --workspace=@ashen-realms/api -- --runInBand |
PASS: 5 suites, 9 tests |
npm run build:api |
PASS |
apps/api/node_modules/.bin/prettier.cmd --check <task files> |
PASS |
git diff --check |
PASS |
npx prettier did not resolve the workspace-local executable in this environment; the checked-in workspace binary at apps/api/node_modules/.bin/prettier.cmd was used for the formatting check.
Files
- Added
apps/api/src/health/*and character controller/service/module plus unit tests. - Updated
apps/api/src/app.module.ts,apps/api/src/main.ts, andapps/api/test/app.e2e-spec.ts. - Removed
apps/api/src/app.controller.ts,app.controller.spec.ts, andapp.service.ts.
Self-review and concerns
- Confirmed the repository query loads only the required current-location relation and response does not expose persistence-only base-stat names.
- Confirmed the missing seed path is tested as a 404-producing Nest exception.
- Confirmed
/remains a 404 while/api/healthis available through the existing global prefix. - No task-specific concerns remain. Pre-existing untracked
apps/web/public/images/anddocs/references/Ashen_Realms_Visual_Asset_Style_Guide_V1.mdare intentionally excluded.
Commit
- Pending:
feat: expose health and demo character APIs