mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-07 00:14:25 +00:00
Update documentation
This commit is contained in:
@@ -8,14 +8,17 @@ import (
|
||||
|
||||
var validate = validator.New()
|
||||
|
||||
// UserRole represents the role of a user in the system
|
||||
type UserRole string
|
||||
|
||||
// User roles
|
||||
const (
|
||||
RoleAdmin UserRole = "admin"
|
||||
RoleEditor UserRole = "editor"
|
||||
RoleViewer UserRole = "viewer"
|
||||
)
|
||||
|
||||
// User represents a user in the system
|
||||
type User struct {
|
||||
ID int `json:"id" validate:"required,min=1"`
|
||||
Email string `json:"email" validate:"required,email"`
|
||||
@@ -26,6 +29,7 @@ type User struct {
|
||||
LastWorkspaceID int `json:"lastWorkspaceId"`
|
||||
}
|
||||
|
||||
// Validate validates the user struct
|
||||
func (u *User) Validate() error {
|
||||
return validate.Struct(u)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Workspace represents a user's workspace in the system
|
||||
type Workspace struct {
|
||||
ID int `json:"id" validate:"required,min=1"`
|
||||
UserID int `json:"userId" validate:"required,min=1"`
|
||||
@@ -23,11 +24,13 @@ type Workspace struct {
|
||||
GitCommitMsgTemplate string `json:"gitCommitMsgTemplate"`
|
||||
}
|
||||
|
||||
// Validate validates the workspace struct
|
||||
func (w *Workspace) Validate() error {
|
||||
return validate.Struct(w)
|
||||
}
|
||||
|
||||
func (w *Workspace) GetDefaultSettings() {
|
||||
// SetDefaultSettings sets the default settings for the workspace
|
||||
func (w *Workspace) SetDefaultSettings() {
|
||||
w.Theme = "light"
|
||||
w.AutoSave = false
|
||||
w.ShowHiddenFiles = false
|
||||
|
||||
Reference in New Issue
Block a user