feat:add monitor secondary physical progress
This commit is contained in:
@@ -9,5 +9,6 @@ class TaskEnv:
|
|||||||
CLN_BILL = 'bill'
|
CLN_BILL = 'bill'
|
||||||
CLN_MONITOR_PYSICAL = 'monitor_physical'
|
CLN_MONITOR_PYSICAL = 'monitor_physical'
|
||||||
CLN_MONITOR_RIAL = 'monitor_rial'
|
CLN_MONITOR_RIAL = 'monitor_rial'
|
||||||
|
CLN_MONITOR_SECONDARY = 'monitor_secondary'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,3 +15,6 @@ class PhysicalProgressModel(BaseModel):
|
|||||||
medium_progress:Optional[int] = Field(description="متوسط پیشرفت فیزیکی ماهانه از ابتدا تا کنون")
|
medium_progress:Optional[int] = Field(description="متوسط پیشرفت فیزیکی ماهانه از ابتدا تا کنون")
|
||||||
deviation:Optional[int] = Field(description="انحراف از برنامه")
|
deviation:Optional[int] = Field(description="انحراف از برنامه")
|
||||||
date_at:Optional[datetime.datetime] = Field(description="تاریخ گزارش پیشرفت")
|
date_at:Optional[datetime.datetime] = Field(description="تاریخ گزارش پیشرفت")
|
||||||
|
last_month:Optional[int] = Field(description='واقعی ماه اخیر')
|
||||||
|
last_three_month:Optional[int] = Field(description='واقعی ماه اخیر')
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import uuid
|
||||||
|
from datetime import datetime
|
||||||
|
from typing import Optional, Literal
|
||||||
|
|
||||||
|
from pydantic import Field
|
||||||
|
|
||||||
|
from core.models.base import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
class SecondaryProgressModel(BaseModel):
|
||||||
|
id: Optional[uuid.UUID] = Field(alias='_id')
|
||||||
|
project_id: Optional[uuid.UUID] = Field(description="کد شناسایی پروژه در این فیلد قرار می گیرد")
|
||||||
|
title:Optional[str] = Field(description='عنوان در این فیلد قرار میگیرد')
|
||||||
|
weight:Optional[int]=Field(description='وزن در این فیلد قرار می گیرد')
|
||||||
|
program: Optional[int] = Field(description=" برنامه ای")
|
||||||
|
real: Optional[int] = Field(description=" واقعی")
|
||||||
|
deviation:Optional[int] = Field(description="انحراف از برنامه")
|
||||||
|
date_at:Optional[datetime] = Field(description="تاریخ گزارش پیشرفت")
|
||||||
|
last_month:Optional[int] = Field(description='واقعی ماه اخیر')
|
||||||
|
collection:Optional[Literal['all','work','various','secondary_building','block']] = Field(description="""
|
||||||
|
all: کلی
|
||||||
|
work: پیشرفت جبهه های کاری
|
||||||
|
various: پیشرفت رشته های مختلف
|
||||||
|
secondary_building: پیشرفت ساختمان های جنبی
|
||||||
|
block: پیشرفت بلوک ها
|
||||||
|
""")
|
||||||
@@ -16,3 +16,5 @@ class RialProgressModel(BaseModel):
|
|||||||
last_status_pyment:Optional[int] = Field(description='آخرین صورت وضعیت موقت پرداخت شده:')
|
last_status_pyment:Optional[int] = Field(description='آخرین صورت وضعیت موقت پرداخت شده:')
|
||||||
last_adjustment_verify:Optional[int]=Field(description='آخرین تعدیل تائید شده')
|
last_adjustment_verify:Optional[int]=Field(description='آخرین تعدیل تائید شده')
|
||||||
last_adjustment_payment:Optional[int] = Field(description='آخرین تعدیل پرداخت شده')
|
last_adjustment_payment:Optional[int] = Field(description='آخرین تعدیل پرداخت شده')
|
||||||
|
last_month:Optional[int] = Field(description='واقعی ماه اخیر')
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import uuid
|
||||||
|
|
||||||
|
from app.config import TaskEnv
|
||||||
|
from app.models.monitor_physical_secondary_progress import SecondaryProgressModel
|
||||||
|
from core.repositories.base import BaseRepository
|
||||||
|
from core.service.mongo_db import use_collection
|
||||||
|
|
||||||
|
class SecondaryProgressRepository(BaseRepository):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__(collection=TaskEnv.CLN_MONITOR_SECONDARY, model=SecondaryProgressModel)
|
||||||
|
|
||||||
|
async def last_record(self,project_id:uuid.UUID):
|
||||||
|
last = await use_collection(TaskEnv.CLN_MONITOR_SECONDARY).find({'project_id':project_id}).sort("$natural", -1).to_list(None)
|
||||||
|
if last:
|
||||||
|
return last[0]
|
||||||
|
else:
|
||||||
|
return {}
|
||||||
@@ -10,4 +10,5 @@ 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 *
|
from .monitor_rial import *
|
||||||
|
from .monitor_secondary import *
|
||||||
@@ -34,10 +34,10 @@ def update(_id: UUID, coding: ThisModel = Body(...)):
|
|||||||
def get(_id: UUID):
|
def get(_id: UUID):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@router.delete('/{_id}', response_model=ThisModel, tags=_tag_base)
|
# @router.delete('/{_id}', response_model=ThisModel, tags=_tag_base)
|
||||||
@shrink(repo.delete)
|
# @shrink(repo.delete)
|
||||||
def delete(_id: UUID):
|
# def delete(_id: UUID):
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
@router.post('', response_model=TableEngineExport[ThisModel], tags=_tag_base)
|
@router.post('', response_model=TableEngineExport[ThisModel], tags=_tag_base)
|
||||||
@shrink(repo.fetch)
|
@shrink(repo.fetch)
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ def update(_id: UUID, coding: ThisModel = Body(...)):
|
|||||||
def get(_id: UUID):
|
def get(_id: UUID):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@router.delete('/{_id}', response_model=ThisModel, tags=_tag_base)
|
# @router.delete('/{_id}', response_model=ThisModel, tags=_tag_base)
|
||||||
@shrink(repo.delete)
|
# @shrink(repo.delete)
|
||||||
def delete(_id: UUID):
|
# def delete(_id: UUID):
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
@router.post('', response_model=TableEngineExport[ThisModel], tags=_tag_base)
|
@router.post('', response_model=TableEngineExport[ThisModel], tags=_tag_base)
|
||||||
@shrink(repo.fetch)
|
@shrink(repo.fetch)
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
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 core.app import app
|
||||||
|
from core.utils.router import generate_router, shrink
|
||||||
|
from core.utils.table_engine import TableEngineExport, TableEngineRequestType
|
||||||
|
|
||||||
|
ThisModel = SecondaryProgressModel
|
||||||
|
router_base_url = 'monitor-secondary'
|
||||||
|
_tag_base = [router_base_url]
|
||||||
|
router = generate_router(router_base_url, auth_dependencies=False, version='v2')
|
||||||
|
repo = SecondaryProgressRepository()
|
||||||
|
|
||||||
|
@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