rluv_client/lib/models/user.dart

40 lines
950 B
Dart
Raw Normal View History

2023-07-19 02:16:13 -06:00
import 'package:json_annotation/json_annotation.dart';
import '../global/utils.dart';
part 'user.g.dart';
@JsonSerializable()
class User {
const User({
this.id,
required this.name,
required this.familyId,
required this.budgetId,
2023-07-27 01:40:26 -06:00
this.email,
this.username,
2023-07-19 02:16:13 -06:00
this.createdAt,
this.updatedAt,
this.lastActivityAt,
2023-07-22 21:29:32 -06:00
this.hide = false,
2023-07-19 02:16:13 -06:00
});
final int? id;
final int familyId, budgetId;
final String name;
2023-07-27 01:40:26 -06:00
final String? username, email;
2023-07-19 02:16:13 -06:00
2023-07-22 21:29:32 -06:00
@JsonKey(fromJson: boolFromJson, toJson: boolToJson)
final bool hide;
2023-07-19 02:16:13 -06:00
@JsonKey(fromJson: dateFromJson, toJson: dateToJson)
final DateTime? createdAt;
@JsonKey(fromJson: dateFromJson, toJson: dateToJson)
final DateTime? updatedAt;
@JsonKey(fromJson: dateFromJson, toJson: dateToJson)
final DateTime? lastActivityAt;
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
Map<String, dynamic> toJson() => _$UserToJson(this);
}