feat(project):add CLN_PROJECT_PRICE_REPORT

This commit is contained in:
shahzeydyfah
2025-01-18 23:42:08 +03:30
parent 9701dc3cd5
commit 6998989e78
3 changed files with 16 additions and 2 deletions
+9 -1
View File
@@ -35,12 +35,20 @@ class ProjectRepository(BaseRepository[ProjectModel]):
coding.counter = last_project[0]["counter"]+1
code = self.create_code(coding)
coding.design.code = 'D'+code
coding.init_id().cu_at()
if coding.monitor:
coding.monitor.code = 'S'+code
coding.has_monitor = True
if coding.monitor.detail and coding.monitor.detail.first_amount :
price = {
'_id': uuid.uuid4(),
'project_id': coding.id,
'first_amount': coding.monitor.detail.first_amount
}
await use_collection(TaskEnv.CLN_PROJECT_PRICE_REPORT).insert_one(price)
else:
coding.has_monitor = False
coding.init_id().cu_at()
await use_collection(COLLECTION).insert_one(coding.mongo_dict())
return await self.get(coding.id)