feat: add services and separate further

This commit is contained in:
2026-04-29 13:25:38 +02:00
parent 6c28aea655
commit 8f6b1efea0
16 changed files with 318 additions and 168 deletions
+3 -4
View File
@@ -4,7 +4,6 @@ import (
"log/slog"
"orbits-server/internal/server/bootstrap"
"orbits-server/internal/server/database"
"orbits-server/internal/shared/utility"
"os"
"path/filepath"
@@ -34,12 +33,12 @@ func applyFS(env bootstrap.Environment, db *gorm.DB, fsOrphans []string) {
return
}
database.CreateFile(db, &fileData)
os.Rename(fp, fileData.FilePath)
_ = database.CreateFile(db, &fileData)
_ = os.Rename(fp, fileData.FilePath)
}()
case "strict":
utility.RemoveFile(fp)
_ = os.Remove(fp)
case "dry":
slog.Debug("dry mode", "file", fp)
+6 -6
View File
@@ -33,13 +33,13 @@ func scanFS(env bootstrap.Environment) (map[string]struct{}, error) {
return nil, err
}
res := make(map[string]struct{})
resp := make(map[string]struct{})
for _, f := range fsFiles {
full := filepath.Join(env.ContentDirectory, f.Name())
res[full] = struct{}{}
resp[full] = struct{}{}
}
return res, nil
return resp, nil
}
func scanDB(db *gorm.DB) (map[string]database.File, error) {
@@ -48,10 +48,10 @@ func scanDB(db *gorm.DB) (map[string]database.File, error) {
return nil, err
}
res := make(map[string]database.File)
resp := make(map[string]database.File)
for _, f := range files {
res[f.FilePath] = f
resp[f.FilePath] = f
}
return res, nil
return resp, nil
}