feat:add parliament audit
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
class TaskEnv:
|
||||
CLN_AUDIT_STATUS = 'audit_status'
|
||||
CLN_AUDIT_PARLIAMENT = 'audit_parliament'
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import uuid
|
||||
from typing import Optional, Literal, List
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from core.models.base import BaseModel
|
||||
|
||||
|
||||
class ParliamentModel(BaseModel):
|
||||
id: Optional[uuid.UUID] = Field(alias='_id')
|
||||
project_id: uuid.UUID = Field(description='کد شناسایی پروژ')
|
||||
number: Optional[int | str] = Field(description="شماره صورت مجلس")
|
||||
description:Optional[str] = Field(description='موضوع صورت مجلس')
|
||||
count_row:Optional[int] = Field(description='تعداد ردیف صورت مجلس')
|
||||
field:Optional[List]=Field(description="""
|
||||
'electrical',
|
||||
'mechanic',
|
||||
'building',
|
||||
'other'
|
||||
""")
|
||||
location:Optional[str] = Field(description='موقعیت')
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
from app.config import TaskEnv
|
||||
from app.models.parliament_audit import ParliamentModel
|
||||
from core.repositories.base import BaseRepository
|
||||
|
||||
|
||||
class ParliamentRepository(BaseRepository):
|
||||
def __init__(self):
|
||||
super().__init__(collection=TaskEnv.CLN_AUDIT_PARLIAMENT,model=ParliamentModel)
|
||||
@@ -0,0 +1,34 @@
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import Body
|
||||
|
||||
from app.models.parliament_audit import ParliamentModel
|
||||
from app.repositories.parliament_audit import ParliamentRepository
|
||||
from core.utils.router import generate_router, shrink
|
||||
from core.utils.table_engine import TableEngineExport, TableEngineRequestType
|
||||
|
||||
ThisModel = ParliamentModel
|
||||
router_base_url = 'parl'
|
||||
_tag_base = [router_base_url]
|
||||
router = generate_router(router_base_url, auth_dependencies=False, version='v2')
|
||||
repo = ParliamentRepository()
|
||||
|
||||
@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
|
||||
Reference in New Issue
Block a user