mirror of
https://gitlab.com/megazordpobeda/DataRush.git
synced 2026-05-23 05:07:10 +00:00
feat: added submissions history, formatted
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from ninja import ModelSchema, Schema
|
||||
from ninja import ModelSchema
|
||||
|
||||
from apps.team.models import Team
|
||||
|
||||
@@ -6,10 +6,18 @@ from apps.team.models import Team
|
||||
class CreateTeamSchema(ModelSchema):
|
||||
class Meta:
|
||||
model = Team
|
||||
fields = ("name", "members",)
|
||||
fields = (
|
||||
"name",
|
||||
"members",
|
||||
)
|
||||
|
||||
|
||||
class TeamSchemaOut(ModelSchema):
|
||||
class Meta:
|
||||
model = Team
|
||||
fields = ("id", "name", "owner", "members", )
|
||||
fields = (
|
||||
"id",
|
||||
"name",
|
||||
"owner",
|
||||
"members",
|
||||
)
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
from http import HTTPStatus as status
|
||||
from uuid import UUID
|
||||
|
||||
from django.shortcuts import get_object_or_404
|
||||
from ninja import Router
|
||||
|
||||
from api.v1.schemas import BadRequestError, NotFoundError, UnauthorizedError
|
||||
from api.v1.team.schemas import CreateTeamSchema, TeamSchemaOut
|
||||
from apps.team.models import Team
|
||||
from api.v1.team.schemas import TeamSchemaOut, CreateTeamSchema
|
||||
from api.v1.schemas import UnauthorizedError, BadRequestError, NotFoundError
|
||||
|
||||
router = Router()
|
||||
|
||||
@@ -18,7 +17,7 @@ router = Router()
|
||||
400: BadRequestError,
|
||||
401: UnauthorizedError,
|
||||
},
|
||||
description="Create team. Note: members array must have team members uuid, default can be empty"
|
||||
description="Create team. Note: members array must have team members uuid, default can be empty",
|
||||
)
|
||||
def create_team(request, team_data: CreateTeamSchema) -> (int, TeamSchemaOut):
|
||||
team = Team(name=team_data.name, owner=request.auth)
|
||||
@@ -33,7 +32,7 @@ def create_team(request, team_data: CreateTeamSchema) -> (int, TeamSchemaOut):
|
||||
200: TeamSchemaOut,
|
||||
401: UnauthorizedError,
|
||||
404: NotFoundError,
|
||||
}
|
||||
},
|
||||
)
|
||||
def get_team(request, team_id: UUID) -> (int, TeamSchemaOut):
|
||||
return get_object_or_404(Team, pk=team_id)
|
||||
|
||||
Reference in New Issue
Block a user