package models import "time" // Library represents a file library (download area). // // Original: struct Library_Header in LIBRARY.H // Changes: // - ID replaces linked-list ordering // - FilePath stores the on-disk location for the actual files type Library struct { ID int64 Name string FilePath string // Directory on disk where files are stored UploadLow int // Minimum SecLibrary to upload UploadHigh int // Maximum SecLibrary to upload DownloadLow int // Minimum SecLibrary to download DownloadHigh int // Maximum SecLibrary to download MaxFiles int FileCount int LatestFile *time.Time CreatedAt time.Time } // CanUpload returns true if the given security level can upload here. func (l *Library) CanUpload(secLibrary int) bool { return secLibrary >= l.UploadLow && secLibrary <= l.UploadHigh } // CanDownload returns true if the given security level can download here. func (l *Library) CanDownload(secLibrary int) bool { return secLibrary >= l.DownloadLow && secLibrary <= l.DownloadHigh } // LibraryFile represents a single file entry in a library. // // Original: struct Library_Data in LIBRARY.H // Changes: // - ID replaces positional slot // - LibraryID foreign key // - FileSize is new (original relied on OS stat calls) type LibraryFile struct { ID int64 LibraryID int64 Filename string Description string UploaderID int64 Uploader string // Display name FileSize int64 Downloads int CreatedAt time.Time } // Bulletin represents a text file displayed to users. // // Original: struct Bulletin_Header in BULLETIN.H // Changes: // - ID replaces linked-list ordering // - FilePath points to the display file on disk type Bulletin struct { ID int64 Name string FilePath string // Path to the text/ANSI file ReadLow int // Minimum SecBulletin to view ReadHigh int // Maximum SecBulletin to view }