Build rest endpoint to read service stats

- get stats by service id
- returns a list of stats objects

Not paginated - have 1 row per day.
This commit is contained in:
Martyn Inglis
2016-03-08 16:34:03 +00:00
parent f5f50e00ff
commit 67c4bd2263
8 changed files with 174 additions and 66 deletions

View File

@@ -15,8 +15,7 @@ import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('service_notification_stats',
op.create_table('notification_statistics',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('day', sa.String(length=255), nullable=False),
sa.Column('service_id', postgresql.UUID(as_uuid=True), nullable=False),
@@ -30,12 +29,9 @@ def upgrade():
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('service_id', 'day', name='uix_service_to_day')
)
op.create_index(op.f('ix_service_notification_stats_service_id'), 'service_notification_stats', ['service_id'], unique=False)
### end Alembic commands ###
op.create_index(op.f('ix_service_notification_stats_service_id'), 'notification_statistics', ['service_id'], unique=False)
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_service_notification_stats_service_id'), table_name='service_notification_stats')
op.drop_table('service_notification_stats')
### end Alembic commands ###
op.drop_index(op.f('ix_service_notification_stats_service_id'), table_name='notification_statistics')
op.drop_table('notification_statistics')