feat(server): restructure Pomodoro server into modular components

- move server logic to cmd/server/main.go
- create packages for websocket, pomodoro and broadcast handling
- define models for messages
- remove old GoTomato.go file
- update README

🤖
This commit is contained in:
Sebastian Mark 2024-10-19 11:47:56 +02:00
parent 6d73711341
commit c59f737eb7
10 changed files with 224 additions and 157 deletions

14
pkg/models/types.go Normal file
View file

@ -0,0 +1,14 @@
package models
// BroadcastMessage represents the data sent to the client via WebSocket.
type BroadcastMessage struct {
Mode string `json:"mode"` // "Work", "ShortBreak", or "LongBreak"
Session int `json:"session"` // Current session number
MaxSession int `json:"max_session"` // Total number of sessions
TimeLeft int `json:"time_left"` // Remaining time in seconds
}
// ClientCommand represents a command from the client (start/stop).
type ClientCommand struct {
Command string `json:"command"`
}