add refresh token

This commit is contained in:
Phuoc Nguyen
2025-10-21 16:30:11 +07:00
parent b94a19dd3f
commit 9c20a44a04
21 changed files with 246 additions and 67 deletions

View File

@@ -25,10 +25,10 @@ class CategoryModel extends HiveObject {
final int productCount;
@HiveField(6)
final DateTime createdAt;
final DateTime? createdAt;
@HiveField(7)
final DateTime updatedAt;
final DateTime? updatedAt;
CategoryModel({
required this.id,
@@ -37,8 +37,8 @@ class CategoryModel extends HiveObject {
this.iconPath,
this.color,
required this.productCount,
required this.createdAt,
required this.updatedAt,
this.createdAt,
this.updatedAt,
});
/// Convert to domain entity
@@ -78,8 +78,12 @@ class CategoryModel extends HiveObject {
iconPath: json['iconPath'] as String?,
color: json['color'] as String?,
productCount: json['productCount'] as int? ?? 0,
createdAt: DateTime.parse(json['createdAt'] as String),
updatedAt: DateTime.parse(json['updatedAt'] as String),
createdAt: json['createdAt'] != null
? DateTime.parse(json['createdAt'] as String)
: null,
updatedAt: json['updatedAt'] != null
? DateTime.parse(json['updatedAt'] as String)
: null,
);
}
@@ -92,8 +96,8 @@ class CategoryModel extends HiveObject {
'iconPath': iconPath,
'color': color,
'productCount': productCount,
'createdAt': createdAt.toIso8601String(),
'updatedAt': updatedAt.toIso8601String(),
'createdAt': createdAt?.toIso8601String(),
'updatedAt': updatedAt?.toIso8601String(),
};
}

View File

@@ -23,8 +23,8 @@ class CategoryModelAdapter extends TypeAdapter<CategoryModel> {
iconPath: fields[3] as String?,
color: fields[4] as String?,
productCount: (fields[5] as num).toInt(),
createdAt: fields[6] as DateTime,
updatedAt: fields[7] as DateTime,
createdAt: fields[6] as DateTime?,
updatedAt: fields[7] as DateTime?,
);
}

View File

@@ -8,8 +8,8 @@ class Category extends Equatable {
final String? iconPath;
final String? color;
final int productCount;
final DateTime createdAt;
final DateTime updatedAt;
final DateTime? createdAt;
final DateTime? updatedAt;
const Category({
required this.id,
@@ -18,8 +18,8 @@ class Category extends Equatable {
this.iconPath,
this.color,
required this.productCount,
required this.createdAt,
required this.updatedAt,
this.createdAt,
this.updatedAt,
});
@override