Skip to content

Commit

Permalink
Updated pet routes to remove jsonify reference
Browse files Browse the repository at this point in the history
  • Loading branch information
apradoada committed Dec 6, 2024
1 parent a755f61 commit eab3be7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/routes/pet_routes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask import Blueprint, jsonify, request, abort, make_response
from flask import Blueprint, request, abort, make_response
from ..db import db
from ..models.pet import Pet

Expand All @@ -17,6 +17,7 @@ def create_pet():
except KeyError as e:
abort(make_response({"message": f"missing required value: {e}"}, 400))


@bp.get("")
def get_pets():
pet_query = db.select(Pet)
Expand All @@ -27,12 +28,12 @@ def get_pets():
for pet in pets:
response.append(pet.to_dict())

return jsonify(response)
return response

@bp.get("/<pet_id>")
def get_single_cat(pet_id):
cat = validate_model(Pet,pet_id)
return cat.to_dict()
def get_single_pet(pet_id):
pet = validate_model(Pet,pet_id)
return pet.to_dict()

def validate_model(cls,id):
try:
Expand Down

0 comments on commit eab3be7

Please sign in to comment.