mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-04 00:00:27 -04:00
Add an endpoint to cancel a job
If you schedule a job you might change your mind or circumstances might change. So you need to be able to cancel it. This commit adds a `POST` endpoint for individual jobs which sets their status to `cancelled`. This also means adding a new status of `cancelled`, so there’s a migration…
This commit is contained in:
22
migrations/versions/0051_cancelled_job_status.py
Normal file
22
migrations/versions/0051_cancelled_job_status.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 0051_cancelled_job_status
|
||||
Revises: 0050_index_for_stats
|
||||
Create Date: 2016-09-01 14:34:06.839381
|
||||
|
||||
"""
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0051_cancelled_job_status'
|
||||
down_revision = '0050_index_for_stats'
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
def upgrade():
|
||||
op.execute("INSERT INTO job_status VALUES ('cancelled')")
|
||||
|
||||
def downgrade():
|
||||
op.execute("UPDATE jobs SET job_status = 'finished' WHERE job_status = 'cancelled'")
|
||||
op.execute("DELETE FROM job_status WHERE name = 'cancelled';")
|
||||
Reference in New Issue
Block a user