Fold the Room into RoomService, so the Room's report type needs no framework-free file #393

Closed
opened 2026-10-13 15:31:18 +00:00 by root · 9 comments
root commented 2026-10-13 15:31:18 +00:00 (Migrated from gitlab.core-project.space)

Parent

#355

What to build

Fold the API's Room (apps/api/src/room/room.ts) into RoomService, so room/ holds its module, controller and service and no separate framework-free Room class.

Why: Guest history put the DecidedGame type, the record a Room reports once its Game is decided, in games/games.service.ts. room.ts imports it, and under verbatimModuleSyntax that type-only import still loads the service (Nest, drizzle) at runtime, breaking API rule 1 ("room.ts stays framework-free"). The owner chose to remove the split rather than move the type.

  • The per-Room state and its rules (seating by Guest, Moves, Offers, nudges, restarts, the decided-Game report) live in the service, keyed by Room code; behaviour is unchanged.
  • The Room's tests (room.test.ts, room-play, room-offer, room-offer-unanswered, room-nudge, room-decided, room-changes) are kept, going through RoomService's public methods with room.fixtures.ts; no coverage is lost.
  • apps/api/CODING_STANDARDS.md (layout paragraph, rules 1, 3 and 6) is rewritten to match, at the owner's request in this merge request. The lint config's room.ts framework-free entry is updated accordingly.

Seam: RoomService's public methods with room.fixtures.ts, unit; the RPC wire stays green unchanged.

Acceptance criteria

  • apps/api/src/room/room.ts no longer exists; its behaviour lives in RoomService.
  • Every existing Room test still passes, rewritten to go through RoomService where it built a Room directly; no test is dropped without an equivalent.
  • The RPC integration tests and e2e pass unchanged.
  • apps/api/CODING_STANDARDS.md and the lint config describe the new layout; no stale mention of a framework-free room.ts remains.
## Parent #355 ## What to build Fold the API's `Room` (`apps/api/src/room/room.ts`) into `RoomService`, so `room/` holds its module, controller and service and no separate framework-free `Room` class. Why: Guest history put the `DecidedGame` type, the record a **Room** reports once its **Game** is decided, in `games/games.service.ts`. `room.ts` imports it, and under `verbatimModuleSyntax` that type-only import still loads the service (Nest, drizzle) at runtime, breaking API rule 1 ("`room.ts` stays framework-free"). The owner chose to remove the split rather than move the type. - The per-**Room** state and its rules (seating by **Guest**, **Moves**, **Offers**, nudges, restarts, the decided-**Game** report) live in the service, keyed by **Room code**; behaviour is unchanged. - The **Room**'s tests (`room.test.ts`, `room-play`, `room-offer`, `room-offer-unanswered`, `room-nudge`, `room-decided`, `room-changes`) are kept, going through `RoomService`'s public methods with `room.fixtures.ts`; no coverage is lost. - `apps/api/CODING_STANDARDS.md` (layout paragraph, rules 1, 3 and 6) is rewritten to match, at the owner's request in this merge request. The lint config's `room.ts` framework-free entry is updated accordingly. Seam: `RoomService`'s public methods with `room.fixtures.ts`, unit; the RPC wire stays green unchanged. ## Acceptance criteria - [ ] `apps/api/src/room/room.ts` no longer exists; its behaviour lives in `RoomService`. - [ ] Every existing Room test still passes, rewritten to go through `RoomService` where it built a `Room` directly; no test is dropped without an equivalent. - [ ] The RPC integration tests and e2e pass unchanged. - [ ] `apps/api/CODING_STANDARDS.md` and the lint config describe the new layout; no stale mention of a framework-free `room.ts` remains.
root commented 2026-10-13 15:31:31 +00:00 (Migrated from gitlab.core-project.space)

marked this issue as related to #355

marked this issue as related to #355
root commented 2026-10-13 15:31:32 +00:00 (Migrated from gitlab.core-project.space)

marked this issue as related to #374

marked this issue as related to #374
root commented 2026-10-13 15:31:34 +00:00 (Migrated from gitlab.core-project.space)

mentioned in merge request !515

mentioned in merge request !515
root commented 2026-10-13 15:43:24 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit d6bf989952

mentioned in commit d6bf989952fa0d80349cdfa2ed03c9105f0619aa
root commented 2026-10-13 15:43:24 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit 448e4b873d

mentioned in commit 448e4b873d3ad42aafd059f82762a1e37d5f9c23
root commented 2026-10-14 07:52:25 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit 6e466f5e70

mentioned in commit 6e466f5e708387998bc7c5dea83fc9bd2218aab7
root commented 2026-10-14 07:52:25 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit 458bb86dc5

mentioned in commit 458bb86dc51d23cd429e9d90d9588ca69315bd8d
root commented 2026-10-14 09:31:44 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit 869a3c86ad

mentioned in commit 869a3c86ad091ed54d1a1cc121219b2c5fea743f
root commented 2026-10-14 09:31:45 +00:00 (Migrated from gitlab.core-project.space)

mentioned in commit c5b1397384

mentioned in commit c5b139738432425abb7c027636110a64507fcd39
root (Migrated from gitlab.core-project.space) closed this issue 2026-10-14 09:36:59 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
amaurycoudr/chess-project#393
No description provided.