Initial upload: fin65-mobile

This commit is contained in:
Abderrahim-Mouhcine
2026-08-16 19:59:55 +01:00
commit 46558a5ec8
242 changed files with 16334 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
class Category {
final int id;
final String name;
final String type;
final int? parentId;
Category({
required this.id,
required this.name,
required this.type,
this.parentId,
});
factory Category.fromJson(Map<String, dynamic> json) {
return Category(
id: json['id'] as int,
name: json['name'] as String,
type: json['type'] as String,
parentId: json['parent_id'] as int?,
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'type': type,
'parent_id': parentId,
};
}
Map<String, dynamic> toDbMap() {
return {
'id': id,
'name': name,
'type': type,
'parent_id': parentId,
'updated_at': DateTime.now().toIso8601String(),
};
}
factory Category.fromDbMap(Map<String, dynamic> map) {
return Category(
id: map['id'] as int,
name: map['name'] as String,
type: map['type'] as String,
parentId: map['parent_id'] as int?,
);
}
}