refactor: store typed WrapUpReport in domain, serialize in adapters
Some checks failed
CI / Check / Test (push) Failing after 45s
Some checks failed
CI / Check / Test (push) Failing after 45s
This commit is contained in:
@@ -134,8 +134,9 @@ pub async fn get_report(
|
||||
Path(id): Path<Uuid>,
|
||||
) -> impl IntoResponse {
|
||||
match get_wrapup::execute(&state.app_ctx, WrapUpId::from_uuid(id)).await {
|
||||
Ok(Some(record)) if record.status == WrapUpStatus::Ready => match record.report_json {
|
||||
Some(json) => {
|
||||
Ok(Some(record)) if record.status == WrapUpStatus::Ready => match record.report {
|
||||
Some(ref report) => {
|
||||
let json = serde_json::to_string(report).unwrap_or_default();
|
||||
(StatusCode::OK, [("content-type", "application/json")], json).into_response()
|
||||
}
|
||||
None => StatusCode::NOT_FOUND.into_response(),
|
||||
@@ -295,11 +296,8 @@ pub async fn get_user_wrapup_html(
|
||||
_ => return StatusCode::NOT_FOUND.into_response(),
|
||||
};
|
||||
|
||||
let report: WrapUpReport = match &record.report_json {
|
||||
Some(json) => match serde_json::from_str(json) {
|
||||
Ok(r) => r,
|
||||
Err(_) => return StatusCode::INTERNAL_SERVER_ERROR.into_response(),
|
||||
},
|
||||
let report = match record.report {
|
||||
Some(r) => r,
|
||||
None => return StatusCode::NOT_FOUND.into_response(),
|
||||
};
|
||||
|
||||
@@ -334,11 +332,8 @@ pub async fn get_global_wrapup_html(
|
||||
_ => return StatusCode::NOT_FOUND.into_response(),
|
||||
};
|
||||
|
||||
let report: WrapUpReport = match &record.report_json {
|
||||
Some(json) => match serde_json::from_str(json) {
|
||||
Ok(r) => r,
|
||||
Err(_) => return StatusCode::INTERNAL_SERVER_ERROR.into_response(),
|
||||
},
|
||||
let report = match record.report {
|
||||
Some(r) => r,
|
||||
None => return StatusCode::NOT_FOUND.into_response(),
|
||||
};
|
||||
|
||||
|
||||
@@ -602,7 +602,7 @@ impl domain::ports::WrapUpRepository for Panic {
|
||||
async fn set_complete(
|
||||
&self,
|
||||
_: &domain::value_objects::WrapUpId,
|
||||
_: &str,
|
||||
_: &domain::models::wrapup::WrapUpReport,
|
||||
) -> Result<(), DomainError> {
|
||||
panic!()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user