mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
more
This commit is contained in:
@@ -102,7 +102,7 @@ def dao_get_provider_stats():
|
||||
current_datetime = utc_now()
|
||||
first_day_of_the_month = current_datetime.date().replace(day=1)
|
||||
|
||||
subquery = (
|
||||
subquerie = (
|
||||
db.session.query(
|
||||
FactBilling.provider,
|
||||
func.sum(FactBilling.billable_units * FactBilling.rate_multiplier).label(
|
||||
@@ -127,11 +127,11 @@ def dao_get_provider_stats():
|
||||
ProviderDetails.updated_at,
|
||||
ProviderDetails.supports_international,
|
||||
User.name.label("created_by_name"),
|
||||
func.coalesce(subquery.c.current_month_billable_sms, 0).label(
|
||||
func.coalesce(subquerie.c.current_month_billable_sms, 0).label(
|
||||
"current_month_billable_sms"
|
||||
),
|
||||
)
|
||||
.outerjoin(subquery, ProviderDetails.identifier == subquery.c.provider)
|
||||
.outerjoin(subquerie, ProviderDetails.identifier == subquerie.c.provider)
|
||||
.outerjoin(User, ProviderDetails.created_by_id == User.id)
|
||||
.order_by(
|
||||
ProviderDetails.notification_type,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from sqlalchemy import select
|
||||
|
||||
from app import create_uuid, db
|
||||
from app.dao.dao_utils import autocommit, version_class
|
||||
from app.models import ServiceInboundApi
|
||||
@@ -28,13 +30,23 @@ def reset_service_inbound_api(
|
||||
|
||||
|
||||
def get_service_inbound_api(service_inbound_api_id, service_id):
|
||||
return ServiceInboundApi.query.filter_by(
|
||||
id=service_inbound_api_id, service_id=service_id
|
||||
).first()
|
||||
return (
|
||||
db.session.execute(
|
||||
select(ServiceInboundApi).filter_by(
|
||||
id=service_inbound_api_id, service_id=service_id
|
||||
)
|
||||
)
|
||||
.scalars()
|
||||
.first()
|
||||
)
|
||||
|
||||
|
||||
def get_service_inbound_api_for_service(service_id):
|
||||
return ServiceInboundApi.query.filter_by(service_id=service_id).first()
|
||||
return (
|
||||
db.session.execute(select(ServiceInboundApi).filter_by(service_id=service_id))
|
||||
.scalars()
|
||||
.first()
|
||||
)
|
||||
|
||||
|
||||
@autocommit
|
||||
|
||||
@@ -21,7 +21,11 @@ def dao_get_active_service_users(service_id):
|
||||
|
||||
|
||||
def dao_get_service_users_by_user_id(user_id):
|
||||
return ServiceUser.query.filter_by(user_id=user_id).all()
|
||||
return (
|
||||
db.session.execute(select(ServiceUser).filter_by(user_id=user_id))
|
||||
.scalars()
|
||||
.all()
|
||||
)
|
||||
|
||||
|
||||
@autocommit
|
||||
|
||||
Reference in New Issue
Block a user