From 46c15983a22ef87aea1c8d4f2101725d5fc0c8e3 Mon Sep 17 00:00:00 2001 From: Gleb Samoylenko Date: Wed, 20 Mar 2024 23:00:15 +0300 Subject: [PATCH 1/2] add comments in aciniformes_backend/routes --- aciniformes_backend/routes/alert.py | 5 +++++ aciniformes_backend/routes/fetcher.py | 9 +++++++++ aciniformes_backend/routes/mectric.py | 3 +++ aciniformes_backend/routes/reciever.py | 5 +++++ 4 files changed, 22 insertions(+) diff --git a/aciniformes_backend/routes/alert.py b/aciniformes_backend/routes/alert.py index f15d393..83f331d 100644 --- a/aciniformes_backend/routes/alert.py +++ b/aciniformes_backend/routes/alert.py @@ -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_) @@ -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 @@ -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: @@ -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: @@ -88,4 +92,5 @@ async def delete( alert: AlertServiceInterface = Depends(alert_service), _: dict[str] = Depends(UnionAuth(['pinger.alert.delete'])), ): + """удаление уведомления по id.""" await alert.delete(id) diff --git a/aciniformes_backend/routes/fetcher.py b/aciniformes_backend/routes/fetcher.py index 30c8447..5866619 100644 --- a/aciniformes_backend/routes/fetcher.py +++ b/aciniformes_backend/routes/fetcher.py @@ -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_) @@ -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 @@ -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: @@ -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: @@ -94,4 +102,5 @@ async def delete( fetcher: FetcherServiceInterface = Depends(fetcher_service), _: dict[str] = Depends(UnionAuth(['pinger.fetcher.delete'])), ): + """Удаление одного сборика по id""" await fetcher.delete(id) diff --git a/aciniformes_backend/routes/mectric.py b/aciniformes_backend/routes/mectric.py index 37732b9..6469981 100644 --- a/aciniformes_backend/routes/mectric.py +++ b/aciniformes_backend/routes/mectric.py @@ -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_) @@ -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 @@ -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: diff --git a/aciniformes_backend/routes/reciever.py b/aciniformes_backend/routes/reciever.py index 6894a35..ec7efa0 100644 --- a/aciniformes_backend/routes/reciever.py +++ b/aciniformes_backend/routes/reciever.py @@ -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_) @@ -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 @@ -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 @@ -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: @@ -99,4 +103,5 @@ async def delete( receiver: ReceiverServiceInterface = Depends(receiver_service), _: dict[str] = Depends(UnionAuth(['pinger.reciever.delete'])), ): + """Удаление ресивера по id.""" await receiver.delete(id) From 7632739fda15a4ac2bad1b1479cf6675268d5eee Mon Sep 17 00:00:00 2001 From: Gleb Samoylenko Date: Wed, 20 Mar 2024 23:19:39 +0300 Subject: [PATCH 2/2] black to changed files --- aciniformes_backend/routes/git | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 aciniformes_backend/routes/git diff --git a/aciniformes_backend/routes/git b/aciniformes_backend/routes/git new file mode 100644 index 0000000..e69de29