feat: enhance admin product management with AI categorization, product status updates, and email editing for users
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
class AdminAiCategorizeResult {
|
||||
final int productId;
|
||||
final String productName;
|
||||
final int categoryId;
|
||||
final String categoryPath;
|
||||
final String confidence;
|
||||
final bool usedFallback;
|
||||
|
||||
const AdminAiCategorizeResult({
|
||||
required this.productId,
|
||||
required this.productName,
|
||||
required this.categoryId,
|
||||
required this.categoryPath,
|
||||
required this.confidence,
|
||||
required this.usedFallback,
|
||||
});
|
||||
|
||||
factory AdminAiCategorizeResult.fromJson(Map<String, dynamic> json) {
|
||||
final suggestion = (json['suggestion'] as Map<String, dynamic>? ?? const {});
|
||||
return AdminAiCategorizeResult(
|
||||
productId: (json['productId'] as num?)?.toInt() ?? 0,
|
||||
productName: (json['productName'] ?? '').toString(),
|
||||
categoryId: (suggestion['categoryId'] as num?)?.toInt() ?? 0,
|
||||
categoryPath: (suggestion['path'] ?? '').toString(),
|
||||
confidence: (suggestion['confidence'] ?? '').toString(),
|
||||
usedFallback: suggestion['usedFallback'] == true,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,9 @@ class AdminProduct {
|
||||
final String? normalizedName;
|
||||
final int? categoryId;
|
||||
final String? categoryPath;
|
||||
final bool? isActive;
|
||||
final String? status;
|
||||
final DateTime? deletedAt;
|
||||
|
||||
const AdminProduct({
|
||||
required this.id,
|
||||
@@ -13,6 +16,9 @@ class AdminProduct {
|
||||
this.normalizedName,
|
||||
this.categoryId,
|
||||
this.categoryPath,
|
||||
this.isActive,
|
||||
this.status,
|
||||
this.deletedAt,
|
||||
});
|
||||
|
||||
String get displayName =>
|
||||
@@ -39,6 +45,11 @@ class AdminProduct {
|
||||
normalizedName: json['normalizedName']?.toString(),
|
||||
categoryId: (json['categoryId'] as num?)?.toInt(),
|
||||
categoryPath: names.isEmpty ? null : names.join(' > '),
|
||||
isActive: json['isActive'] as bool?,
|
||||
status: json['status']?.toString(),
|
||||
deletedAt: json['deletedAt'] == null
|
||||
? null
|
||||
: DateTime.tryParse(json['deletedAt'].toString()),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user