feat: complete MVP epics E7-E10 (provisioning, console proxy, audit, frontend)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package consoleadapter
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"proxui/backend/internal/console"
|
||||
"proxui/backend/internal/vm"
|
||||
)
|
||||
|
||||
type VMRepository struct {
|
||||
repo vm.SQLRepository
|
||||
}
|
||||
|
||||
func NewVMRepository(repo vm.SQLRepository) VMRepository {
|
||||
return VMRepository{repo: repo}
|
||||
}
|
||||
|
||||
func (r VMRepository) GetVM(ctx context.Context, profileID string, vmID string) (console.VMInfo, bool, error) {
|
||||
result, found, err := r.repo.GetVM(ctx, profileID, vmID)
|
||||
if err != nil {
|
||||
return console.VMInfo{}, false, err
|
||||
}
|
||||
if !found {
|
||||
return console.VMInfo{}, false, nil
|
||||
}
|
||||
return console.VMInfo{
|
||||
ID: result.ID,
|
||||
TenantID: result.TenantID,
|
||||
ClusterID: result.ClusterID,
|
||||
ProxmoxVMID: result.ProxmoxVMID,
|
||||
Node: result.Node,
|
||||
MembershipRole: result.MembershipRole,
|
||||
}, true, nil
|
||||
}
|
||||
Reference in New Issue
Block a user