mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-06 07:54:22 +00:00
Save default settings with workspace creation
This commit is contained in:
@@ -54,6 +54,22 @@ func CreateWorkspace(db *db.DB) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
defaultSettings := &models.WorkspaceSettings{
|
||||
WorkspaceID: workspace.ID,
|
||||
Settings: models.UserSettings{
|
||||
Theme: "light",
|
||||
AutoSave: false,
|
||||
GitEnabled: false,
|
||||
GitAutoCommit: false,
|
||||
GitCommitMsgTemplate: "${action} ${filename}",
|
||||
},
|
||||
}
|
||||
|
||||
if err := db.SaveWorkspaceSettings(defaultSettings); err != nil {
|
||||
http.Error(w, "Failed to initialize workspace settings", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
respondJSON(w, workspace)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
func (db *DB) CreateWorkspace(workspace *models.Workspace) error {
|
||||
result, err := db.Exec("INSERT INTO workspaces (user_id, name) VALUES (?, ?, ?)",
|
||||
result, err := db.Exec("INSERT INTO workspaces (user_id, name) VALUES (?, ?)",
|
||||
workspace.UserID, workspace.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user