feat:add monitor rial progress
This commit is contained in:
@@ -8,5 +8,6 @@ class TaskEnv:
|
|||||||
CLN_CONTRACT = 'contract'
|
CLN_CONTRACT = 'contract'
|
||||||
CLN_BILL = 'bill'
|
CLN_BILL = 'bill'
|
||||||
CLN_MONITOR_PYSICAL = 'monitor_physical'
|
CLN_MONITOR_PYSICAL = 'monitor_physical'
|
||||||
|
CLN_MONITOR_RIAL = 'monitor_rial'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import uuid
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
from pydantic import Field
|
||||||
|
|
||||||
|
from core.models.base import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
class RialProgressModel(BaseModel):
|
||||||
|
id: Optional[uuid.UUID] = Field(alias='_id')
|
||||||
|
project_id:Optional[uuid.UUID] = Field(description="کد شناسایی پروژه در این فیلد قرار می گیرد")
|
||||||
|
program:Optional[int] = Field(description=" برنامه ای")
|
||||||
|
real:Optional[int] = Field(description=" واقعی")
|
||||||
|
functional_status:Optional[int]= Field(description='کارکردی طبق صورت وضعیت')
|
||||||
|
last_status_verify:Optional[int] = Field(description='آخرین صورت وضعیت موقت تائید شده')
|
||||||
|
last_status_pyment:Optional[int] = Field(description='آخرین صورت وضعیت موقت پرداخت شده:')
|
||||||
|
last_adjustment_verify:Optional[int]=Field(description='آخرین تعدیل تائید شده')
|
||||||
|
last_adjustment_payment:Optional[int] = Field(description='آخرین تعدیل پرداخت شده')
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import uuid
|
||||||
|
|
||||||
|
from app.config import TaskEnv
|
||||||
|
from app.models.monitor_rial_progress import RialProgressModel
|
||||||
|
from core.repositories.base import BaseRepository
|
||||||
|
from core.service.mongo_db import use_collection
|
||||||
|
|
||||||
|
class RialProgressRepository(BaseRepository):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(collection=TaskEnv.CLN_MONITOR_RIAL, model=RialProgressModel)
|
||||||
|
|
||||||
|
async def last_record(self, project_id:uuid.UUID):
|
||||||
|
last = await use_collection(TaskEnv.CLN_MONITOR_RIAL).find({'project_id':project_id}).sort("$natural", -1).to_list(None)
|
||||||
|
if last:
|
||||||
|
return last[0]
|
||||||
|
else:
|
||||||
|
return {}
|
||||||
@@ -10,3 +10,4 @@ from .bill_delay import *
|
|||||||
from .contract import *
|
from .contract import *
|
||||||
# from .bill import *
|
# from .bill import *
|
||||||
from .monitor_physical import *
|
from .monitor_physical import *
|
||||||
|
from .monitor_rial import *
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
from uuid import UUID
|
||||||
|
|
||||||
|
from fastapi import Body
|
||||||
|
|
||||||
|
from app.models.monitor_rial_progress import RialProgressModel
|
||||||
|
from app.repositories.monitor_rial_progress import RialProgressRepository
|
||||||
|
from core.app import app
|
||||||
|
from core.utils.router import generate_router, shrink
|
||||||
|
from core.utils.table_engine import TableEngineExport, TableEngineRequestType
|
||||||
|
|
||||||
|
ThisModel = RialProgressModel
|
||||||
|
router_base_url = 'monitor-rial'
|
||||||
|
_tag_base = [router_base_url]
|
||||||
|
router = generate_router(router_base_url, auth_dependencies=False, version='v2')
|
||||||
|
repo = RialProgressRepository()
|
||||||
|
|
||||||
|
@router.post('/create', response_model=ThisModel, tags=_tag_base)
|
||||||
|
@shrink(repo.create)
|
||||||
|
def create(coding: ThisModel = Body(...)):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@router.post('/last/{project_id}', response_model=ThisModel, tags=_tag_base)
|
||||||
|
@shrink(repo.last_record)
|
||||||
|
def last_record(project_id:UUID):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@router.put('/{_id}', response_model=ThisModel, tags=_tag_base)
|
||||||
|
@shrink(repo.update)
|
||||||
|
def update(_id: UUID, coding: ThisModel = Body(...)):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@router.get('/{_id}', response_model=ThisModel, tags=_tag_base)
|
||||||
|
@shrink(repo.get)
|
||||||
|
def get(_id: UUID):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@router.delete('/{_id}', response_model=ThisModel, tags=_tag_base)
|
||||||
|
@shrink(repo.delete)
|
||||||
|
def delete(_id: UUID):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@router.post('', response_model=TableEngineExport[ThisModel], tags=_tag_base)
|
||||||
|
@shrink(repo.fetch)
|
||||||
|
def fetch(body: TableEngineRequestType = Body(...)):
|
||||||
|
pass
|
||||||
|
|
||||||
|
app.include_router(router)
|
||||||
Reference in New Issue
Block a user