feat(api): migrate server and node data handling, update related structures and logic

This commit is contained in:
Chang lue Tsen
2025-08-26 07:05:59 -04:00
parent 9b3cdbbb4f
commit c7884d94aa
52 changed files with 1079 additions and 458 deletions
+7 -4
View File
@@ -3,6 +3,7 @@ package node
import (
"context"
"github.com/redis/go-redis/v9"
"gorm.io/gorm"
)
@@ -35,19 +36,21 @@ type (
}
defaultServerModel struct {
*gorm.DB
Cache *redis.Client
}
)
func newServerModel(db *gorm.DB) *defaultServerModel {
func newServerModel(db *gorm.DB, cache *redis.Client) *defaultServerModel {
return &defaultServerModel{
DB: db,
DB: db,
Cache: cache,
}
}
// NewModel returns a model for the database table.
func NewModel(conn *gorm.DB) Model {
func NewModel(conn *gorm.DB, cache *redis.Client) Model {
return &customServerModel{
defaultServerModel: newServerModel(conn),
defaultServerModel: newServerModel(conn, cache),
}
}