feat:add list contract by project_id

This commit is contained in:
shahzeydyfah
2024-06-15 00:14:36 +03:30
parent 801742d466
commit 1aedfc818c
2 changed files with 11 additions and 0 deletions
+5
View File
@@ -61,3 +61,8 @@ class ContractRepository(BaseRepository):
}
},return_document=ReturnDocument.AFTER)
return result
async def get_list(self,project_id:uuid.UUID):
contract = await use_collection(TaskEnv.CLN_CONTRACT).find(
{"project_id": project_id}
).to_list(None)
return contract
+6
View File
@@ -1,3 +1,4 @@
from typing import List
from uuid import UUID
from fastapi import Body
@@ -39,6 +40,11 @@ def update_extention(contract_id: UUID,coding: ExtensionModel = Body(...)):
def create(coding: ContractModel = Body(...)):
pass
@router.get('/list/{project_id}', response_model=List[ContractModel], tags=_tag_base)
@shrink(repo.get_list)
def get_list(project_id:UUID):
pass
@router.put('/{_id}', response_model=ContractModel, tags=_tag_base)
@shrink(repo.update)