19bd8c1810
CI / flutter-gates (push) Successful in 2m26s
- community_models:community/media 域 DTO 逐字段照冻结契约手写 JSON 映射 (Post/FeedCard/PostComment/AuthorSummary 降级形态/媒体两步上传凭据等), 未知枚举抛 FormatException 暴露契约漂移;CursorPage 上移 core 复用 - community_repository:13 路径 19 操作全覆盖;createPost/createComment 必带 Idempotency-Key(每次逻辑提交换新键、刷新重放同键);点赞/收藏/ 关注走 PUT/DELETE 语义幂等 - community_exceptions:v1.3.0 新增 9 码 + 40902 共码类型化异常映射 - toggle_sync:乐观翻转 + 快照回滚 + 单飞合并最终意图 + 代次守卫, 点赞/收藏共用一套参数化状态机,权威终态对账收敛 - community_controller:Feed 多页缓存 + 首屏四态 + 尾部加载三态 + 游标拼接 + 刷新代次丢弃旧尾页;详情副本与卡片互动状态同源;reset 清态 - app.dart 装配:community 服务分端口直连(:8084),共享 TokenRefresher, 登出同步 reset - 测试 286 → 347(模型映射 / 19 操作线路 / 错误映射 / 竞态序列全覆盖) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
28 lines
872 B
Dart
28 lines
872 B
Dart
/// cursor 分页正典信封 `{items, nextCursor, hasMore}`(pets 域体重 / 健康事件,
|
||
/// community 域 Feed / 我的帖子 / 评论 / 收藏共用;自 pet_models.dart 上移至 core)。
|
||
class CursorPage<T> {
|
||
const CursorPage({
|
||
required this.items,
|
||
required this.nextCursor,
|
||
required this.hasMore,
|
||
});
|
||
|
||
factory CursorPage.fromJson(
|
||
Map<String, dynamic> json,
|
||
T Function(Map<String, dynamic>) itemFromJson,
|
||
) {
|
||
return CursorPage(
|
||
items: (json['items'] as List)
|
||
.map((item) => itemFromJson(item as Map<String, dynamic>))
|
||
.toList(),
|
||
// 不透明 base64url 游标,客户端不得解析;hasMore=false 时恒为 null。
|
||
nextCursor: json['nextCursor'] as String?,
|
||
hasMore: json['hasMore'] as bool,
|
||
);
|
||
}
|
||
|
||
final List<T> items;
|
||
final String? nextCursor;
|
||
final bool hasMore;
|
||
}
|