From da94acf18c72fc1d63fa87ed420097ee6f72d2e8 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 25 Mar 2021 01:38:24 +0100 Subject: [PATCH] [events] More rename --- flaschengeist/plugins/events/__init__.py | 40 ++++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/flaschengeist/plugins/events/__init__.py b/flaschengeist/plugins/events/__init__.py index 3e955df..b0c7b98 100644 --- a/flaschengeist/plugins/events/__init__.py +++ b/flaschengeist/plugins/events/__init__.py @@ -17,7 +17,7 @@ from . import event_controller, permissions from . import models from ...utils.HTTP import no_content -schedule_bp = Blueprint("events", __name__, url_prefix="/events") +events_bp = Blueprint("events", __name__) class EventPlugin(Plugin): @@ -25,19 +25,19 @@ class EventPlugin(Plugin): def __init__(self, config): super().__init__( - blueprint=schedule_bp, + blueprint=events_bp, permissions=permissions.permissions, ) -@schedule_bp.route("/templates", methods=["GET"]) +@events_bp.route("/events/templates", methods=["GET"]) @login_required() def get_templates(current_session): return jsonify(event_controller.get_templates()) -@schedule_bp.route("/event-types", methods=["GET"]) -@schedule_bp.route("/event-types/", methods=["GET"]) +@events_bp.route("/events/event-types", methods=["GET"]) +@events_bp.route("/events/event-types/", methods=["GET"]) @login_required() def get_event_types(current_session, identifier=None): """Get EventType(s) @@ -59,7 +59,7 @@ def get_event_types(current_session, identifier=None): return jsonify(result) -@schedule_bp.route("/event-types", methods=["POST"]) +@events_bp.route("/events/event-types", methods=["POST"]) @login_required(permission=permissions.EVENT_TYPE) def new_event_type(current_session): """Create a new EventType @@ -81,7 +81,7 @@ def new_event_type(current_session): return jsonify(event_type) -@schedule_bp.route("/event-types/", methods=["PUT", "DELETE"]) +@events_bp.route("/events/event-types/", methods=["PUT", "DELETE"]) @login_required(permission=permissions.EVENT_TYPE) def modify_event_type(identifier, current_session): """Rename or delete an event type @@ -107,7 +107,7 @@ def modify_event_type(identifier, current_session): return "", NO_CONTENT -@schedule_bp.route("/job-types", methods=["GET"]) +@events_bp.route("/events/job-types", methods=["GET"]) @login_required() def get_job_types(current_session): """Get all JobTypes @@ -124,7 +124,7 @@ def get_job_types(current_session): return jsonify(types) -@schedule_bp.route("/job-types", methods=["POST"]) +@events_bp.route("/events/job-types", methods=["POST"]) @login_required(permission=permissions.JOB_TYPE) def new_job_type(current_session): """Create a new JobType @@ -146,7 +146,7 @@ def new_job_type(current_session): return jsonify(jt) -@schedule_bp.route("/job-types/", methods=["PUT", "DELETE"]) +@events_bp.route("/events/job-types/", methods=["PUT", "DELETE"]) @login_required(permission=permissions.JOB_TYPE) def modify_job_type(type_id, current_session): """Rename or delete a JobType @@ -172,7 +172,7 @@ def modify_job_type(type_id, current_session): return "", NO_CONTENT -@schedule_bp.route("/", methods=["GET"]) +@events_bp.route("/events/", methods=["GET"]) @login_required() def get_event(event_id, current_session): """Get event by id @@ -190,7 +190,7 @@ def get_event(event_id, current_session): return jsonify(event) -@schedule_bp.route("/", methods=["GET"]) +@events_bp.route("/events", methods=["GET"]) @login_required() def get_filtered_events(current_session): begin = request.args.get("from") @@ -204,8 +204,8 @@ def get_filtered_events(current_session): return jsonify(event_controller.get_events(begin, end)) -@schedule_bp.route("//", methods=["GET"]) -@schedule_bp.route("/events///", methods=["GET"]) +@events_bp.route("/events//", methods=["GET"]) +@events_bp.route("/events///", methods=["GET"]) @login_required() def get_events(current_session, year=datetime.now().year, month=datetime.now().month, day=None): """Get Event objects for specified date (or month or year), @@ -256,7 +256,7 @@ def _add_job(event, data): event_controller.add_job(event, job_type, required_services, start, end, comment=data.get("comment", None)) -@schedule_bp.route("", methods=["POST"]) +@events_bp.route("/events", methods=["POST"]) @login_required(permission=permissions.CREATE) def create_event(current_session): """Create an new event @@ -301,7 +301,7 @@ def create_event(current_session): return jsonify(event) -@schedule_bp.route("/events/", methods=["PUT"]) +@events_bp.route("/events/", methods=["PUT"]) @login_required(permission=permissions.EDIT) def modify_event(event_id, current_session): """Modify an event @@ -332,7 +332,7 @@ def modify_event(event_id, current_session): return jsonify(event) -@schedule_bp.route("/", methods=["DELETE"]) +@events_bp.route("/events/", methods=["DELETE"]) @login_required(permission=permissions.DELETE) def delete_event(event_id, current_session): """Delete an event @@ -350,7 +350,7 @@ def delete_event(event_id, current_session): return "", NO_CONTENT -@schedule_bp.route("//jobs", methods=["POST"]) +@events_bp.route("/events//jobs", methods=["POST"]) @login_required(permission=permissions.EDIT) def add_job(event_id, current_session): """Add an new Job to an Event / EventSlot @@ -371,7 +371,7 @@ def add_job(event_id, current_session): return jsonify(event) -@schedule_bp.route("//jobs/", methods=["DELETE"]) +@events_bp.route("/events//jobs/", methods=["DELETE"]) @login_required(permission=permissions.DELETE) def delete_job(event_id, job_id, current_session): """Delete a Job @@ -391,7 +391,7 @@ def delete_job(event_id, job_id, current_session): return no_content() -@schedule_bp.route("//jobs/", methods=["PUT"]) +@events_bp.route("/events//jobs/", methods=["PUT"]) @login_required() def update_job(event_id, job_id, current_session: Session): """Edit Job or assign user to the Job