Implement owner-scoped Observation lifecycle with serialized patches
This commit is contained in:
1 parent
bfe6ebf5af
commit
3a70e3e296
37 files changed
+31249
-9
No files matched your search
@@ -0,0 +1,87 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace HealthApp.Contracts;
|
||||
|
||||
[JsonUnmappedMemberHandling(JsonUnmappedMemberHandling.Disallow)]
|
||||
public sealed record MeasurementContextPatch
|
||||
{
|
||||
private string? setting;
|
||||
[AllowedValues("Home", "Clinic", "Other", "Unknown", null)]
|
||||
public string? Setting
|
||||
{
|
||||
get => setting;
|
||||
init { setting = value; SettingSpecified = true; }
|
||||
}
|
||||
[JsonIgnore]
|
||||
public bool SettingSpecified { get; private set; }
|
||||
|
||||
private string? activityCondition;
|
||||
[AllowedValues("AtRest", "DuringActivity", "AfterActivity", "Unknown", null)]
|
||||
public string? ActivityCondition
|
||||
{
|
||||
get => activityCondition;
|
||||
init { activityCondition = value; ActivityConditionSpecified = true; }
|
||||
}
|
||||
[JsonIgnore]
|
||||
public bool ActivityConditionSpecified { get; private set; }
|
||||
|
||||
private decimal? restDurationMinutes;
|
||||
[Range(0, double.MaxValue)]
|
||||
public decimal? RestDurationMinutes
|
||||
{
|
||||
get => restDurationMinutes;
|
||||
init { restDurationMinutes = value; RestDurationMinutesSpecified = true; }
|
||||
}
|
||||
[JsonIgnore]
|
||||
public bool RestDurationMinutesSpecified { get; private set; }
|
||||
|
||||
private string? bodyPosition;
|
||||
public string? BodyPosition
|
||||
{
|
||||
get => bodyPosition;
|
||||
init { bodyPosition = value; BodyPositionSpecified = true; }
|
||||
}
|
||||
[JsonIgnore]
|
||||
public bool BodyPositionSpecified { get; private set; }
|
||||
|
||||
private string? measuredArm;
|
||||
public string? MeasuredArm
|
||||
{
|
||||
get => measuredArm;
|
||||
init { measuredArm = value; MeasuredArmSpecified = true; }
|
||||
}
|
||||
[JsonIgnore]
|
||||
public bool MeasuredArmSpecified { get; private set; }
|
||||
|
||||
private string? deviceDetails;
|
||||
public string? DeviceDetails
|
||||
{
|
||||
get => deviceDetails;
|
||||
init { deviceDetails = value; DeviceDetailsSpecified = true; }
|
||||
}
|
||||
[JsonIgnore]
|
||||
public bool DeviceDetailsSpecified { get; private set; }
|
||||
|
||||
private string? cuffDetails;
|
||||
public string? CuffDetails
|
||||
{
|
||||
get => cuffDetails;
|
||||
init { cuffDetails = value; CuffDetailsSpecified = true; }
|
||||
}
|
||||
[JsonIgnore]
|
||||
public bool CuffDetailsSpecified { get; private set; }
|
||||
|
||||
private string? additionalCircumstances;
|
||||
public string? AdditionalCircumstances
|
||||
{
|
||||
get => additionalCircumstances;
|
||||
init { additionalCircumstances = value; AdditionalCircumstancesSpecified = true; }
|
||||
}
|
||||
[JsonIgnore]
|
||||
public bool AdditionalCircumstancesSpecified { get; private set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public bool HasChanges => SettingSpecified || ActivityConditionSpecified || RestDurationMinutesSpecified ||
|
||||
BodyPositionSpecified || MeasuredArmSpecified || DeviceDetailsSpecified || CuffDetailsSpecified || AdditionalCircumstancesSpecified;
|
||||
}
|
||||
Reference in new issue
Block a user