28 lines
619 B
Dart
28 lines
619 B
Dart
|
import 'package:json_annotation/json_annotation.dart';
|
||
|
|
||
|
import '../global/utils.dart';
|
||
|
|
||
|
part 'token.g.dart';
|
||
|
|
||
|
@JsonSerializable()
|
||
|
class Token {
|
||
|
const Token({
|
||
|
required this.userId,
|
||
|
required this.familyId,
|
||
|
required this.generatedAt,
|
||
|
required this.expiresAt,
|
||
|
});
|
||
|
|
||
|
final int familyId, userId;
|
||
|
|
||
|
@JsonKey(fromJson: dateFromJson, toJson: dateToJson)
|
||
|
final DateTime generatedAt;
|
||
|
|
||
|
@JsonKey(fromJson: dateFromJson, toJson: dateToJson)
|
||
|
final DateTime expiresAt;
|
||
|
|
||
|
factory Token.fromJson(Map<String, dynamic> json) => _$TokenFromJson(json);
|
||
|
|
||
|
Map<String, dynamic> toJson() => _$TokenToJson(this);
|
||
|
}
|