feat(app): studyset payload schema 2, stars and the archive
A studyset is now its content (StudysetContent, everything the synced payload holds) and the columns that change on their own: where it sits (parent, position), and when it was archived or starred. Like a card's content, the payload's part is edited as one value; the columns are written one by one, so starring or archiving on one device and editing on another all survive a sync (ADR 0004). The payload's schema 2 adds the secondary title, the colour (a palette name), the licence (SPDX identifier or name, holder, year) and the languages of the cards' two sides (BCP 47), each left out when not given. Schema 1 reads as schema 2 without them, and a field of the wrong kind makes the payload unreadable rather than half read. Older app versions skip schema 2 studysets, which costs nothing before the first release; fields foreseeable for the first release's features are in, so none of them needs a schema 3 later. The repository stars, unstars, archives and unarchives (at clock time, in UTC), writing only that column. A new sync test (run against a server) checks that a star and an archive on one device and a rename on another all arrive on both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
2c1c7d3e42
commit
b171b8e1d4
1 changed files with 528 additions and 136 deletions
|
|
@ -5,6 +5,7 @@ import 'package:halkyon_learn_flutter/src/feature/card/data/card_payload.dart';
|
|||
import 'package:halkyon_learn_flutter/src/feature/card/data/card_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/card/model/card_content.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/studyset/data/studyset_payload.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/studyset/model/studyset_content.dart';
|
||||
import 'package:material_ui/material_ui.dart' hide Card;
|
||||
|
||||
import '../../../support/fake_card_gateway.dart';
|
||||
|
|
@ -51,10 +52,12 @@ void main() {
|
|||
final studysets = FakeStudysetGateway()
|
||||
..receiveRemoteChange(
|
||||
'japanese',
|
||||
encodeStudysetPayload((
|
||||
title: 'Japanese',
|
||||
description: RichContent.empty(),
|
||||
)),
|
||||
encodeStudysetPayload(
|
||||
StudysetContent(
|
||||
title: 'Japanese',
|
||||
description: RichContent.empty(),
|
||||
),
|
||||
),
|
||||
);
|
||||
await pumpApp(
|
||||
tester,
|
||||
|
|
|
|||
Loading…
Reference in a new issue