-
Notifications
You must be signed in to change notification settings - Fork 0
docs(value-objects): add documentation for MedicationFrequency value object #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2db2367
de2a751
591d400
1688310
93be12b
a8f9ca5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # `MedicationFrequency` -> `src/domain/value_objects/medication_frequency.rs` | ||
|
|
||
| A value object representing how often a medication should be taken. | ||
|
|
||
| --- | ||
|
|
||
| ## Invariants | ||
|
|
||
| - This follow an enum pattern with variants like `OnceDaily`, `TwiceDaily`, `EveryXHours(u8) or Custom(String)`. | ||
|
Comment on lines
+3
to
+9
|
||
| - For `EveryXHours`, the number of hours must be between 1 and 24 | ||
|
|
||
|
|
||
| ## Usage | ||
|
|
||
| ```rust | ||
| use bitpill::domain::value_objects::medication_frequency::MedicationFrequency; | ||
|
|
||
| let freq1 = MedicationFrequency::OnceDaily; | ||
| let freq2 = MedicationFrequency::EveryXHours(8); | ||
| let freq3 = MedicationFrequency::Custom("Every Monday".to_string()); | ||
|
|
||
| assert_eq!(freq1.to_string(), "Once daily"); | ||
| assert_eq!(freq2.to_string(), "Every 8 hours"); | ||
| assert_eq!(freq3.to_string(), "Every Monday"); | ||
| ``` | ||
|
|
||
| `MedicationFrequency` is used as a field in the [`Medication`](../entities/medication.md) entity to specify how often the medication should be taken. | ||
|
|
||
| ## Methods | ||
|
|
||
| ### `as_str() -> String` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammar: “This follow” should be “This follows”.