forked from syntaxbullet/aurorabot
1.2 KiB
1.2 KiB
Context & Goal
The exam command currently contains a lot of business logic, including reward calculations, timer management, and complex database transactions. Moving this logic to a dedicated ExamService will improve testability, maintainability, and keep the command file focused on user interaction.
Dependencies
- None
Affected Files
shared/modules/economy/exam.service.ts: New file for the exam logic.bot/commands/economy/exam.ts: Refactor to use the new service.
Technical Constraints & Strategy
- Implementation: Create an
ExamServicethat handlesgetExamStatus,takeExam, andregisterForExam. - The command should only handle user input and formatting the response embeds based on the service's result.
- Ensure the Drizzle transactions are correctly handled within the service.
Definition of Done (Binary)
ExamServiceimplemented with methods for all exam-related operations.bot/commands/economy/exam.tsrefactored to use the service.- Logic is covered by unit tests in a new test file.
- Manual verification shows the exam command still works as expected.
New Test Files
shared/modules/economy/exam.service.test.ts: Unit tests for reward calculations and state transitions.