53 lines
2.2 KiB
Go
53 lines
2.2 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// MenuItem represents a menu entry with optional parent for submenus
|
|
type MenuItem struct {
|
|
ID int64 `json:"id" db:"id"`
|
|
ParentID *int64 `json:"parent_id" db:"parent_id"` // NULL for root items
|
|
Title string `json:"title" db:"title"`
|
|
Icon string `json:"icon" db:"icon"`
|
|
Route string `json:"route" db:"route"`
|
|
SortOrder int `json:"sort_order" db:"sort_order"`
|
|
Active bool `json:"active" db:"active"`
|
|
RoleReq string `json:"role_required" db:"role_required"` // "admin", "user", or "" for all
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
|
Children []MenuItem `json:"children,omitempty"` // Populated in code, not DB
|
|
}
|
|
|
|
// UserSettings stores user preferences
|
|
type UserSettings struct {
|
|
ID int64 `json:"id" db:"id"`
|
|
UserID int64 `json:"user_id" db:"user_id"`
|
|
SidebarPosition string `json:"sidebar_position" db:"sidebar_position"` // "left" or "right"
|
|
SidebarCollapsed bool `json:"sidebar_collapsed" db:"sidebar_collapsed"`
|
|
Theme string `json:"theme" db:"theme"` // "light" or "dark"
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
|
}
|
|
|
|
// ToolbarItem represents a toolbar button
|
|
type ToolbarItem struct {
|
|
ID int64 `json:"id" db:"id"`
|
|
Title string `json:"title" db:"title"`
|
|
Icon string `json:"icon" db:"icon"`
|
|
Action string `json:"action" db:"action"` // action identifier
|
|
Shortcut string `json:"shortcut" db:"shortcut"`
|
|
SortOrder int `json:"sort_order" db:"sort_order"`
|
|
Active bool `json:"active" db:"active"`
|
|
Separator bool `json:"separator" db:"separator"` // show separator after this item
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
|
}
|
|
|
|
// UpdateSettingsRequest for updating user settings
|
|
type UpdateSettingsRequest struct {
|
|
SidebarPosition *string `json:"sidebar_position"`
|
|
SidebarCollapsed *bool `json:"sidebar_collapsed"`
|
|
Theme *string `json:"theme"`
|
|
}
|