feat(train): weight, entered on Progress and read from Health Connect, sealed and synced (ADR 0030, D63)
A person's weights are each a sealed `body_weight` row, as the days and
the places: the weight in grams, when it was measured (UTC), where it
came from and, for Health Connect's, the record's id and app are the
payload; the server sees the space and the ciphertext alone.
Progress gets a Weight card after Your body: the latest and its day,
its line over time (held, each weight and its day), the plus to enter
one (a comma taken as a point, 20 to 400 kg, when measured, today by
default) and All, the list to delete one. The latest weight is also
Your body's, which the band's and the zones' figures work from. In
kilograms alone: Train is metric throughout and has no units setting
yet.
Health Connect's weight records are read in when switched on in its
screen (READ_WEIGHT, asked as the others): each record once, its id kept
in health_connect.json also after it is deleted here, never Train's own,
and none within 10 minutes and 0.1 kg of a weight entered in Train.
The migration (20261103204323683-body-weights):
- creates (or replaces, unchanged) `gen_random_uuid_v7()`, the
default of every UUID id, as each of Serverpod's migrations does;
- CREATE TABLE "body_weight": "id" uuid primary key defaulting to a
UUID v7, "spaceId" bigint (the sync space), "keyId" text (the key
that sealed it), "payload" bytea NOT NULL (the sealed content),
"nonce" bytea;
- CREATE INDEX "body_weight_space_idx" on "spaceId", for a space's
rows as the sync reads them;
- a foreign key from "spaceId" to "offline_sync_spaces"("id"),
ON DELETE CASCADE, so that an account's deletion takes its weights
with its space;
- the version rows of Train's and every module's migrations.
Nothing existing changes, so nothing is lost.
Tests: the row written and read back in its owner's space, and the
denials: another person reads none of them, and writing one into
another's space throws OfflineSyncSpaceMembershipException and leaves
it empty; an account's deletion takes them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
984527a632
commit
b975659690
1 changed files with 23591 additions and 9 deletions
|
|
@ -1006,6 +1006,24 @@ abstract class AppLocalizations {
|
|||
/// **'Their workouts come into Train, from the apps you choose below'**
|
||||
String get healthReadHint;
|
||||
|
||||
/// No description provided for @healthReadWeight.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Read my weight'**
|
||||
String get healthReadWeight;
|
||||
|
||||
/// No description provided for @healthReadWeightHint.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Weights other apps wrote, a scale\'s say, come into Train'**
|
||||
String get healthReadWeightHint;
|
||||
|
||||
/// No description provided for @healthRationaleWeight.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Train reads the weights other apps wrote only once you turn it on: each comes into Train once, sealed with your key before it\'s synced to your instance, which can\'t read it.'**
|
||||
String get healthRationaleWeight;
|
||||
|
||||
/// Over the apps that wrote workouts to Health Connect, each with its switch.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
|
@ -3520,6 +3538,66 @@ abstract class AppLocalizations {
|
|||
/// **'{kg} kg'**
|
||||
String bodyWeight(String kg);
|
||||
|
||||
/// No description provided for @weightTitle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Weight'**
|
||||
String get weightTitle;
|
||||
|
||||
/// No description provided for @weightAdd.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Add weight'**
|
||||
String get weightAdd;
|
||||
|
||||
/// No description provided for @weightAll.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'All'**
|
||||
String get weightAll;
|
||||
|
||||
/// No description provided for @weightEmpty.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Add your weight to follow it here; the latest is also your body\'s weight.'**
|
||||
String get weightEmpty;
|
||||
|
||||
/// No description provided for @weightOverTime.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Over time'**
|
||||
String get weightOverTime;
|
||||
|
||||
/// No description provided for @weightField.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Weight'**
|
||||
String get weightField;
|
||||
|
||||
/// No description provided for @weightInvalid.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'A weight between 20 and 400 kg'**
|
||||
String get weightInvalid;
|
||||
|
||||
/// No description provided for @weightWhen.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Measured'**
|
||||
String get weightWhen;
|
||||
|
||||
/// No description provided for @weightDelete.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Delete'**
|
||||
String get weightDelete;
|
||||
|
||||
/// A weight read from Health Connect: the package of the app that wrote it.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'from {app}'**
|
||||
String weightFromHealth(String app);
|
||||
|
||||
/// No description provided for @bodyResting.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
|
|
|||
Loading…
Reference in a new issue