mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
noqa the x == False for sqlalchemy
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
from sqlalchemy import delete, select
|
||||
from sqlalchemy.orm import aliased
|
||||
|
||||
from app import db
|
||||
from app.dao import DAOClass
|
||||
@@ -53,19 +52,11 @@ class PermissionDAO(DAOClass):
|
||||
db.session.commit()
|
||||
|
||||
def get_permissions_by_user_id(self, user_id):
|
||||
PermissionAlias = aliased(Permission)
|
||||
return (
|
||||
db.session.execute(
|
||||
select(self.Meta.model)
|
||||
.select_from(self.Meta.model)
|
||||
.join(
|
||||
PermissionAlias, PermissionAlias.user_id == self.Meta.model.user_id
|
||||
)
|
||||
.join(
|
||||
Service,
|
||||
(Service.id == PermissionAlias.service_id)
|
||||
& (Service.active.is_(True)),
|
||||
)
|
||||
select(Permission)
|
||||
.join(Service, Service.id == Permission.service_id)
|
||||
.where(Permission.user_id == user_id)
|
||||
.where(Service.active.is_(True))
|
||||
)
|
||||
.scalars()
|
||||
|
||||
Reference in New Issue
Block a user