mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-07 00:14:25 +00:00
Add theme to user preferences
This commit is contained in:
@@ -25,6 +25,7 @@ type User struct {
|
||||
DisplayName string `json:"displayName" db:"display_name"`
|
||||
PasswordHash string `json:"-" db:"password_hash"`
|
||||
Role UserRole `json:"role" db:"role" validate:"required,oneof=admin editor viewer"`
|
||||
Theme string `json:"theme" db:"theme" validate:"required,oneof=light dark"`
|
||||
CreatedAt time.Time `json:"createdAt" db:"created_at,default"`
|
||||
LastWorkspaceID int `json:"lastWorkspaceId" db:"last_workspace_id"`
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ type Workspace struct {
|
||||
LastOpenedFilePath string `json:"lastOpenedFilePath" db:"last_opened_file_path"`
|
||||
|
||||
// Integrated settings
|
||||
Theme string `json:"theme" db:"theme" validate:"oneof=light dark"`
|
||||
Theme string `json:"theme" db:"theme" validate:"required,oneof=light dark"`
|
||||
AutoSave bool `json:"autoSave" db:"auto_save"`
|
||||
ShowHiddenFiles bool `json:"showHiddenFiles" db:"show_hidden_files"`
|
||||
GitEnabled bool `json:"gitEnabled" db:"git_enabled"`
|
||||
@@ -40,7 +40,7 @@ func (w *Workspace) ValidateGitSettings() error {
|
||||
func (w *Workspace) SetDefaultSettings() {
|
||||
|
||||
if w.Theme == "" {
|
||||
w.Theme = "light"
|
||||
w.Theme = "dark"
|
||||
}
|
||||
|
||||
w.AutoSave = w.AutoSave || false
|
||||
|
||||
Reference in New Issue
Block a user