Skip to content

Commit 025796b

Browse files
chore: update code rabbit comment
1 parent f94778b commit 025796b

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

pkg/api/deployment.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"github.com/zeabur/cli/pkg/model"
77
)
88

9-
func (c *client) ListDeployments(ctx context.Context, serviceID string, environmentID string, skip, limit int) (*model.DeploymentConnection, error) {
10-
_, limit = normalizePagination(skip, limit)
9+
func (c *client) ListDeployments(ctx context.Context, serviceID string, environmentID string, perPage int) (*model.DeploymentConnection, error) {
10+
_, perPage = normalizePagination(0, perPage)
1111

1212
var query struct {
1313
Deployments model.DeploymentConnection `graphql:"deployments(serviceID: $serviceID, environmentID: $environmentID, perPage: $perPage)"`
@@ -16,7 +16,7 @@ func (c *client) ListDeployments(ctx context.Context, serviceID string, environm
1616
err := c.Query(ctx, &query, V{
1717
"serviceID": ObjectID(serviceID),
1818
"environmentID": ObjectID(environmentID),
19-
"perPage": limit,
19+
"perPage": perPage,
2020
})
2121
if err != nil {
2222
return nil, err
@@ -26,7 +26,7 @@ func (c *client) ListDeployments(ctx context.Context, serviceID string, environm
2626
}
2727

2828
func (c *client) ListAllDeployments(ctx context.Context, serviceID string, environmentID string) (model.Deployments, error) {
29-
conn, err := c.ListDeployments(ctx, serviceID, environmentID, 0, 5)
29+
conn, err := c.ListDeployments(ctx, serviceID, environmentID, 5)
3030
if err != nil {
3131
return nil, err
3232
}
@@ -53,7 +53,7 @@ func (c *client) GetDeployment(ctx context.Context, id string) (*model.Deploymen
5353
}
5454

5555
func (c *client) GetLatestDeployment(ctx context.Context, serviceID string, environmentID string) (*model.Deployment, bool, error) {
56-
deployments, err := c.ListDeployments(ctx, serviceID, environmentID, 0, 1)
56+
deployments, err := c.ListDeployments(ctx, serviceID, environmentID, 1)
5757
if err != nil {
5858
return nil, false, err
5959
}

pkg/api/interface.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ type (
8383
}
8484

8585
DeploymentAPI interface {
86-
ListDeployments(ctx context.Context, serviceID string, environmentID string, skip, limit int) (*model.DeploymentConnection, error)
86+
ListDeployments(ctx context.Context, serviceID string, environmentID string, perPage int) (*model.DeploymentConnection, error)
8787
ListAllDeployments(ctx context.Context, serviceID string, environmentID string) (model.Deployments, error)
8888
GetDeployment(ctx context.Context, id string) (*model.Deployment, error)
8989
GetLatestDeployment(ctx context.Context, serviceID string, environmentID string) (*model.Deployment, bool, error)

pkg/fill/fill.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,13 @@ func (f *paramFiller) ServiceByName(opt ServiceByNameOptions) (changed bool, err
214214
Auto: true,
215215
CreateNew: false,
216216
FilterFunc: func(s *model.Service) bool {
217-
return s.Name == *serviceName
217+
if s.Name != *serviceName {
218+
return false
219+
}
220+
if opt.FilterFunc != nil {
221+
return opt.FilterFunc(s)
222+
}
223+
return true
218224
},
219225
})
220226
if err != nil {

0 commit comments

Comments
 (0)