Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4fec855

Browse files
committed
update usages
1 parent 3184814 commit 4fec855

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

coderd/provisionerdaemons.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (api *API) provisionerDaemons(rw http.ResponseWriter, r *http.Request) {
4444
p := httpapi.NewQueryParamParser()
4545
limit := p.PositiveInt32(qp, 50, "limit")
4646
ids := p.UUIDs(qp, nil, "ids")
47-
tagsRaw := p.String(qp, "", "tags")
47+
tags := p.JSONStringMap(qp, nil, "tags")
4848
p.ErrorExcessParams(qp)
4949
if len(p.Errors) > 0 {
5050
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
@@ -54,17 +54,6 @@ func (api *API) provisionerDaemons(rw http.ResponseWriter, r *http.Request) {
5454
return
5555
}
5656

57-
tags := database.StringMap{}
58-
if tagsRaw != "" {
59-
if err := tags.Scan([]byte(tagsRaw)); err != nil {
60-
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
61-
Message: "Invalid tags query parameter",
62-
Detail: err.Error(),
63-
})
64-
return
65-
}
66-
}
67-
6857
daemons, err := api.Database.GetProvisionerDaemonsWithStatusByOrganization(
6958
ctx,
7059
database.GetProvisionerDaemonsWithStatusByOrganizationParams{

coderd/provisionerjobs.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (api *API) handleAuthAndFetchProvisionerJobs(rw http.ResponseWriter, r *htt
108108
if ids == nil {
109109
ids = p.UUIDs(qp, nil, "ids")
110110
}
111-
tagsRaw := p.String(qp, "", "tags")
111+
tags := p.JSONStringMap(qp, nil, "tags")
112112
p.ErrorExcessParams(qp)
113113
if len(p.Errors) > 0 {
114114
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
@@ -118,17 +118,6 @@ func (api *API) handleAuthAndFetchProvisionerJobs(rw http.ResponseWriter, r *htt
118118
return nil, false
119119
}
120120

121-
tags := database.StringMap{}
122-
if tagsRaw != "" {
123-
if err := tags.Scan([]byte(tagsRaw)); err != nil {
124-
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
125-
Message: "Invalid tags query parameter",
126-
Detail: err.Error(),
127-
})
128-
return nil, false
129-
}
130-
}
131-
132121
jobs, err := api.Database.GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisioner(ctx, database.GetProvisionerJobsByOrganizationAndStatusWithQueuePositionAndProvisionerParams{
133122
OrganizationID: org.ID,
134123
Status: slice.StringEnums[database.ProvisionerJobStatus](status),

0 commit comments

Comments
 (0)