mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-07 21:54:10 +00:00
feat: add GetNodeStates query for node management
This commit is contained in:
parent
67435b892b
commit
85c6b661ac
1 changed files with 7 additions and 0 deletions
|
|
@ -51,3 +51,10 @@ func UpsertNodeState(tx *gorm.DB, state *model.NodeState) error {
|
||||||
state.UpdatedAt = time.Now().Unix()
|
state.UpdatedAt = time.Now().Unix()
|
||||||
return txOrDB(tx).Save(state).Error
|
return txOrDB(tx).Save(state).Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetNodeStates returns all node_state records ordered by node_id.
|
||||||
|
func GetNodeStates() ([]model.NodeState, error) {
|
||||||
|
var states []model.NodeState
|
||||||
|
err := GetDB().Order("node_id").Find(&states).Error
|
||||||
|
return states, err
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue