fix(api): is_active check
This commit is contained in:
parent
6f7f0234cb
commit
be5ba8235a
2 changed files with 5 additions and 3 deletions
|
|
@ -28,17 +28,19 @@ def search_feature_flags(project_id: int, user_id: int, data: schemas.SearchFlag
|
|||
constraints = [
|
||||
"feature_flags.project_id = %(project_id)s",
|
||||
"feature_flags.deleted_at IS NULL",
|
||||
"feature_flags.is_active = %(is_active)s"
|
||||
]
|
||||
|
||||
params = {
|
||||
"project_id": project_id,
|
||||
"user_id": user_id,
|
||||
"limit": data.limit,
|
||||
"is_active": data.is_active,
|
||||
"offset": (data.page - 1) * data.limit,
|
||||
}
|
||||
|
||||
if data.is_active is not None:
|
||||
constraints.append("feature_flags.is_active=%(is_active)s")
|
||||
params["is_active"] = data.is_active
|
||||
|
||||
if data.user_id is not None:
|
||||
constraints.append("feature_flags.created_by=%(user_id)s")
|
||||
|
||||
|
|
|
|||
|
|
@ -1396,7 +1396,7 @@ class SearchFlagsSchema(_PaginatedSchema):
|
|||
user_id: Optional[int] = Field(default=None)
|
||||
order: SortOrderType = Field(default=SortOrderType.desc)
|
||||
query: Optional[str] = Field(default=None)
|
||||
is_active: bool = Field(default=True)
|
||||
is_active: Optional[bool] = Field(default=None)
|
||||
|
||||
class Config:
|
||||
alias_generator = attribute_to_camel_case
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue