refactor: MedicalAppointments CRUD operations#249
Conversation
|
Claude finished @lethib's task in 3m 50s —— View job Review of PR #249 — MedicalAppointments CRUD operationsTasks
SummaryThis is a mechanical refactor migrating Two inline comments posted with actionable feedback:
Note: I was unable to run |
| MedicalAppointments { | ||
| date: ActiveValue::Set(NaiveDate::parse_from_str(¶ms.invoice_params.date, "%Y-%m-%d")?), | ||
| practitioner_office_id: ActiveValue::Set(params.invoice_params.office_id), | ||
| price_in_cents: ActiveValue::Set((params.invoice_params.amount * 100.0).round() as i32), | ||
| user_id: ActiveValue::Set(ctx.current_user.id), | ||
| patient_id: ActiveValue::Set(patient_id), | ||
| payment_method: ActiveValue::Set(params.payment_method), | ||
| ..Default::default() | ||
| } | ||
| .insert(&ctx.db) | ||
| .await?; |
There was a problem hiding this comment.
This call site still constructs the ActiveModel manually with raw ActiveValue::Set(...) fields, while the sibling create/update in src/controllers/medical_appointment.rs were migrated to the new medical_appointments::ActiveModel::builder() pattern in this same PR. For consistency (and to drop the now-unused ActiveModel as MedicalAppointments / ActiveValue imports), consider:
medical_appointments::ActiveModel::builder()
.set_date(NaiveDate::parse_from_str(¶ms.invoice_params.date, "%Y-%m-%d")?)
.set_practitioner_office_id(params.invoice_params.office_id)
.set_price_in_cents((params.invoice_params.amount * 100.0).round() as i32)
.set_user_id(ctx.current_user.id)
.set_patient_id(patient_id)
.set_payment_method(params.payment_method)
.insert(&ctx.db)
.await?;
No description provided.