source.py 1.29 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from drf_yasg.utils import swagger_auto_schema

from metagenedb.apps.catalog.models import Source
from metagenedb.apps.catalog.serializers import SourceSerializer

from .base import BulkViewSet


class SourceViewSet(BulkViewSet):
    queryset = Source.objects.all()
    serializer_class = SourceSerializer
    lookup_field = 'slug'

    @swagger_auto_schema(
        operation_description="List all gene sources",
        operation_summary="API to list all gene sources of the catalog.",
        tags=['Source'],
    )
    def list(self, *args, **kwargs):
        return super().list(*args, **kwargs)

    @swagger_auto_schema(
        operation_description="Retrieve gene source from a name",
        operation_summary="API to retrieve gene source.",
        tags=['Source'],
    )
    def retrieve(self, *args, **kwargs):
        return super().retrieve(*args, **kwargs)

    @swagger_auto_schema(
        tags=['Source'],
    )
    def create(self, *args, **kwargs):
        return super().create(*args, **kwargs)

    @swagger_auto_schema(
        tags=['Source'],
    )
    def update(self, *args, **kwargs):
        return super().update(*args, **kwargs)

    @swagger_auto_schema(
        tags=['Source'],
    )
    def partial_update(self, *args, **kwargs):
        return super().partial_update(*args, **kwargs)