feat:add exist project by state
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import uuid
|
||||
|
||||
from app.config import TaskEnv
|
||||
from app.models.report import StatusReport, ReportCountry
|
||||
from core.service.mongo_db import use_collection
|
||||
@@ -42,3 +44,17 @@ class ReportRepository():
|
||||
count_type = await use_collection(TaskEnv.CLN_PROJECT).count_documents({'design.type_id':_inp.type_id})
|
||||
count_monitor_type = await use_collection(TaskEnv.CLN_PROJECT).count_documents({'monitor.base_information.type': _inp.monitor_type})
|
||||
return {'count_nature':count_nature,'count_type':count_type,'count_monitor_type':count_monitor_type}
|
||||
|
||||
async def exist_project_state(self):
|
||||
report = await use_collection(TaskEnv.CLN_PROJECT).aggregate([
|
||||
{
|
||||
},
|
||||
{
|
||||
'$group': {
|
||||
'_id': f"design.state",
|
||||
'count': {'$sum': 1}
|
||||
}
|
||||
}
|
||||
]).to_list(None)
|
||||
|
||||
return report
|
||||
@@ -23,4 +23,9 @@ def project_status_monitor(_inp: StatusReport):
|
||||
def report_country(_inp: ReportCountry):
|
||||
pass
|
||||
|
||||
@router.get('/exist_state', tags=_tag_base)
|
||||
@shrink(repo.exist_project_state)
|
||||
def exist_project_state():
|
||||
pass
|
||||
|
||||
app.include_router(router)
|
||||
Reference in New Issue
Block a user