feat:get sub for monitor physical secondry

This commit is contained in:
shahzeydyfah
2024-06-23 00:26:31 +03:30
parent b8d228020b
commit a104b8efcf
4 changed files with 97 additions and 14 deletions
+41 -5
View File
@@ -2,26 +2,62 @@ from uuid import UUID
from fastapi import Body
from app.models.monitor_physical_secondary_progress import SecondaryProgressModel
from app.repositories.monitor_physical_secondary_progress import SecondaryProgressRepository
from app.models.monitor_physical_secondary_progress import SecondaryProgressModel, SubSecondaryProgressModel, LastRecord
from app.repositories.monitor_physical_secondary_progress import SecondaryProgressRepository, \
SubSecondaryProgressRepository
from core.app import app
from core.utils.router import generate_router, shrink
from core.utils.table_engine import TableEngineExport, TableEngineRequestType
ThisModel = SecondaryProgressModel
ThisSubModel = SubSecondaryProgressModel
router_base_url = 'monitor-secondary'
_tag_base = [router_base_url]
router = generate_router(router_base_url, auth_dependencies=False, version='v2')
repo = SecondaryProgressRepository()
repo_sub = SubSecondaryProgressRepository()
@router.post('/sub/create', response_model=ThisSubModel, tags=_tag_base, description='ایجاد زیر مجموعه پیشرفت فیزیکی فرعی')
@shrink(repo_sub.create)
def create_sub(coding: ThisSubModel = Body(...)):
pass
@router.get('/sub/list/{parent_id}', response_model=list[ThisSubModel], tags=_tag_base, description='گرفتن زیر مجموعه پیشرفت فیزیکی فرعی')
@shrink(repo_sub.get_list_by_parent_id)
def get_list_by_parent_id(parent_id: UUID):
pass
@router.post('/sub/last', response_model=ThisSubModel, tags=_tag_base, description='گرفتن زیر مجموعه پیشرفت فیزیکی فرعی')
@shrink(repo_sub.last_record)
def last_record(last:LastRecord):
pass
@router.put('/sub/{_id}', response_model=ThisSubModel, tags=_tag_base, description='ویرایش زیر مجموعه پیشرفت فیزیکی فرعی')
@shrink(repo_sub.update)
def update_sub(_id: UUID, coding: ThisSubModel = Body(...)):
pass
@router.get('/sub/{_id}', response_model=ThisSubModel, tags=_tag_base, description='گرفتن زیر مجموعه پیشرفت فیزیکی فرعی')
@shrink(repo_sub.get)
def get_sub(_id: UUID):
pass
@router.delete('/sub/{_id}', response_model=ThisSubModel, tags=_tag_base)
@shrink(repo_sub.delete)
def delete_sub(_id: UUID):
pass
@router.post('/sub', response_model=TableEngineExport[ThisSubModel], tags=_tag_base, description='زیر مجموعه پیشرفت فیزیکی فرعی')
@shrink(repo_sub.fetch)
def fetch_sub(body: TableEngineRequestType = Body(...)):
pass
@router.post('/create', response_model=ThisModel, tags=_tag_base, description='پیشرفت فیزیکی فرعی')
@shrink(repo.create)
def create(coding: ThisModel = Body(...)):
pass
@router.post('/last/{project_id}', response_model=ThisModel, tags=_tag_base, description='پیشرفت فیزیکی فرعی')
@shrink(repo.last_record)
def last_record(project_id:UUID):
@router.get('/list/{_id}', response_model=ThisModel, tags=_tag_base, description='پیشرفت فیزیکی فرعی')
@shrink(repo.get_list)
def get_list(_id: UUID):
pass
@router.put('/{_id}', response_model=ThisModel, tags=_tag_base, description='پیشرفت فیزیکی فرعی')