feat(chalice): session's notes search mine only
This commit is contained in:
parent
ece726eea0
commit
146234da99
3 changed files with 5 additions and 0 deletions
|
|
@ -36,6 +36,8 @@ def get_all_notes_by_project_id(tenant_id, project_id, user_id, data: schemas.Se
|
|||
extra_params = sessions._multiple_values(data.tags, value_key=k)
|
||||
if data.shared_only:
|
||||
conditions.append("sessions_notes.is_public")
|
||||
elif data.mine_only:
|
||||
conditions.append("sessions_notes.user_id = %(user_id)s")
|
||||
else:
|
||||
conditions.append("(sessions_notes.user_id = %(user_id)s OR sessions_notes.is_public)")
|
||||
query = cur.mogrify(f"""SELECT sessions_notes.*
|
||||
|
|
|
|||
|
|
@ -1091,6 +1091,7 @@ class SearchNoteSchema(_PaginatedSchema):
|
|||
order: SortOrderType = Field(default=SortOrderType.desc)
|
||||
tags: Optional[List[str]] = Field(default=[])
|
||||
shared_only: bool = Field(default=False)
|
||||
mine_only: bool = Field(default=False)
|
||||
|
||||
class Config:
|
||||
alias_generator = attribute_to_camel_case
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ def get_all_notes_by_project_id(tenant_id, project_id, user_id, data: schemas.Se
|
|||
extra_params = sessions._multiple_values(data.tags, value_key=k)
|
||||
if data.shared_only:
|
||||
conditions.append("sessions_notes.is_public AND users.tenant_id = %(tenant_id)s")
|
||||
elif data.mine_only:
|
||||
conditions.append("sessions_notes.user_id = %(user_id)s")
|
||||
else:
|
||||
conditions.append(
|
||||
"(sessions_notes.user_id = %(user_id)s OR sessions_notes.is_public AND users.tenant_id = %(tenant_id)s)")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue