from flask_restful import Resource
from models.squad import Squad
from schemas.squad import SquadSchema
from flask import request


class SquadList(Resource):
    squad_schema = SquadSchema()

    def get(self):
        query = Squad.query
        wc_year = request.args.get('year')
        
        if wc_year:
            query = Squad.query.filter(Squad.tournament.has(year=wc_year))

        squads = query.all()
        return {"data": self.squad_schema.dump(squads, many=True)}

f6d758a1ef318bd222358e2f9ed460cec60e5690
<mask token>


class SquadList(Resource):
    <mask token>
    <mask token>

<mask token>


class SquadList(Resource):
    <mask token>

    def get(self):
        query = Squad.query
        wc_year = request.args.get('year')
        if wc_year:
            query = Squad.query.filter(Squad.tournament.has(year=wc_year))
        squads = query.all()
        return {'data': self.squad_schema.dump(squads, many=True)}

<mask token>


class SquadList(Resource):
    squad_schema = SquadSchema()

    def get(self):
        query = Squad.query
        wc_year = request.args.get('year')
        if wc_year:
            query = Squad.query.filter(Squad.tournament.has(year=wc_year))
        squads = query.all()
        return {'data': self.squad_schema.dump(squads, many=True)}

from flask_restful import Resource
from models.squad import Squad
from schemas.squad import SquadSchema
from flask import request


class SquadList(Resource):
    squad_schema = SquadSchema()

    def get(self):
        query = Squad.query
        wc_year = request.args.get('year')
        if wc_year:
            query = Squad.query.filter(Squad.tournament.has(year=wc_year))
        squads = query.all()
        return {'data': self.squad_schema.dump(squads, many=True)}

from flask_restful import Resource
from models.squad import Squad
from schemas.squad import SquadSchema
from flask import request


class SquadList(Resource):
    squad_schema = SquadSchema()

    def get(self):
        query = Squad.query
        wc_year = request.args.get('year')
        
        if wc_year:
            query = Squad.query.filter(Squad.tournament.has(year=wc_year))

        squads = query.all()
        return {"data": self.squad_schema.dump(squads, many=True)}
