Skip to content

Commit

Permalink
Merge pull request #170 from ImMin5/feature-cost-report
Browse files Browse the repository at this point in the history
Fix cost_report_data_service and manager
  • Loading branch information
ImMin5 authored Jan 29, 2024
2 parents e6f784e + 7a4a267 commit d71ec90
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 208 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,30 +72,17 @@ def _create_cost_report_run_task(self):
"metadata": {"token": self._token},
"method": "create_cost_report_by_cost_report_config",
"params": {"params": {}},
},
{
"locator": "SERVICE",
"name": "CostReportDataService",
"metadata": {"token": self._token},
"method": "create_cost_report_data_by_cost_report_config",
"params": {"params": {}},
},
}
],
}
print(
f"{utils.datetime_to_iso8601(datetime.utcnow())} [INFO] [create_task] create_cost_report_by_cost_report_config => START"
)
print(
f"{utils.datetime_to_iso8601(datetime.utcnow())} [INFO] [create_task] create_cost_report_data_by_cost_report_config => START"
)
return [stp]
else:
print(
f"{utils.datetime_to_iso8601(datetime.utcnow())} [INFO] [create_task] create_cost_report_by_cost_report_config => SKIP"
)
print(
f"{utils.datetime_to_iso8601(datetime.utcnow())} [INFO] [create_task] create_cost_report_data_by_cost_report_config => SKIP"
)
print(
f"{utils.datetime_to_iso8601(datetime.utcnow())} [INFO] [create_task] data_source_sync_time: {self._data_source_sync_hour} hour (UTC)"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self, *args, **kwargs):
def create_cost_report_data(self, params: dict):
def _rollback(vo: CostReportData):
_LOGGER.info(
f"[create_cost_report_data._rollback] Delete cost report data : {vo.cost_report_name}, {vo.cost_report_data_id} "
f"[create_cost_report_data._rollback] Delete cost report data : {vo.cost_report_id}, {vo.cost_report_data_id} "
)
vo.delete()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class CostReportData(MongoModel):
cost_report_data_id = StringField(max_length=40, generate_id="cdr", unique=True)
cost = DictField(default={})
cost_report_name = StringField(max_length=255)
issue_date = StringField(max_length=20)
report_year = StringField(max_length=20)
report_month = StringField(max_length=40)
is_confirmed = BooleanField(default=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class CostReportDataResponse(BaseModel):
cost_report_data_id: Union[str, None] = None
cost: Union[dict, None] = None
cost_report_name: Union[str, None] = None
issue_date: Union[str, None] = None
report_year: Union[str, None] = None
report_month: Union[str, None] = None
is_confirmed: Union[bool, None] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,6 @@ def run(self, params: CostReportConfigRunRequest) -> None:
params.cost_report_config_id, params.domain_id
)

cost_report_data_service = CostReportDataService()
cost_report_data_service.create_cost_report_data(cost_report_config_vo)

cost_report_service = CostReportService()
cost_report_service.create_cost_report(cost_report_config_vo)

Expand Down
Loading

0 comments on commit d71ec90

Please sign in to comment.