project events updated
This commit is contained in:
parent
34400ffa4d
commit
48682b1914
|
|
@ -72,13 +72,11 @@ class BuildDecisionBookProjectItemsUpdateEventMethods(MethodToEvent):
|
||||||
requester: Union[EmployeeTokenObject, OccupantTokenObject],
|
requester: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||||
decision_book_project_items: UpdateBuildDecisionBookProjectItems,
|
decision_book_project_items: UpdateBuildDecisionBookProjectItems,
|
||||||
):
|
):
|
||||||
response = BuildDecisionBookProjectItems.update_item(
|
raise BuildDecisionBookProjectItems.raise_http_exception(
|
||||||
requester=requester,
|
status_code="HTTP_403_FORBIDDEN",
|
||||||
decision_book_project_items=decision_book_project_items,
|
error_case="UNAUTHORIZED",
|
||||||
)
|
message=f"No permission to update decision book project items",
|
||||||
return AlchemyJsonResponse(
|
data={}
|
||||||
message="Build Decision Book Project Items Update",
|
|
||||||
result=response,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,11 @@ class ProjectEmployee(AddEventFunctionality):
|
||||||
service_code = "SRO-PRJ-EMP"
|
service_code = "SRO-PRJ-EMP"
|
||||||
related_code = "PRJ-EMP"
|
related_code = "PRJ-EMP"
|
||||||
events = [
|
events = [
|
||||||
{"function_code": ""},
|
{"function_code": "7101b5ca-8bef-40f9-8b4d-646d9994e18f"},
|
||||||
|
{"function_code": "96459b36-37f2-4d5b-8370-c459058d5bce"},
|
||||||
|
{"function_code": "ce3630e4-2bf9-4433-bdab-1ee72117e54b"},
|
||||||
|
{"function_code": "b27e4fd0-6e3e-441b-9b33-806ac7082444"},
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,11 @@ class ProjectFinanceResponsible(AddEventFunctionality):
|
||||||
service_code = "SRO-PRJ-FIN"
|
service_code = "SRO-PRJ-FIN"
|
||||||
related_code = "PRJ-FIN"
|
related_code = "PRJ-FIN"
|
||||||
events = [
|
events = [
|
||||||
{"function_code": ""},
|
{"function_code": "96459b36-37f2-4d5b-8370-c459058d5bce"},
|
||||||
|
{"function_code": "ce3630e4-2bf9-4433-bdab-1ee72117e54b"},
|
||||||
|
{"function_code": "b27e4fd0-6e3e-441b-9b33-806ac7082444"},
|
||||||
|
{"function_code": "7101b5ca-8bef-40f9-8b4d-646d9994e18f"},
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,14 @@ class ProjectLeader(AddEventFunctionality):
|
||||||
related_code = "PRJ-LDR"
|
related_code = "PRJ-LDR"
|
||||||
|
|
||||||
events = [
|
events = [
|
||||||
{"function_code": "b8e44bb2-f157-4dd5-8a24-0e02db4877c9"},
|
{"function_code": "b27e4fd0-6e3e-441b-9b33-806ac7082444"},
|
||||||
{"function_code": "bfe3ef13-030f-495f-b692-94bcb746d700"},
|
{"function_code": "ce3630e4-2bf9-4433-bdab-1ee72117e54b"},
|
||||||
|
{"function_code": "a83a83fe-8446-4c60-9ae5-d1c06adbf626"},
|
||||||
{"function_code": "444d67a0-b3a8-4ca2-9d8d-f1acc75011e0"},
|
{"function_code": "444d67a0-b3a8-4ca2-9d8d-f1acc75011e0"},
|
||||||
{"function_code": "9c88e314-84e8-435e-8c1e-6a5aae80b2e6"},
|
{"function_code": "9c88e314-84e8-435e-8c1e-6a5aae80b2e6"},
|
||||||
{"function_code": "7fbd18a0-c099-4494-ada1-bb23e39bb141"},
|
{"function_code": "7fbd18a0-c099-4494-ada1-bb23e39bb141"},
|
||||||
{"function_code": "a122e84a-5556-4bf7-b680-1f47c438d4f7"},
|
{"function_code": "a122e84a-5556-4bf7-b680-1f47c438d4f7"},
|
||||||
|
{"function_code": "7101b5ca-8bef-40f9-8b4d-646d9994e18f"},
|
||||||
]
|
]
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,10 @@ class ProjectResponsible(AddEventFunctionality):
|
||||||
service_code = "SRO-PRJ-RES"
|
service_code = "SRO-PRJ-RES"
|
||||||
related_code = "PRJ-RES"
|
related_code = "PRJ-RES"
|
||||||
events = [
|
events = [
|
||||||
{"function_code": ""},
|
{"function_code": "96459b36-37f2-4d5b-8370-c459058d5bce"},
|
||||||
|
{"function_code": "ce3630e4-2bf9-4433-bdab-1ee72117e54b"},
|
||||||
|
{"function_code": "b27e4fd0-6e3e-441b-9b33-806ac7082444"},
|
||||||
|
{"function_code": "7101b5ca-8bef-40f9-8b4d-646d9994e18f"},
|
||||||
]
|
]
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,10 @@ class ProjectTechnical(AddEventFunctionality):
|
||||||
service_code = "SRO-PRJ-TEC"
|
service_code = "SRO-PRJ-TEC"
|
||||||
related_code = "PRJ-TEC"
|
related_code = "PRJ-TEC"
|
||||||
events = [
|
events = [
|
||||||
{"function_code": ""},
|
{"function_code": "96459b36-37f2-4d5b-8370-c459058d5bce"},
|
||||||
|
{"function_code": "ce3630e4-2bf9-4433-bdab-1ee72117e54b"},
|
||||||
|
{"function_code": "b27e4fd0-6e3e-441b-9b33-806ac7082444"},
|
||||||
|
{"function_code": "7101b5ca-8bef-40f9-8b4d-646d9994e18f"},
|
||||||
]
|
]
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from pydantic import BaseModel
|
|
||||||
from api_validations.core_validations import BaseModelRegular
|
from api_validations.core_validations import BaseModelRegular
|
||||||
from api_validations.validations_request import (
|
from api_validations.validations_request import (
|
||||||
PydanticBaseModel,
|
PydanticBaseModel,
|
||||||
|
|
@ -7,9 +6,9 @@ from api_validations.validations_request import (
|
||||||
|
|
||||||
|
|
||||||
class InsertBuildDecisionBookProjectItems(BaseModelRegular):
|
class InsertBuildDecisionBookProjectItems(BaseModelRegular):
|
||||||
|
build_decision_book_project_uu_id: str
|
||||||
item_header: str
|
item_header: str
|
||||||
item_comment: str
|
item_comment: str
|
||||||
build_decision_book_project_uu_id: str
|
|
||||||
attachment_pdf_path: Optional[str] = None
|
attachment_pdf_path: Optional[str] = None
|
||||||
item_objection: Optional[str] = None
|
item_objection: Optional[str] = None
|
||||||
|
|
||||||
|
|
@ -66,7 +65,7 @@ class UpdateBuildDecisionBookProjects(PydanticBaseModel):
|
||||||
build_decision_book_project_uu_id: str
|
build_decision_book_project_uu_id: str
|
||||||
is_out_sourced: Optional[bool] = False
|
is_out_sourced: Optional[bool] = False
|
||||||
project_note: Optional[str] = None
|
project_note: Optional[str] = None
|
||||||
decision_book_pdf_path: Optional[str] = None
|
# decision_book_pdf_path: Optional[str] = None
|
||||||
status_id: Optional[int] = None
|
status_id: Optional[int] = None
|
||||||
resp_company_fix_wage: Optional[float] = None
|
resp_company_fix_wage: Optional[float] = None
|
||||||
contact_agreement_path: Optional[str] = None
|
contact_agreement_path: Optional[str] = None
|
||||||
|
|
@ -78,7 +77,7 @@ class UpdateBuildDecisionBookProjects(PydanticBaseModel):
|
||||||
|
|
||||||
class ApprovalsBuildDecisionBookProjects(PydanticBaseModel):
|
class ApprovalsBuildDecisionBookProjects(PydanticBaseModel):
|
||||||
build_decision_book_project_uu_id: str
|
build_decision_book_project_uu_id: str
|
||||||
final_price_list: list[dict] # {"date": "2021-01-01", "price": 1000}
|
final_price_list: list[dict] # {"date": "2021-01-01", "price": 1000}
|
||||||
project_stop_date: str
|
project_stop_date: str
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
"max_floor" : 3,
|
"max_floor" : 3,
|
||||||
"underground_floor" : 0,
|
"underground_floor" : 0,
|
||||||
"build_date" : "1969-12-31T22:00:00.000Z",
|
"build_date" : "1969-12-31T22:00:00.000Z",
|
||||||
"decision_period_date" : "1974-06-30T21:00:00.000Z",
|
"decision_period_date" : "1974-07-01T00:00:00.000Z",
|
||||||
"tax_no" : "5",
|
"tax_no" : "5",
|
||||||
"lift_count" : 0,
|
"lift_count" : 0,
|
||||||
"heating_system" : true,
|
"heating_system" : true,
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,66 @@
|
||||||
|
|
||||||
from api_validations.validations_request import (
|
from api_validations.validations_request import (
|
||||||
InsertBuildDecisionBookProjects,
|
|
||||||
InsertBuildDecisionBookProjectItems,
|
InsertBuildDecisionBookProjectItems,
|
||||||
|
UpdateBuildDecisionBookProjects,
|
||||||
|
ApprovalsBuildDecisionBookProjects,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def create_decision_book_items(decision_book_items, requester):
|
def generate_update_project_item(**kwargs):
|
||||||
|
return {
|
||||||
|
"build_decision_book_project_uu_id": kwargs.get("build_decision_book_project_uu_id", None),
|
||||||
|
"is_out_sourced": kwargs.get("is_out_sourced", False),
|
||||||
|
"project_note": kwargs.get("project_note", None),
|
||||||
|
# "decision_book_pdf_path": str(kwargs.get("decision_book_pdf_path", None)),
|
||||||
|
"status_id": kwargs.get("status_id", None),
|
||||||
|
"resp_company_fix_wage": kwargs.get("resp_company_fix_wage", None),
|
||||||
|
"contact_agreement_path": kwargs.get("contact_agreement_path", None),
|
||||||
|
"contact_agreement_date": kwargs.get("contact_agreement_date", None),
|
||||||
|
"contact_uu_id": kwargs.get("contact_uu_id", None),
|
||||||
|
"resp_company_uu_id": kwargs.get("resp_company_uu_id", None),
|
||||||
|
"approved_price": kwargs.get("approved_price", None),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def generate_approval_project_item(**kwargs):
|
||||||
|
return {
|
||||||
|
"build_decision_book_project_uu_id": kwargs.get("build_decision_book_project_uu_id", None),
|
||||||
|
"final_price_list": kwargs.get("final_price_list", []),
|
||||||
|
"project_stop_date": kwargs.get("project_stop_date", None),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def generate_insert_project_item(**kwargs):
|
||||||
|
return {
|
||||||
|
"build_decision_book_project_uu_id": kwargs.get("build_decision_book_project_uu_id", None),
|
||||||
|
"item_header": kwargs.get("item_header", ""),
|
||||||
|
"item_comment": kwargs.get("item_comment", ""),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def create_decision_book_items(requester, insert_project_item):
|
||||||
response = requester.post(
|
response = requester.post(
|
||||||
endpoint="/build/decision_book/items/create",
|
endpoint="/build/decision_book/project/items/create",
|
||||||
data=decision_book_items,
|
data=insert_project_item
|
||||||
)
|
)
|
||||||
print("text", response.text)
|
print("text", response.text)
|
||||||
print("json", response.json())
|
print("json", response.json())
|
||||||
return response.json()
|
return response.json()
|
||||||
|
|
||||||
|
|
||||||
def approve_build_decision_book_project():
|
def update_decision_book_project(requester, update_project_item):
|
||||||
|
response = requester.post(
|
||||||
return
|
endpoint="/build/decision_book/project/update",
|
||||||
|
data=update_project_item
|
||||||
|
|
||||||
def approve_build_decision_book_project_item_create(requester):
|
|
||||||
requester.post(
|
|
||||||
endpoint="/build/decision_book/project/items/create",
|
|
||||||
data=dict(
|
|
||||||
build_decision_book_project_item_uu_id="",
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
print("text", response.text)
|
||||||
|
print("json", response.json())
|
||||||
|
|
||||||
|
|
||||||
|
def approve_build_decision_book_project_approval(requester, approval_project_item):
|
||||||
|
response = requester.post(
|
||||||
|
endpoint="/build/decision_book/project/approval",
|
||||||
|
data=approval_project_item
|
||||||
|
)
|
||||||
|
print("text", response.text)
|
||||||
|
print("json", response.json())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue