mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-02 17:48:36 -04:00
code review feedback
This commit is contained in:
@@ -36,13 +36,9 @@ def expire_api_key(service_id, api_key_id):
|
||||
|
||||
def get_model_api_keys(service_id, id=None):
|
||||
if id:
|
||||
return (
|
||||
db.session.execute(
|
||||
select(ApiKey).filter_by(id=id, service_id=service_id, expiry_date=None)
|
||||
)
|
||||
.scalars()
|
||||
.one()
|
||||
)
|
||||
return db.session.execute(
|
||||
select(ApiKey).where(id=id, service_id=service_id, expiry_date=None)
|
||||
).one()
|
||||
seven_days_ago = utc_now() - timedelta(days=7)
|
||||
return (
|
||||
db.session.execute(
|
||||
@@ -63,13 +59,9 @@ def get_unsigned_secrets(service_id):
|
||||
"""
|
||||
This method can only be exposed to the Authentication of the api calls.
|
||||
"""
|
||||
api_keys = (
|
||||
db.session.execute(
|
||||
select(ApiKey).filter_by(service_id=service_id, expiry_date=None)
|
||||
)
|
||||
.scalars()
|
||||
.all()
|
||||
)
|
||||
api_keys = db.session.execute(
|
||||
select(ApiKey).where(service_id=service_id, expiry_date=None)
|
||||
).all()
|
||||
keys = [x.secret for x in api_keys]
|
||||
return keys
|
||||
|
||||
@@ -78,9 +70,7 @@ def get_unsigned_secret(key_id):
|
||||
"""
|
||||
This method can only be exposed to the Authentication of the api calls.
|
||||
"""
|
||||
api_key = (
|
||||
db.session.execute(select(ApiKey).filter_by(id=key_id, expiry_date=None))
|
||||
.scalars()
|
||||
.one()
|
||||
)
|
||||
api_key = db.session.execute(
|
||||
select(ApiKey).where(id=key_id, expiry_date=None)
|
||||
).one()
|
||||
return api_key.secret
|
||||
|
||||
Reference in New Issue
Block a user