Skip to content

Commit 5c8ccaa

Browse files
authored
small cleanups (#25)
2 parents bd7bc5e + 398cc12 commit 5c8ccaa

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

teufa/v1_api/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
from .. import db as dbm
55
from ..ext import db
6-
from .flights import flights_bp
7-
from .tenants import tenants_bp
6+
from .flights import bp as flights_bp
7+
from .tenants import bp as tenants_bp
88

99
v1_bp = Blueprint("v1", __name__, url_prefix="/api/v1")
1010

teufa/v1_api/flights.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
from .. import db as dbm
55
from ..ext import db
66

7-
flights_bp = Blueprint("flights", __name__)
7+
bp = Blueprint("flights", __name__, url_prefix="/flights")
88

99

10-
@flights_bp.route("/flights", methods=["POST"])
10+
@bp.route("", methods=["POST"])
1111
def create_flight():
1212
data = request.get_json()
1313
req = dao.CreateFlightRequest(**data)
@@ -36,7 +36,7 @@ def create_flight():
3636
return jsonify(res.model_dump()), 201
3737

3838

39-
@flights_bp.route("/flights/<int:flight_id>", methods=["GET"])
39+
@bp.route("/<int:flight_id>", methods=["GET"])
4040
def get_flight(flight_id):
4141
flight = db.session.get(dbm.Flight, flight_id)
4242

@@ -57,7 +57,7 @@ def get_flight(flight_id):
5757
return jsonify(res.model_dump())
5858

5959

60-
@flights_bp.route("/flights/<int:flight_id>", methods=["PUT"])
60+
@bp.route("/<int:flight_id>", methods=["PUT"])
6161
def update_flight(flight_id):
6262
flight = db.session.get(dbm.Flight, flight_id)
6363

@@ -90,7 +90,7 @@ def update_flight(flight_id):
9090
return jsonify(res.model_dump())
9191

9292

93-
@flights_bp.route("/flights/<int:flight_id>", methods=["DELETE"])
93+
@bp.route("/<int:flight_id>", methods=["DELETE"])
9494
def delete_flight(flight_id):
9595
flight = db.session.get(dbm.Flight, flight_id)
9696

teufa/v1_api/tenants.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
from .. import db as dbm
55
from ..ext import db
66

7-
tenants_bp = Blueprint("tenants", __name__)
7+
bp = Blueprint("tenants", __name__, url_prefix="/tenants")
88

99

10-
@tenants_bp.route("/tenants", methods=["POST"])
10+
@bp.route("", methods=["POST"])
1111
def create_tenant():
1212
data = request.get_json()
1313
req = dao.CreateTenantRequest(**data)
@@ -34,7 +34,7 @@ def create_tenant():
3434
return jsonify(res.model_dump()), 201
3535

3636

37-
@tenants_bp.route("/tenants/<int:tenant_id>", methods=["GET"])
37+
@bp.route("/<int:tenant_id>", methods=["GET"])
3838
def get_tenant(tenant_id):
3939
tenant = db.session.get(dbm.Tenant, tenant_id)
4040

@@ -55,7 +55,7 @@ def get_tenant(tenant_id):
5555
return jsonify(res.model_dump())
5656

5757

58-
@tenants_bp.route("/tenants/<int:tenant_id>", methods=["PUT"])
58+
@bp.route("/<int:tenant_id>", methods=["PUT"])
5959
def update_tenant(tenant_id):
6060
tenant = db.session.get(dbm.Tenant, tenant_id)
6161

@@ -86,7 +86,7 @@ def update_tenant(tenant_id):
8686
return jsonify(res.model_dump())
8787

8888

89-
@tenants_bp.route("/tenants/<int:tenant_id>", methods=["DELETE"])
89+
@bp.route("/<int:tenant_id>", methods=["DELETE"])
9090
def delete_tenant(tenant_id):
9191
tenant = db.session.get(dbm.Tenant, tenant_id)
9292

0 commit comments

Comments
 (0)