Skip to content

Commit 4cb090c

Browse files
author
kthcloud
committed
[🚚 CI] Generate build from main
1 parent fc296a3 commit 4cb090c

4 files changed

Lines changed: 15 additions & 2 deletions

File tree

‎models/model/host.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func (host *Host) ToVerboseDTO() body.HostVerboseRead {
5151
Enabled: host.Enabled,
5252
Schedulable: host.Schedulable,
5353
DeactivatedUntil: host.DeactivatedUntil,
54+
LastSeenAt: host.LastSeenAt,
5455
RegisteredAt: host.RegisteredAt,
5556
}
5657
}

‎routers/api/v2/hosts.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func VerboseListHosts(c *gin.Context) {
5656
return
5757
}
5858

59-
hostInfo, err := service.V2().System().ListHosts()
59+
hostInfo, err := service.V2().System().ListAllHosts()
6060
if err != nil {
6161
context.ServerError(err, fmt.Errorf("failed to get host info"))
6262
}

‎service/v2/api/api_client.go‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package api
22

33
import (
44
"context"
5+
"time"
6+
57
"github.com/kthcloud/go-deploy/dto/v2/body"
68
configModels "github.com/kthcloud/go-deploy/models/config"
79
"github.com/kthcloud/go-deploy/models/model"
@@ -18,7 +20,6 @@ import (
1820
userOpts "github.com/kthcloud/go-deploy/service/v2/users/opts"
1921
vmK8sService "github.com/kthcloud/go-deploy/service/v2/vms/k8s_service"
2022
vmOpts "github.com/kthcloud/go-deploy/service/v2/vms/opts"
21-
"time"
2223
)
2324

2425
type Deployments interface {
@@ -195,6 +196,7 @@ type System interface {
195196
RegisterNode(params *body.HostRegisterParams) error
196197

197198
ListHosts() ([]model.Host, error)
199+
ListAllHosts() ([]model.Host, error)
198200

199201
GetZone(name string) *configModels.Zone
200202
ListZones(opts ...systemOpts.ListOpts) ([]configModels.Zone, error)

‎service/v2/system/host_service.go‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,13 @@ func (c *Client) ListHosts() ([]model.Host, error) {
1414

1515
return hosts, nil
1616
}
17+
18+
// ListAllHosts gets a list of all hosts
19+
func (c *Client) ListAllHosts() ([]model.Host, error) {
20+
hosts, err := host_repo.New().List()
21+
if err != nil {
22+
return nil, err
23+
}
24+
25+
return hosts, nil
26+
}

0 commit comments

Comments
 (0)