fix(dakao): hide started matches from schedule

This commit is contained in:
dahyeon committed 2026-07-25 01:01:57 -07:00
1 parent a4215f86fb
commit ca786fd80a
3 files changed
+96

No files matched your search

+67
View File
@@ -0,0 +1,67 @@
# Spec: Dakao Upcoming Internal Match List
## Objective
When a user sends `!내전 일정`, return only recruiting matches whose scheduled
start is not earlier than the command processing time. Matches that have already
started must not consume the ten-result query limit or appear in the response.
## Approved Product Decisions
- Capture the command processing time once before querying matches.
- Exclude `scheduledAt < now`.
- Include `scheduledAt === now` and future matches.
- Apply the boundary only to the Dakao `!내전 일정` command.
- Preserve the existing recruiting status, result limit, ordering, formatting,
short-code generation, and short-link behavior.
## Commands
- Focused test:
`pnpm --filter api exec jest src/modules/dakao/handlers/match-list.handler.spec.ts --runInBand`
- API lint:
`pnpm --filter api exec eslint "{src,apps,libs,test}/**/*.ts" --max-warnings=0`
- API build: `pnpm --filter api build`
## Project Structure
- `apps/api/src/modules/dakao/handlers/match-list.handler.ts` owns the command
query and response formatting.
- `apps/api/src/modules/dakao/handlers/match-list.handler.spec.ts` verifies the
command boundary and presentation.
- `apps/api/src/modules/match/match.service.ts` translates `scheduledFrom` into a
MongoDB `$gte` filter.
## Code Style
Pass the captured boundary through the existing list contract:
```ts
const scheduledFrom = new Date();
await matchService.list({ communityId, scheduledFrom });
```
## Testing Strategy
- Freeze the system clock in the handler unit test.
- Assert that the exact frozen time is passed as `scheduledFrom`.
- Rely on the existing `MatchService` test that verifies `scheduledFrom` becomes
`{ scheduledAt: { $gte: scheduledFrom } }`.
- Run the focused handler test, full API lint, and API build.
## Boundaries
- Always: filter before applying the result limit and use one captured time.
- Ask first: change ordering, statuses, limit, or response wording.
- Never: hide the requirement with an ESLint exception or filter only after the
limited database query.
## Success Criteria
- A match scheduled before command processing time is not queried.
- A match scheduled exactly at command processing time remains eligible.
- Existing command formatting and link tests continue to pass.
## Open Questions
None.