mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
Restructure govuk-alerts endpoint to be internal
In response to: https://github.com/alphagov/notifications-api/pull/3305#pullrequestreview-726672421 Previously this was added among the public /v2 endpoints, but it's only meant for internal use. While only the govuk-alerts app would be able to access it, the location and /v2 URL suggested otherwise. This restructures the endpoint so it resembles other internal ones.
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
from flask import Blueprint
|
||||
|
||||
from app.v2.errors import register_errors
|
||||
|
||||
v2_govuk_alerts_blueprint = Blueprint(
|
||||
"v2_govuk-alerts_blueprint",
|
||||
__name__,
|
||||
url_prefix='/v2/govuk-alerts',
|
||||
)
|
||||
|
||||
register_errors(v2_govuk_alerts_blueprint)
|
||||
@@ -1,23 +0,0 @@
|
||||
from flask import jsonify
|
||||
|
||||
from app.dao.broadcast_message_dao import dao_get_all_broadcast_messages
|
||||
from app.utils import get_dt_string_or_none
|
||||
from app.v2.govuk_alerts import v2_govuk_alerts_blueprint
|
||||
|
||||
|
||||
@v2_govuk_alerts_blueprint.route('')
|
||||
def get_broadcasts():
|
||||
broadcasts = dao_get_all_broadcast_messages()
|
||||
broadcasts_dict = {"alerts": [{
|
||||
"id": broadcast.id,
|
||||
"reference": broadcast.reference,
|
||||
"channel": broadcast.channel,
|
||||
"content": broadcast.content,
|
||||
"areas": broadcast.areas,
|
||||
"status": broadcast.status,
|
||||
"starts_at": get_dt_string_or_none(broadcast.starts_at),
|
||||
"finishes_at": get_dt_string_or_none(broadcast.finishes_at),
|
||||
"approved_at": get_dt_string_or_none(broadcast.approved_at),
|
||||
"cancelled_at": get_dt_string_or_none(broadcast.cancelled_at),
|
||||
} for broadcast in broadcasts]}
|
||||
return jsonify(broadcasts_dict), 200
|
||||
Reference in New Issue
Block a user