From 6339e66125251d300c7454f6d97c3ed4742bab9e Mon Sep 17 00:00:00 2001 From: hongming Date: Tue, 11 Feb 2020 13:21:21 +0800 Subject: [PATCH] fix: use constants Signed-off-by: hongming --- pkg/apiserver/openpitrix/apps.go | 4 ++-- pkg/models/openpitrix/repos.go | 2 +- pkg/models/openpitrix/types.go | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/apiserver/openpitrix/apps.go b/pkg/apiserver/openpitrix/apps.go index 8170c5c57..0951f4e8d 100644 --- a/pkg/apiserver/openpitrix/apps.go +++ b/pkg/apiserver/openpitrix/apps.go @@ -153,9 +153,9 @@ func ListAppVersionAudits(req *restful.Request, resp *restful.Response) { resp.WriteHeaderAndEntity(http.StatusBadRequest, errors.Wrap(err)) return } - conditions.Match["app"] = appId + conditions.Match[openpitrix.AppId] = appId if versionId != "" { - conditions.Match["version"] = versionId + conditions.Match[openpitrix.VersionId] = versionId } result, err := openpitrix.ListAppVersionAudits(conditions, orderBy, reverse, limit, offset) diff --git a/pkg/models/openpitrix/repos.go b/pkg/models/openpitrix/repos.go index 91b4f414e..79154d961 100644 --- a/pkg/models/openpitrix/repos.go +++ b/pkg/models/openpitrix/repos.go @@ -270,7 +270,7 @@ func ListRepoEvents(repoId string, conditions *params.Conditions, limit, offset describeRepoEventsRequest := &pb.DescribeRepoEventsRequest{ RepoId: []string{repoId}, } - if eventId := conditions.Match["repo_event_id"]; eventId != "" { + if eventId := conditions.Match[RepoEventId]; eventId != "" { describeRepoEventsRequest.RepoEventId = strings.Split(eventId, "|") } if status := conditions.Match[Status]; status != "" { diff --git a/pkg/models/openpitrix/types.go b/pkg/models/openpitrix/types.go index 5f5a27127..554e703ed 100644 --- a/pkg/models/openpitrix/types.go +++ b/pkg/models/openpitrix/types.go @@ -843,6 +843,7 @@ const ( VersionId = "version_id" RepoId = "repo_id" CategoryId = "category_id" + RepoEventId = "repo_event_id" Status = "status" Type = "type" Visibility = "visibility"