26 lines
937 B
Go
26 lines
937 B
Go
package models
|
|
|
|
import "time"
|
|
|
|
// AppSetting is a key-value store for global application settings
|
|
// (AI provider, endpoint, API key, etc.) in settings.db.
|
|
type AppSetting struct {
|
|
Key string `gorm:"primaryKey;size:100" json:"key"`
|
|
Value string `gorm:"type:text" json:"value"`
|
|
}
|
|
|
|
func (AppSetting) TableName() string { return "app_settings" }
|
|
|
|
// Library represents a registered knowledge library in settings.db.
|
|
// Each library is a separate SQLite file.
|
|
type Library struct {
|
|
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
|
|
Name string `gorm:"uniqueIndex;size:100;not null" json:"name"`
|
|
Description string `gorm:"size:255" json:"description"`
|
|
FilePath string `gorm:"size:1024;not null" json:"file_path"`
|
|
EntryCount int `gorm:"-" json:"entry_count"` // populated on read
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
func (Library) TableName() string { return "libraries" }
|