Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add comments in aciniformes_backend/routes #26

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions aciniformes_backend/routes/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ async def create(
alert: AlertServiceInterface = Depends(alert_service),
_: dict[str] = Depends(UnionAuth(['pinger.alert.create'])),
) -> PostResponseSchema:
"""Создание уведомления."""
id_ = await alert.create(create_schema.model_dump(exclude_unset=True))
return PostResponseSchema(**create_schema.model_dump(), id=id_)

Expand All @@ -51,6 +52,7 @@ async def get_all(
alert: AlertServiceInterface = Depends(alert_service),
_: dict[str] = Depends(UnionAuth(['pinger.alert.read'])),
):
"""Возвращает все уведомления."""
res = await alert.get_all()
return res

Expand All @@ -61,6 +63,7 @@ async def get(
alert: AlertServiceInterface = Depends(alert_service),
_: dict[str] = Depends(UnionAuth(['pinger.alert.read'])),
):
"""Возвращает одно уведомление."""
try:
res = await alert.get_by_id(id)
except exc.ObjectNotFound:
Expand All @@ -75,6 +78,7 @@ async def update(
alert: AlertServiceInterface = Depends(alert_service),
_: dict[str] = Depends(UnionAuth(['pinger.alert.update'])),
):
"""Обновление уведомления по id."""
try:
res = await alert.update(id, update_schema.model_dump(exclude_unset=True))
except exc.ObjectNotFound:
Expand All @@ -88,4 +92,5 @@ async def delete(
alert: AlertServiceInterface = Depends(alert_service),
_: dict[str] = Depends(UnionAuth(['pinger.alert.delete'])),
):
"""удаление уведомления по id."""
await alert.delete(id)
9 changes: 9 additions & 0 deletions aciniformes_backend/routes/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ async def create(
fetcher: FetcherServiceInterface = Depends(fetcher_service),
_: dict[str] = Depends(UnionAuth(['pinger.fetcher.create'])),
):
"""
Создает новый сборщик.
"""
id_ = await fetcher.create(create_schema.model_dump())
return ResponsePostSchema(**create_schema.model_dump(), id=id_)

Expand All @@ -57,6 +60,9 @@ async def get_all(
fetcher: FetcherServiceInterface = Depends(fetcher_service),
_: dict[str] = Depends(UnionAuth(['pinger.fetcher.read'])),
):
"""
Возвращает все сборщики.
"""
res = await fetcher.get_all()
return res

Expand All @@ -67,6 +73,7 @@ async def get(
fetcher: FetcherServiceInterface = Depends(fetcher_service),
_: dict[str] = Depends(UnionAuth(['pinger.fetcher.read'])),
):
"""Получение одного сборщика по id"""
try:
res = await fetcher.get_by_id(id)
except exc.ObjectNotFound:
Expand All @@ -81,6 +88,7 @@ async def update(
fetcher: FetcherServiceInterface = Depends(fetcher_service),
_: dict[str] = Depends(UnionAuth(['pinger.fetcher.update'])),
):
"""Обновление одного сборика по id"""
try:
res = await fetcher.update(id, update_schema.model_dump(exclude_unset=True))
except exc.ObjectNotFound:
Expand All @@ -94,4 +102,5 @@ async def delete(
fetcher: FetcherServiceInterface = Depends(fetcher_service),
_: dict[str] = Depends(UnionAuth(['pinger.fetcher.delete'])),
):
"""Удаление одного сборика по id"""
await fetcher.delete(id)
Empty file added aciniformes_backend/routes/git
Empty file.
3 changes: 3 additions & 0 deletions aciniformes_backend/routes/mectric.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ async def create(
metric: MetricServiceInterface = Depends(metric_service),
_: dict[str] = Depends(UnionAuth(['pinger.metric.create'])),
):
"""Создание метрики."""
id_ = await metric.create(metric_schema.model_dump())
return ResponsePostSchema(**metric_schema.model_dump(), id=id_)

Expand All @@ -44,6 +45,7 @@ async def get_all(
metric: MetricServiceInterface = Depends(metric_service),
_: dict[str] = Depends(UnionAuth(['pinger.metric.read'])),
):
"""Получение всех метрик."""
res = await metric.get_all()
return res

Expand All @@ -54,6 +56,7 @@ async def get(
metric: MetricServiceInterface = Depends(metric_service),
_: dict[str] = Depends(UnionAuth(['pinger.metric.read'])),
):
"""Получение одной метрики по id."""
try:
res = await metric.get_by_id(id)
except exc.ObjectNotFound:
Expand Down
5 changes: 5 additions & 0 deletions aciniformes_backend/routes/reciever.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ async def create(
receiver: ReceiverServiceInterface = Depends(receiver_service),
_: dict[str] = Depends(UnionAuth(['pinger.reciever.create'])),
):
"""Создание ресивера."""
id_ = await receiver.create(create_schema.model_dump())
return PostResponseSchema(**create_schema.model_dump(), id=id_)

Expand All @@ -62,6 +63,7 @@ async def get_all(
receiver: ReceiverServiceInterface = Depends(receiver_service),
_: dict[str] = Depends(UnionAuth(['pinger.reciever.read'])),
):
"""Получить все ресиверы."""
res = await receiver.get_all()
return res

Expand All @@ -72,6 +74,7 @@ async def get(
receiver: ReceiverServiceInterface = Depends(receiver_service),
_: dict[str] = Depends(UnionAuth(['pinger.reciever.read'])),
):
"""Получение ресивера."""
try:
res = await receiver.get_by_id(id)
return res
Expand All @@ -86,6 +89,7 @@ async def update(
receiver: ReceiverServiceInterface = Depends(receiver_service),
_: dict[str] = Depends(UnionAuth(['pinger.reciever.update'])),
):
"""Обновление ресивера по id."""
try:
res = await receiver.update(id, update_schema.model_dump(exclude_unset=True))
except exc.ObjectNotFound:
Expand All @@ -99,4 +103,5 @@ async def delete(
receiver: ReceiverServiceInterface = Depends(receiver_service),
_: dict[str] = Depends(UnionAuth(['pinger.reciever.delete'])),
):
"""Удаление ресивера по id."""
await receiver.delete(id)
Loading