diff --git a/server/app/__init__.py b/server/app/__init__.py index 9215563a9538bf1d33aecabc2b1abbc32779950a..2add65446ea6ca429a204a1564813d9fe19e25d0 100644 --- a/server/app/__init__.py +++ b/server/app/__init__.py @@ -34,7 +34,7 @@ def create_app(config_name="configmodule.DevelopmentConfig"): return redirect(rp[:-1]) @app.after_request - def set_core(response): + def set_corse(response): header = response.headers header["Access-Control-Allow-Origin"] = "*" return response diff --git a/server/app/apis/alternatives.py b/server/app/apis/alternatives.py index d56a2f8ba0163a9187aa451eac45a416890052c6..ce7b4e7d3bb8a550aa52cbc0b2492c1118999876 100644 --- a/server/app/apis/alternatives.py +++ b/server/app/apis/alternatives.py @@ -13,7 +13,7 @@ schema = QuestionAlternativeDTO.schema list_schema = QuestionAlternativeDTO.list_schema -@api.route("/") +@api.route("") @api.param("competition_id, slide_id, question_id") class QuestionAlternativeList(Resource): @check_jwt(editor=True) diff --git a/server/app/apis/answers.py b/server/app/apis/answers.py index 308b1001de9fa325b7ff01c4e518f7db9e3c10eb..0ef3003931d52d304d66cff1cedb36b0c8cfa777 100644 --- a/server/app/apis/answers.py +++ b/server/app/apis/answers.py @@ -13,7 +13,7 @@ schema = QuestionAnswerDTO.schema list_schema = QuestionAnswerDTO.list_schema -@api.route("/") +@api.route("") @api.param("competition_id, team_id") class QuestionAnswerList(Resource): @check_jwt(editor=True) diff --git a/server/app/apis/codes.py b/server/app/apis/codes.py index c761420fabab70254973a7d352ce6f9b7833ba25..2a2eea5c55c6e46cf516ff35dd79ed3d96f58679 100644 --- a/server/app/apis/codes.py +++ b/server/app/apis/codes.py @@ -12,7 +12,7 @@ schema = CodeDTO.schema list_schema = CodeDTO.list_schema -@api.route("/") +@api.route("") @api.param("competition_id") class CodesList(Resource): @check_jwt(editor=True) diff --git a/server/app/apis/competitions.py b/server/app/apis/competitions.py index 386d4051c5e32f852a9a165810e3303812e58440..4a6bf79d6bf17d132e3a5fed6a403b21762bbc13 100644 --- a/server/app/apis/competitions.py +++ b/server/app/apis/competitions.py @@ -15,7 +15,7 @@ rich_schema = CompetitionDTO.rich_schema list_schema = CompetitionDTO.list_schema -@api.route("/") +@api.route("") class CompetitionsList(Resource): @check_jwt(editor=True) def post(self): diff --git a/server/app/apis/components.py b/server/app/apis/components.py index c895f02322d16c8f603b97c7c60644db4ea36233..23d250256120f4bf600b10cd010b5de9aa67e0dc 100644 --- a/server/app/apis/components.py +++ b/server/app/apis/components.py @@ -35,7 +35,7 @@ class ComponentByID(Resource): return {}, codes.NO_CONTENT -@api.route("/") +@api.route("") @api.param("competition_id, slide_id") class ComponentList(Resource): @check_jwt(editor=True) diff --git a/server/app/apis/slides.py b/server/app/apis/slides.py index ef8cf89c463519b8d60d78ec37bc440c494b8018..9ca4a5f229488e03931ec544dd3ccf43406e5b9e 100644 --- a/server/app/apis/slides.py +++ b/server/app/apis/slides.py @@ -12,7 +12,7 @@ schema = SlideDTO.schema list_schema = SlideDTO.list_schema -@api.route("/") +@api.route("") @api.param("competition_id") class SlidesList(Resource): @check_jwt(editor=True) diff --git a/server/app/apis/teams.py b/server/app/apis/teams.py index 6596244c9085b850106e567a6974ced5428413aa..514748ae27c7ff685d2b1099d1bf710610928860 100644 --- a/server/app/apis/teams.py +++ b/server/app/apis/teams.py @@ -12,7 +12,7 @@ schema = TeamDTO.schema list_schema = TeamDTO.list_schema -@api.route("/") +@api.route("") @api.param("competition_id") class TeamsList(Resource): @check_jwt(editor=True) diff --git a/server/app/apis/users.py b/server/app/apis/users.py index 767f01cb441553e717aea58a202a03f0b50ece64..1bae000bc6821ff7c7ac3dde82474bd351c2fe4d 100644 --- a/server/app/apis/users.py +++ b/server/app/apis/users.py @@ -27,7 +27,7 @@ def edit_user(item_user, args): return dbc.edit.default(item_user, **args) -@api.route("/") +@api.route("") class UsersList(Resource): @check_jwt(editor=True) def get(self): diff --git a/server/app/database/controller/get.py b/server/app/database/controller/get.py index 15e908ef401c7e63b99c5767bcc5440ea5e7a820..96405b5ad28584bfb62268da894af9dd27a533a8 100644 --- a/server/app/database/controller/get.py +++ b/server/app/database/controller/get.py @@ -39,13 +39,10 @@ def code_by_code(code): def code_list(competition_id): """ Gets a list of all code objects associated with a the provided competition. """ - - team_view_id = 1 - join_filters = (Code.view_type_id == team_view_id) & (Team.id == Code.pointer) - filters = ((Code.view_type_id != team_view_id) & (Code.pointer == competition_id))( - (Code.view_type_id == team_view_id) & (competition_id == Team.competition_id) - ) - return Code.query.join(Team, join_filters, isouter=True).filter(filters).all() + # team_view_id = 1 + join_competition = Competition.id == Code.pointer + filters = Competition.id == competition_id + return Code.query.join(Competition, join_competition).filter(filters).all() ### Users ###