feat(api): add reset sort endpoints for server and node

This commit is contained in:
Chang lue Tsen
2025-09-01 11:41:34 -04:00
parent e910d0e345
commit 367ef9d2e7
12 changed files with 288 additions and 89 deletions
+35 -18
View File
@@ -11,13 +11,17 @@ info (
import "../types.api"
type (
ServerOnlineIP {
IP string `json:"ip"`
Protocol string `json:"protocol"`
}
ServerOnlineUser {
IP []string `json:"ip"`
UserId int64 `json:"user_id"`
Subscribe string `json:"subscribe"`
SubscribeId int64 `json:"subscribe_id"`
Traffic int64 `json:"traffic"`
ExpiredAt int64 `json:"expired_at"`
IP []ServerOnlineIP `json:"ip"`
UserId int64 `json:"user_id"`
Subscribe string `json:"subscribe"`
SubscribeId int64 `json:"subscribe_id"`
Traffic int64 `json:"traffic"`
ExpiredAt int64 `json:"expired_at"`
}
ServerStatus {
Cpu float64 `json:"cpu"`
@@ -27,18 +31,18 @@ type (
Online []ServerOnlineUser `json:"online"`
}
Server {
Id int64 `json:"id"`
Name string `json:"name"`
Country string `json:"country"`
City string `json:"city"`
Ratio float32 `json:"ratio"`
Address string `json:"address"`
Sort int `json:"sort"`
Protocols []Protocol `json:"protocols"`
LastReportedAt int64 `json:"last_reported_at"`
Status []ServerStatus `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Id int64 `json:"id"`
Name string `json:"name"`
Country string `json:"country"`
City string `json:"city"`
Ratio float32 `json:"ratio"`
Address string `json:"address"`
Sort int `json:"sort"`
Protocols []Protocol `json:"protocols"`
LastReportedAt int64 `json:"last_reported_at"`
Status ServerStatus `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
Protocol {
Type string `json:"type"`
@@ -159,6 +163,11 @@ type (
Fail uint64 `json:"fail"`
Message string `json:"message,omitempty"`
}
ResetSortRequest {
Page int `json:"page"`
Size int `json:"size"`
Sort []int64 `json:"sort"`
}
)
@server (
@@ -214,5 +223,13 @@ service ppanel {
@doc "Migrate server and node data to new database"
@handler MigrateServerNode
post /migrate/run returns (MigrateServerNodeResponse)
@doc "Reset server sort"
@handler ResetSortWithServer
post /server/sort (ResetSortRequest)
@doc "Reset node sort"
@handler ResetSortWithNode
post /node/sort (ResetSortRequest)
}