small cleanups (#25)

This commit is contained in:
Brian Rosner 2025-01-19 16:43:20 -07:00 committed by GitHub
commit 5c8ccaa812
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 12 deletions

View File

@ -3,8 +3,8 @@ from sqlalchemy import select
from .. import db as dbm
from ..ext import db
from .flights import flights_bp
from .tenants import tenants_bp
from .flights import bp as flights_bp
from .tenants import bp as tenants_bp
v1_bp = Blueprint("v1", __name__, url_prefix="/api/v1")

View File

@ -4,10 +4,10 @@ from .. import dao
from .. import db as dbm
from ..ext import db
flights_bp = Blueprint("flights", __name__)
bp = Blueprint("flights", __name__, url_prefix="/flights")
@flights_bp.route("/flights", methods=["POST"])
@bp.route("", methods=["POST"])
def create_flight():
data = request.get_json()
req = dao.CreateFlightRequest(**data)
@ -36,7 +36,7 @@ def create_flight():
return jsonify(res.model_dump()), 201
@flights_bp.route("/flights/<int:flight_id>", methods=["GET"])
@bp.route("/<int:flight_id>", methods=["GET"])
def get_flight(flight_id):
flight = db.session.get(dbm.Flight, flight_id)
@ -57,7 +57,7 @@ def get_flight(flight_id):
return jsonify(res.model_dump())
@flights_bp.route("/flights/<int:flight_id>", methods=["PUT"])
@bp.route("/<int:flight_id>", methods=["PUT"])
def update_flight(flight_id):
flight = db.session.get(dbm.Flight, flight_id)
@ -90,7 +90,7 @@ def update_flight(flight_id):
return jsonify(res.model_dump())
@flights_bp.route("/flights/<int:flight_id>", methods=["DELETE"])
@bp.route("/<int:flight_id>", methods=["DELETE"])
def delete_flight(flight_id):
flight = db.session.get(dbm.Flight, flight_id)

View File

@ -4,10 +4,10 @@ from .. import dao
from .. import db as dbm
from ..ext import db
tenants_bp = Blueprint("tenants", __name__)
bp = Blueprint("tenants", __name__, url_prefix="/tenants")
@tenants_bp.route("/tenants", methods=["POST"])
@bp.route("", methods=["POST"])
def create_tenant():
data = request.get_json()
req = dao.CreateTenantRequest(**data)
@ -34,7 +34,7 @@ def create_tenant():
return jsonify(res.model_dump()), 201
@tenants_bp.route("/tenants/<int:tenant_id>", methods=["GET"])
@bp.route("/<int:tenant_id>", methods=["GET"])
def get_tenant(tenant_id):
tenant = db.session.get(dbm.Tenant, tenant_id)
@ -55,7 +55,7 @@ def get_tenant(tenant_id):
return jsonify(res.model_dump())
@tenants_bp.route("/tenants/<int:tenant_id>", methods=["PUT"])
@bp.route("/<int:tenant_id>", methods=["PUT"])
def update_tenant(tenant_id):
tenant = db.session.get(dbm.Tenant, tenant_id)
@ -86,7 +86,7 @@ def update_tenant(tenant_id):
return jsonify(res.model_dump())
@tenants_bp.route("/tenants/<int:tenant_id>", methods=["DELETE"])
@bp.route("/<int:tenant_id>", methods=["DELETE"])
def delete_tenant(tenant_id):
tenant = db.session.get(dbm.Tenant, tenant_id)