Skip to content

Commit

Permalink
Merge pull request #119 from ImMin5/master
Browse files Browse the repository at this point in the history
Modify keyword field required to optional when user find
  • Loading branch information
ImMin5 authored Dec 12, 2023
2 parents a492cd4 + 7c8e364 commit b209381
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/spaceone/identity/model/user/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class UserWorkspacesRequest(BaseModel):


class UserFindRequest(BaseModel):
keyword: str
keyword: Union[str, None] = None
state: Union[State, None] = None
exclude_workspace_id: Union[str, None] = None
page: Union[dict, None] = None
Expand Down
12 changes: 7 additions & 5 deletions src/spaceone/identity/service/user_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,14 +603,17 @@ def find(self, params: UserFindRequest) -> Union[UsersSummaryResponse, dict]:

query = {
"filter": [{"k": "domain_id", "v": params.domain_id, "o": "eq"}],
"filter_or": [
{"k": "user_id", "v": params.keyword, "o": "contain"},
{"k": "name", "v": params.keyword, "o": "contain"},
],
"sort": {"key": "user_id"},
"page": params.page,
"only": ["user_id", "name", "state"],
}

if params.keyword:
query["filter_or"] = [
{"k": "user_id", "v": params.keyword, "o": "contain"},
{"k": "name", "v": params.keyword, "o": "contain"},
]

if params.state:
query["filter"].append({"k": "state", "v": params.state, "o": "eq"})

Expand All @@ -634,7 +637,6 @@ def find(self, params: UserFindRequest) -> Union[UsersSummaryResponse, dict]:
"name",
"state",
"email",
"user_type",
"auth_type",
"domain_id",
]
Expand Down

0 comments on commit b209381

Please sign in to comment.