(req: HTTPRequestLike, res: HTTPResponseLike)
| 99 | |
| 100 | @Post("/api/pomodoro/pause") |
| 101 | async pausePomodoro(req: HTTPRequestLike, res: HTTPResponseLike): Promise<void> { |
| 102 | try { |
| 103 | const currentState = this.plugin.pomodoroService.getState(); |
| 104 | if (!currentState.isRunning || !currentState.currentSession) { |
| 105 | this.sendResponse( |
| 106 | res, |
| 107 | 400, |
| 108 | this.errorResponse("No running pomodoro session to pause") |
| 109 | ); |
| 110 | return; |
| 111 | } |
| 112 | |
| 113 | await this.plugin.pomodoroService.pausePomodoro(); |
| 114 | |
| 115 | const newState = this.plugin.pomodoroService.getState(); |
| 116 | |
| 117 | this.sendResponse( |
| 118 | res, |
| 119 | 200, |
| 120 | this.successResponse({ |
| 121 | timeRemaining: newState.timeRemaining, |
| 122 | message: "Pomodoro session paused", |
| 123 | }) |
| 124 | ); |
| 125 | } catch (error: unknown) { |
| 126 | this.sendResponse(res, 400, this.errorResponse(this.getErrorMessage(error))); |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | @Post("/api/pomodoro/resume") |
| 131 | async resumePomodoro(req: HTTPRequestLike, res: HTTPResponseLike): Promise<void> { |
nothing calls this directly
no test coverage detected