Skip to content

Commit

Permalink
Fix ts gen error (#12)
Browse files Browse the repository at this point in the history
* Add serializer class for PingView

* Run isort
  • Loading branch information
tohtsky authored Jan 10, 2022
1 parent a78f010 commit 383ccdd
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
2 changes: 2 additions & 0 deletions backend/recotem/recotem/api/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from .auth import UserDetailsSerializer
from .data import TrainingDataSerializer
from .ping import PingSerializer
from .project import ProjectSerializer, ProjectSummarySerializer
from .trained_model import TrainedModelSerializer
from .tuning_job import ParameterTuningJobSerializer
Expand Down Expand Up @@ -72,4 +73,5 @@ class Meta:
"TaskLogSerializer",
"ModelConfigurationSerializer",
"UserDetailsSerializer",
"PingSerializer",
)
5 changes: 5 additions & 0 deletions backend/recotem/recotem/api/serializers/ping.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from rest_framework import serializers


class PingSerializer(serializers.Serializer):
success = serializers.BooleanField()
8 changes: 4 additions & 4 deletions backend/recotem/recotem/api/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
EvaluationConfigSerializer,
ModelConfigurationSerializer,
ParameterTuningJobSerializer,
PingSerializer,
ProjectSummarySerializer,
SplitConfigSerializer,
TaskLogSerializer,
TrainingDataSerializer,
Expand Down Expand Up @@ -153,16 +155,14 @@ class TaskLogViewSet(viewsets.ReadOnlyModelViewSet):
filterset_class = TaskLogFilter


from recotem.api.serializers.project import ProjectSummarySerializer


class PingView(APIView):
authentication_classes = []
permission_classes = []

@extend_schema(responses={200: PingSerializer})
def get(self, request):
try:
conn = connections["default"]
_ = connections["default"]
return Response(dict(success=True))
except ConnectionDoesNotExist:
raise APIException(detail=dict(success=False), code=400)
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/api/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@ export interface components {
/** Designates that this user has all permissions without explicitly assigning them. */
is_superuser?: boolean;
};
Ping: {
success: boolean;
};
Project: {
id: number;
ins_datetime: string;
Expand Down Expand Up @@ -1226,8 +1229,11 @@ export interface operations {
};
ping_retrieve: {
responses: {
/** No response body */
200: unknown;
200: {
content: {
"application/json": components["schemas"]["Ping"];
};
};
};
};
project_list: {
Expand Down
13 changes: 12 additions & 1 deletion schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,11 @@ paths:
- ping
responses:
'200':
description: No response body
content:
application/json:
schema:
$ref: '#/components/schemas/Ping'
description: ''
/api/project/:
get:
operationId: project_list
Expand Down Expand Up @@ -2702,6 +2706,13 @@ components:
title: Superuser status
description: Designates that this user has all permissions without explicitly
assigning them.
Ping:
type: object
properties:
success:
type: boolean
required:
- success
Project:
type: object
properties:
Expand Down

0 comments on commit 383ccdd

Please sign in to comment.