refactor: reorganize models to pkg/model and add authentication module
- Move ORM models from internal/model to pkg/model organized by module (auth/k8s/registry) - Add authentication module with login, user management handlers - Update all import paths to use new model locations - Add frontend auth pages (Login, UserManagement) and authStore - Remove deprecated internal/model/model.go
This commit is contained in:
@@ -3,7 +3,7 @@ package registry
|
||||
import (
|
||||
"context"
|
||||
|
||||
"gitea.loveuer.com/loveuer/cluster/internal/model"
|
||||
"gitea.loveuer.com/loveuer/cluster/pkg/model/registry"
|
||||
"gitea.loveuer.com/loveuer/cluster/pkg/resp"
|
||||
"gitea.loveuer.com/loveuer/cluster/pkg/store"
|
||||
"github.com/gofiber/fiber/v3"
|
||||
@@ -17,7 +17,7 @@ func RegistryImageList(ctx context.Context, db *gorm.DB, store store.Store) fibe
|
||||
filter := c.Query("filter", "")
|
||||
|
||||
// Get current registry_address setting
|
||||
var registryConfig model.RegistryConfig
|
||||
var registryConfig registry.RegistryConfig
|
||||
registryAddress := ""
|
||||
if err := db.Where("key = ?", "registry_address").First(®istryConfig).Error; err == nil {
|
||||
registryAddress = registryConfig.Value
|
||||
@@ -26,7 +26,7 @@ func RegistryImageList(ctx context.Context, db *gorm.DB, store store.Store) fibe
|
||||
registryAddress = "localhost:9119"
|
||||
}
|
||||
|
||||
var repositories []model.Repository
|
||||
var repositories []registry.Repository
|
||||
|
||||
// Query all repositories from the database
|
||||
query := db
|
||||
@@ -41,7 +41,7 @@ func RegistryImageList(ctx context.Context, db *gorm.DB, store store.Store) fibe
|
||||
var result []map[string]interface{}
|
||||
for _, repo := range repositories {
|
||||
// Get all tags for this repository
|
||||
var tags []model.Tag
|
||||
var tags []registry.Tag
|
||||
if err := db.Where("repository = ?", repo.Name).Find(&tags).Error; err != nil {
|
||||
continue // Skip this repository if we can't get tags
|
||||
}
|
||||
@@ -56,7 +56,7 @@ func RegistryImageList(ctx context.Context, db *gorm.DB, store store.Store) fibe
|
||||
var sizeResult struct {
|
||||
Total int64
|
||||
}
|
||||
err := db.Model(&model.Blob{}).
|
||||
err := db.Model(®istry.Blob{}).
|
||||
Where("repository = ?", repo.Name).
|
||||
Select("COALESCE(SUM(size), 0) as total").
|
||||
Scan(&sizeResult).Error
|
||||
|
||||
Reference in New Issue
Block a user