feat: init commit

This commit is contained in:
DaanSelen
2026-04-20 16:58:20 +02:00
parent 5b84b3ed1d
commit 4b783b50fb
14 changed files with 495 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
package database
import (
"path/filepath"
"gorm.io/gorm"
)
func GetAppState(db *gorm.DB) (AppState, error) {
var state AppState
return state, db.First(&state).Error
}
func GetFiles(db *gorm.DB) ([]Files, error) {
var files []Files
return files, db.Find(&files).Error
}
func RegisterFile(db *gorm.DB, category, fullPath string) error {
file := Files{
Mode: category,
Filename: filepath.Base(fullPath),
Filepath: fullPath,
}
return db.Create(&file).Error
}