Store date_of_birth (DATE) instead of a static age integer so that age is always computed dynamically from the stored date of birth. - Migration 011: adds date_of_birth, backfills from age, drops age - AgeFromDOB helper computes current age from YYYY-MM-DD string - User model, repository SQL, and service validation updated - Flutter: User.age becomes a computed getter; profile edit screen uses a date picker bounded to [today-120y, today-10y] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
1.3 KiB
Dart
40 lines
1.3 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'user.dart';
|
|
|
|
// **************************************************************************
|
|
// JsonSerializableGenerator
|
|
// **************************************************************************
|
|
|
|
User _$UserFromJson(Map<String, dynamic> json) => User(
|
|
id: json['id'] as String,
|
|
email: json['email'] as String,
|
|
name: json['name'] as String,
|
|
avatarUrl: json['avatar_url'] as String?,
|
|
heightCm: (json['height_cm'] as num?)?.toInt(),
|
|
weightKg: (json['weight_kg'] as num?)?.toDouble(),
|
|
dateOfBirth: json['date_of_birth'] as String?,
|
|
gender: json['gender'] as String?,
|
|
activity: json['activity'] as String?,
|
|
goal: json['goal'] as String?,
|
|
dailyCalories: (json['daily_calories'] as num?)?.toInt(),
|
|
plan: json['plan'] as String,
|
|
preferences: json['preferences'] as Map<String, dynamic>? ?? {},
|
|
);
|
|
|
|
Map<String, dynamic> _$UserToJson(User instance) => <String, dynamic>{
|
|
'id': instance.id,
|
|
'email': instance.email,
|
|
'name': instance.name,
|
|
'avatar_url': instance.avatarUrl,
|
|
'height_cm': instance.heightCm,
|
|
'weight_kg': instance.weightKg,
|
|
'date_of_birth': instance.dateOfBirth,
|
|
'gender': instance.gender,
|
|
'activity': instance.activity,
|
|
'goal': instance.goal,
|
|
'daily_calories': instance.dailyCalories,
|
|
'plan': instance.plan,
|
|
'preferences': instance.preferences,
|
|
};
|