-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1041 from centerofci/introduce-abstractions-api-n…
…amespace Introduce ui and db API namespaces
- Loading branch information
Showing
29 changed files
with
361 additions
and
343 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from mathesar.api.db.viewsets.columns import ColumnViewSet # noqa | ||
from mathesar.api.db.viewsets.constraints import ConstraintViewSet # noqa | ||
from mathesar.api.db.viewsets.data_files import DataFileViewSet # noqa | ||
from mathesar.api.db.viewsets.databases import DatabaseViewSet # noqa | ||
from mathesar.api.db.viewsets.records import RecordViewSet # noqa | ||
from mathesar.api.db.viewsets.schemas import SchemaViewSet # noqa | ||
from mathesar.api.db.viewsets.tables import TableViewSet # noqa |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from mathesar.api.ui.viewsets.databases import DatabaseViewSet # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from django_filters import rest_framework as filters | ||
from rest_framework import viewsets | ||
from rest_framework.decorators import action | ||
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin | ||
from rest_framework.response import Response | ||
|
||
from mathesar.models import Database | ||
from mathesar.api.dj_filters import DatabaseFilter | ||
from mathesar.api.pagination import DefaultLimitOffsetPagination | ||
|
||
from mathesar.api.serializers.databases import DatabaseSerializer, TypeSerializer | ||
|
||
|
||
class DatabaseViewSet(viewsets.GenericViewSet, ListModelMixin, RetrieveModelMixin): | ||
serializer_class = DatabaseSerializer | ||
pagination_class = DefaultLimitOffsetPagination | ||
filter_backends = (filters.DjangoFilterBackend,) | ||
filterset_class = DatabaseFilter | ||
|
||
def get_queryset(self): | ||
return Database.objects.all().order_by('-created_at') | ||
|
||
@action(methods=['get'], detail=True) | ||
def types(self, request, pk=None): | ||
database = self.get_object() | ||
serializer = TypeSerializer(database.supported_types, many=True) | ||
return Response(serializer.data) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.