-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into develop
- Loading branch information
Showing
41 changed files
with
279 additions
and
308 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
from .user import router as user_router # noqa | ||
from .achievement import router as achievement_router # noqa | ||
from .course import router as course_router # noqa | ||
from .examination import router as examination_router # noqa | ||
from .group import router as group_router # noqa | ||
from .notification import router as notification_router # noqa | ||
from .profile import router as profile_router # noqa | ||
from .tariff import router as tariff_router # noqa | ||
from .notification import router as notification_router # noqa | ||
from .examination import router as examination_router # noqa | ||
from .achievement import router as achievement_router # noqa | ||
from .course import router as course_router # noqa | ||
from .task import router as task_router # noqa | ||
from .user import router as user_router # 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
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
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 |
---|---|---|
@@ -1,39 +1,36 @@ | ||
from fastapi import APIRouter, Depends | ||
from sqlalchemy.ext.asyncio import AsyncSession | ||
|
||
from app.schemas.group import GroupRead, GroupCreate | ||
from app.api.validators import check_name_duplicate | ||
from app.core.db import get_async_session | ||
from app.crud import group_crud | ||
from app.api.validators import check_name_duplicate | ||
from app.schemas.group import GroupCreate, GroupRead | ||
from app.services.endpoints_services import delete_obj | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get('/', response_model=list[GroupRead]) | ||
@router.get("/", response_model=list[GroupRead]) | ||
async def get_all_groups( | ||
session: AsyncSession = Depends(get_async_session) | ||
session: AsyncSession = Depends(get_async_session), | ||
) -> list[GroupRead]: | ||
"""Возвращает все группы.""" | ||
return await group_crud.get_multi(session) | ||
|
||
|
||
@router.post('/', response_model=GroupRead) | ||
@router.post("/", response_model=GroupRead) | ||
async def create_group( | ||
group: GroupCreate, | ||
session: AsyncSession = Depends(get_async_session) | ||
group: GroupCreate, session: AsyncSession = Depends(get_async_session) | ||
): | ||
"""Создать группу""" | ||
await check_name_duplicate(group.name, group_crud, session) | ||
return await group_crud.create( | ||
obj_in=group, session=session | ||
) | ||
return await group_crud.create(obj_in=group, session=session) | ||
|
||
|
||
@router.delete('/{obj_id}') | ||
@router.delete("/{obj_id}") | ||
async def delete_group( | ||
obj_id: int, | ||
session: AsyncSession = Depends(get_async_session), | ||
obj_id: int, | ||
session: AsyncSession = Depends(get_async_session), | ||
): | ||
"""Удалить объект""" | ||
return await delete_obj(obj_id=obj_id, crud=group_crud, session=session) |
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
Oops, something went wrong.