Skip to content

Commit

Permalink
Protect eqtl endpoing in same way as variant data
Browse files Browse the repository at this point in the history
  • Loading branch information
grosscol committed Nov 14, 2024
1 parent acce54b commit cb6a11b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions bravo_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def create_app(test_config=None):
variant_routes.bp.before_request(auth_routes.agreement_required)
region_routes.bp.before_request(auth_routes.agreement_required)
gene_routes.bp.before_request(auth_routes.agreement_required)
eqtl.bp.before_request(auth_routes.agreement_required)

# Setup routes to blueprints. Prefix "ui" are routes for the Vue user interface.
app.register_blueprint(status.bp, url_prefix='/ui')
Expand Down
8 changes: 3 additions & 5 deletions bravo_api/blueprints/eqtl/eqtl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from flask import current_app, Blueprint, jsonify, make_response, Response
from flask_cors import CORS
from webargs import fields
from webargs.flaskparser import FlaskParser
from marshmallow import RAISE
Expand All @@ -8,7 +7,6 @@

logger = logging.getLogger(__name__)
bp = Blueprint('eqtl', __name__)
CORS(bp)


class Parser(FlaskParser):
Expand All @@ -25,9 +23,9 @@ class Parser(FlaskParser):
}

ensg_argmap = {
'ensembl': fields.Str(required=True, validate=lambda x: len(x) > 15 and len(x) < 20,
error_messages={
'validator_failed': 'String length must be between 16 and 19.'})
'ensembl': fields.Str(required=True, validate=lambda x: len(x) > 12 and len(x) < 17,
error_messages={
'validator_failed': 'String length must be between 13 and 16.'})
}


Expand Down
2 changes: 0 additions & 2 deletions bravo_api/blueprints/structvar/structvar.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import logging
import pymongo
from flask import current_app, Blueprint, jsonify, make_response, Response
from flask_cors import CORS
from webargs import fields
from webargs.flaskparser import FlaskParser
from marshmallow import RAISE

logger = logging.getLogger(__name__)
bp = Blueprint('structvar', __name__)
CORS(bp)


class Parser(FlaskParser):
Expand Down

0 comments on commit cb6a11b

Please sign in to comment.