Skip to content

Commit

Permalink
Merge pull request #341 from actiontech/add-filter
Browse files Browse the repository at this point in the history
Add filter to filter project by desc
  • Loading branch information
iwanghc authored Dec 20, 2024
2 parents 1155b51 + eea1753 commit 9488d99
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
13 changes: 12 additions & 1 deletion api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,13 @@
"description": "filter project by project priority\nhigh ProjectPriorityHigh\nmedium ProjectPriorityMedium\nlow ProjectPriorityLow\nunknown ProjectPriorityUnknown",
"name": "filter_by_project_priority",
"in": "query"
},
{
"type": "string",
"x-go-name": "FilterByDesc",
"description": "filter the Project By Project description",
"name": "filter_by_desc",
"in": "query"
}
],
"responses": {
Expand Down Expand Up @@ -5151,6 +5158,10 @@
"BindOauth2UserReq": {
"type": "object",
"properties": {
"id_token": {
"type": "string",
"x-go-name": "IdToken"
},
"oauth2_token": {
"type": "string",
"x-go-name": "Oauth2Token"
Expand Down Expand Up @@ -9679,7 +9690,7 @@
"x-go-name": "Uid"
}
},
"x-go-package": "github.com/actiontech/dms/pkg/dms-common/api/dms/v1"
"x-go-package": "github.com/actiontech/dms/api/dms/service/v1"
},
"UpdateCompanyNotice": {
"description": "A companynotice",
Expand Down
10 changes: 9 additions & 1 deletion api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ definitions:
x-go-package: github.com/actiontech/dms/api/dms/service/v1
BindOauth2UserReq:
properties:
id_token:
type: string
x-go-name: IdToken
oauth2_token:
type: string
x-go-name: Oauth2Token
Expand Down Expand Up @@ -4082,7 +4085,7 @@ definitions:
type: string
x-go-name: Uid
type: object
x-go-package: github.com/actiontech/dms/pkg/dms-common/api/dms/v1
x-go-package: github.com/actiontech/dms/api/dms/service/v1
UpdateCompanyNotice:
description: A companynotice
properties:
Expand Down Expand Up @@ -5711,6 +5714,11 @@ paths:
low ProjectPriorityLow
unknown ProjectPriorityUnknown
x-go-name: FilterByProjectPriority
- description: filter the Project By Project description
in: query
name: filter_by_desc
type: string
x-go-name: FilterByDesc
responses:
"200":
description: ListProjectReply
Expand Down
2 changes: 1 addition & 1 deletion internal/dms/biz/repo_fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions internal/dms/service/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ func (d *DMSService) ListProjects(ctx context.Context, req *dmsCommonV1.ListProj
Operator: pkgConst.FilterOperatorIn,
Value: req.FilterByProjectUids,
})
}
if req.FilterByDesc != "" {
filterBy = append(filterBy, pkgConst.FilterCondition{
Field: string(biz.ProjectFieldDesc),
Operator: pkgConst.FilterOperatorContains,
Value: req.FilterByDesc,
})
}

listOption := &biz.ListProjectsOption{
PageNumber: req.PageIndex,
LimitPerPage: req.PageSize,
Expand Down
2 changes: 2 additions & 0 deletions pkg/dms-common/api/dms/v1/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ type ListProjectReq struct {
// filter project by project priority
// in:query
FilterByProjectPriority ProjectPriority `query:"filter_by_project_priority" json:"filter_by_project_priority"`
// filter the Project By Project description
FilterByDesc string `query:"filter_by_desc" json:"filter_by_desc"`
}

// swagger:enum ProjectOrderByField
Expand Down

0 comments on commit 9488d99

Please sign in to comment.