From c20d36d2d2dd5cb9808978858d906f33be8d3c4f Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Sat, 26 Oct 2024 09:20:29 +0200 Subject: [PATCH] break: rename `GoTomatoPomodoroConfig` -> `PomodoroConfig` --- internal/shared/configDefaults.go | 2 +- internal/websocket/client_commands.go | 2 +- pkg/models/client.go | 6 +++--- pkg/models/config.go | 2 +- pkg/models/server.go | 14 +++++++------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/internal/shared/configDefaults.go b/internal/shared/configDefaults.go index b4b82ff..f274555 100644 --- a/internal/shared/configDefaults.go +++ b/internal/shared/configDefaults.go @@ -9,7 +9,7 @@ var DefaultServerConfig = models.GoTomatoServerConfig{ ListenPort: 8080, } -var DefaultPomodoroConfig = models.GoTomatoPomodoroConfig{ +var DefaultPomodoroConfig = models.PomodoroConfig{ Work: 25 * 60, ShortBreak: 5 * 60, LongBreak: 15 * 60, diff --git a/internal/websocket/client_commands.go b/internal/websocket/client_commands.go index d5c953b..cafcd67 100644 --- a/internal/websocket/client_commands.go +++ b/internal/websocket/client_commands.go @@ -49,7 +49,7 @@ func handleClientCommands(ws *websocket.Conn) { } case "updateSettings": if !pomodoro.IsPomodoroOngoing() { - if clientCommand.Settings != (models.GoTomatoPomodoroConfig{}) { + if clientCommand.Settings != (models.PomodoroConfig{}) { shared.Message.Settings = clientCommand.Settings shared.Message.TimeLeft = clientCommand.Settings.Work } diff --git a/pkg/models/client.go b/pkg/models/client.go index 34b6455..8116d8b 100644 --- a/pkg/models/client.go +++ b/pkg/models/client.go @@ -8,9 +8,9 @@ import ( // ClientCommand represents a command from the client (start/stop). type ClientCommand struct { - Command string `json:"command"` // comman send to the server - Password string `json:"password"` // pomodoro control password - Settings GoTomatoPomodoroConfig `json:"settings"` // pomodoro config + Command string `json:"command"` // comman send to the server + Password string `json:"password"` // pomodoro control password + Settings PomodoroConfig `json:"settings"` // pomodoro config } type Client struct { diff --git a/pkg/models/config.go b/pkg/models/config.go index af51d23..b9d66c7 100644 --- a/pkg/models/config.go +++ b/pkg/models/config.go @@ -1,6 +1,6 @@ package models -type GoTomatoPomodoroConfig struct { +type PomodoroConfig struct { Work int `json:"work"` // Length of work sessions in seconds ShortBreak int `json:"shortBreak"` // Length of short break in seconds LongBreak int `json:"longBreak"` // Length if ling break in seconds diff --git a/pkg/models/server.go b/pkg/models/server.go index a432499..092c557 100644 --- a/pkg/models/server.go +++ b/pkg/models/server.go @@ -2,11 +2,11 @@ package models // ServerMessage represents the data sent to the client via WebSocket. type ServerMessage struct { - Mode string `json:"mode"` // "Idle", "Work", "ShortBreak", "LongBreak" or "End" - Settings GoTomatoPomodoroConfig `json:"settings"` // The currrent pomodoro settings - Session int `json:"session"` // Current session number - TimeLeft int `json:"time_left"` // Remaining time in seconds - Ongoing bool `json:"ongoing"` // Ongoing pomodoro - Paused bool `json:"paused"` // Is timer paused - ProtocolVersion string `json:"version"` // Version of the server + Mode string `json:"mode"` // "Idle", "Work", "ShortBreak", "LongBreak" or "End" + Settings PomodoroConfig `json:"settings"` // The currrent pomodoro settings + Session int `json:"session"` // Current session number + TimeLeft int `json:"time_left"` // Remaining time in seconds + Ongoing bool `json:"ongoing"` // Ongoing pomodoro + Paused bool `json:"paused"` // Is timer paused + ProtocolVersion string `json:"version"` // Version of the server }