(req: HTTPRequestLike, res: HTTPResponseLike)
| 72 | |
| 73 | @Post("/api/pomodoro/stop") |
| 74 | async stopPomodoro(req: HTTPRequestLike, res: HTTPResponseLike): Promise<void> { |
| 75 | try { |
| 76 | const currentState = this.plugin.pomodoroService.getState(); |
| 77 | if (!currentState.currentSession) { |
| 78 | this.sendResponse( |
| 79 | res, |
| 80 | 400, |
| 81 | this.errorResponse("No active pomodoro session to stop") |
| 82 | ); |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | await this.plugin.pomodoroService.stopPomodoro(); |
| 87 | |
| 88 | this.sendResponse( |
| 89 | res, |
| 90 | 200, |
| 91 | this.successResponse({ |
| 92 | message: "Pomodoro session stopped and reset", |
| 93 | }) |
| 94 | ); |
| 95 | } catch (error: unknown) { |
| 96 | this.sendResponse(res, 400, this.errorResponse(this.getErrorMessage(error))); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | @Post("/api/pomodoro/pause") |
| 101 | async pausePomodoro(req: HTTPRequestLike, res: HTTPResponseLike): Promise<void> { |
nothing calls this directly
no test coverage detected