Code: Select all
from flask.views import MethodView
from flask_smorest import Blueprint
from schemas.items import ItemsSchema
blp = Blueprint("api", "items", url_prefix="/items", description="Operations on items")
@blp.route('')
class ItemsView(MethodView):
@blp.response(status_code=200, schema=ITEMS_SCHEMA)
def get(self):
items = Item.query.all()
return ITEMS_SCHEMA.dump(items), 200