feat:add price audit
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
class TaskEnv:
|
||||
CLN_AUDIT_STATUS = 'audit_status'
|
||||
CLN_AUDIT_PARLIAMENT = 'audit_parliament'
|
||||
CLN_AUDIT_PRICE = 'audit_price'
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import uuid
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from core.models.base import BaseModel
|
||||
|
||||
|
||||
class NewPriceModel(BaseModel):
|
||||
id: Optional[uuid.UUID] = Field(alias='_id')
|
||||
project_id: uuid.UUID = Field(description='کد شناسایی پروژ')
|
||||
number: Optional[int] = Field(description=" شماره آیتم")
|
||||
description: Optional[str] = Field(description='موضوع قیمت جدید')
|
||||
unit: Optional[str] = Field(description='واحد')
|
||||
count: Optional[int] = Field(description='تعداد')
|
||||
fee_day: Optional[int] = Field(description='بهای روز')
|
||||
fee_unit: Optional[int] = Field(description='بهای واحد مبنای پیمان')
|
||||
total_day: Optional[int] = Field(description=' بهای کل روز = تعداد * بهای واحد روز')
|
||||
total_unit: Optional[int] = Field(description=' بهای کل مبنای پیمان = تعداد * بهای واحد مبنای پیمان')
|
||||
field: Optional[str] = Field(description="""
|
||||
'electrical',
|
||||
'mechanic',
|
||||
'building',
|
||||
'other'
|
||||
""")
|
||||
location: Optional[str] = Field(description='موقعیت')
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
from app.config import TaskEnv
|
||||
from app.models.price_audit import NewPriceModel
|
||||
from core.repositories.base import BaseRepository
|
||||
|
||||
|
||||
|
||||
class PriceRepository(BaseRepository):
|
||||
def __init__(self):
|
||||
super().__init__(collection=TaskEnv.CLN_AUDIT_PRICE, model=NewPriceModel)
|
||||
@@ -3,3 +3,4 @@ from .grand_project import *
|
||||
from .design_progress import *
|
||||
from .register_status import *
|
||||
from .parliament_audit import *
|
||||
from .price_audit import *
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import Body
|
||||
|
||||
from app.models.price_audit import NewPriceModel
|
||||
from app.repositories.price_audit import PriceRepository
|
||||
from core.app import app
|
||||
from core.utils.router import generate_router, shrink
|
||||
from core.utils.table_engine import TableEngineExport, TableEngineRequestType
|
||||
|
||||
ThisModel = NewPriceModel
|
||||
router_base_url = 'audit_price'
|
||||
_tag_base = [router_base_url]
|
||||
router = generate_router(router_base_url, auth_dependencies=False, version='v2')
|
||||
repo = PriceRepository()
|
||||
|
||||
@router.post('/create', response_model=ThisModel, tags=_tag_base)
|
||||
@shrink(repo.create)
|
||||
def create(coding: ThisModel = Body(...)):
|
||||
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.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