Files
baby-nas/internal/db/models.go
T
darroyo e3add68584 feat: structured NFS options with auto-fsid and manual watched mounts
NFS exports: replace plain-text options string with typed booleans
(read_only, async, root_squash, subtree_check) + advanced JSON blob.
fsid is auto-generated via crypto/rand with collision retry and is
never user-settable. Breaking API change (options field removed).

Dashboard: filter disks to manual+samba+nfs sources only; no more
auto-discovery of all /proc/mounts entries.

Settings: new 'Puntos de montaje vigilados' card with add/remove
for manual mount points. AllowedRoots validation applied.

Version bump: 0.1.10 -> 0.2.0
2026-07-06 00:23:49 -04:00

80 lines
2.3 KiB
Go

package db
import "time"
type User struct {
ID int64 `json:"id"`
Username string `json:"username"`
UID *int64 `json:"uid,omitempty"`
GID *int64 `json:"gid,omitempty"`
Groups []string `json:"groups"`
SMBEnabled bool `json:"smb_enabled"`
Disabled bool `json:"disabled"`
// PendingPassword holds a not-yet-applied password. Never serialized.
PendingPassword string `json:"-"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type Admin struct {
ID int64 `json:"id"`
Username string `json:"username"`
PasswordHash string `json:"-"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type SambaShare struct {
ID int64 `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Comment string `json:"comment"`
ReadOnly bool `json:"read_only"`
GuestOK bool `json:"guest_ok"`
ValidUsers []string `json:"valid_users"`
ValidGroups []string `json:"valid_groups"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type NFSExport struct {
ID int64 `json:"id"`
Path string `json:"path"`
Clients []string `json:"clients"`
ReadOnly bool `json:"read_only"`
Async bool `json:"async"`
RootSquash bool `json:"root_squash"`
SubtreeCheck bool `json:"subtree_check"`
FSID int64 `json:"fsid"`
Advanced string `json:"advanced"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type NFSAdvanced struct {
AllSquash bool `json:"all_squash"`
Secure bool `json:"secure"`
WDelay bool `json:"wdelay"`
Hide bool `json:"hide"`
Crossmnt bool `json:"crossmnt"`
}
type WatchedMount struct {
ID int64 `json:"id"`
Path string `json:"path"`
CreatedAt time.Time `json:"created_at"`
}
type DirtyModule struct {
Module string `json:"module"`
MarkedAt time.Time `json:"marked_at"`
}
type ApplyLogEntry struct {
ID int64 `json:"id"`
Module string `json:"module"`
Message string `json:"message"`
Success bool `json:"success"`
CreatedAt time.Time `json:"created_at"`
}