Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added missing public decorator to new api views #209

Merged
merged 1 commit into from
May 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions web/views/api.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
import json
import os

from io import StringIO

from django.conf import settings
from django.core.paginator import Paginator
from django.http import JsonResponse, HttpResponse, HttpResponseBadRequest

from ontobio import obograph_util, Ontology

from stronghold.decorators import public

from core.importer.datasets_exporter import DatasetsExporter
from core.importer.projects_exporter import ProjectsExporter

from core.models import User, Cohort, Dataset, Partner, Project, DiseaseTerm
from core.models.term_model import TermCategory, PhenotypeTerm, StudyTerm, GeneTerm
from core.utils import DaisyLogger

from elixir_daisy import settings
from ontobio import obograph_util, Ontology

from core.utils import DaisyLogger
from io import StringIO

logger = DaisyLogger(__name__)


"""
Rapido API method, we should probably use django rest framework if we want to develop API further.
"""


def users(request):
# "results": [
# {
Expand Down Expand Up @@ -59,7 +60,6 @@ def partners(request):

@public
def termsearch(request, category):

search = request.GET.get('search')
page = request.GET.get('page')

Expand Down Expand Up @@ -95,6 +95,7 @@ def termsearch(request, category):
}
})

@public
def datasets(request):
if 'API_KEY' not in request.GET:
return JsonResponse({
Expand Down Expand Up @@ -124,8 +125,9 @@ def datasets(request):
'status': 'Error',
'description': 'Something went wrong during exporting the datasets',
'more': str(e)
})
}, status=500)

@public
def projects(request):
if 'API_KEY' not in request.GET:
return JsonResponse({
Expand Down Expand Up @@ -155,4 +157,4 @@ def projects(request):
'status': 'Error',
'description': 'Something went wrong during exporting the projects',
'more': str(e)
})
}, status=500)