Refactor flow retrieval logic in read_flows function

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-03-06 15:19:36 -03:00
commit 4286b6a93e

View file

@ -57,7 +57,11 @@ def read_flows(
try:
auth_settings = settings_service.auth_settings
if auth_settings.AUTO_LOGIN:
flows = session.exec(select(Flow).where(Flow.user_id == None | Flow.user_id == current_user.id)).all() # noqa
flows = session.exec(
select(Flow).where(
(Flow.user_id == None) | (Flow.user_id == current_user.id)
)
).all() # noqa
else:
flows = current_user.flows