add auth, format
This commit is contained in:
@@ -6,22 +6,51 @@ part 'showroom_model.g.dart';
|
||||
|
||||
@HiveType(typeId: HiveTypeIds.showroomModel)
|
||||
class ShowroomModel extends HiveObject {
|
||||
ShowroomModel({required this.showroomId, required this.title, required this.description, this.coverImage, this.link360, required this.area, required this.style, required this.location, this.galleryImages, required this.viewCount, required this.isFeatured, required this.isActive, this.publishedAt, this.createdBy});
|
||||
|
||||
@HiveField(0) final String showroomId;
|
||||
@HiveField(1) final String title;
|
||||
@HiveField(2) final String description;
|
||||
@HiveField(3) final String? coverImage;
|
||||
@HiveField(4) final String? link360;
|
||||
@HiveField(5) final double area;
|
||||
@HiveField(6) final String style;
|
||||
@HiveField(7) final String location;
|
||||
@HiveField(8) final String? galleryImages;
|
||||
@HiveField(9) final int viewCount;
|
||||
@HiveField(10) final bool isFeatured;
|
||||
@HiveField(11) final bool isActive;
|
||||
@HiveField(12) final DateTime? publishedAt;
|
||||
@HiveField(13) final String? createdBy;
|
||||
ShowroomModel({
|
||||
required this.showroomId,
|
||||
required this.title,
|
||||
required this.description,
|
||||
this.coverImage,
|
||||
this.link360,
|
||||
required this.area,
|
||||
required this.style,
|
||||
required this.location,
|
||||
this.galleryImages,
|
||||
required this.viewCount,
|
||||
required this.isFeatured,
|
||||
required this.isActive,
|
||||
this.publishedAt,
|
||||
this.createdBy,
|
||||
});
|
||||
|
||||
@HiveField(0)
|
||||
final String showroomId;
|
||||
@HiveField(1)
|
||||
final String title;
|
||||
@HiveField(2)
|
||||
final String description;
|
||||
@HiveField(3)
|
||||
final String? coverImage;
|
||||
@HiveField(4)
|
||||
final String? link360;
|
||||
@HiveField(5)
|
||||
final double area;
|
||||
@HiveField(6)
|
||||
final String style;
|
||||
@HiveField(7)
|
||||
final String location;
|
||||
@HiveField(8)
|
||||
final String? galleryImages;
|
||||
@HiveField(9)
|
||||
final int viewCount;
|
||||
@HiveField(10)
|
||||
final bool isFeatured;
|
||||
@HiveField(11)
|
||||
final bool isActive;
|
||||
@HiveField(12)
|
||||
final DateTime? publishedAt;
|
||||
@HiveField(13)
|
||||
final String? createdBy;
|
||||
|
||||
factory ShowroomModel.fromJson(Map<String, dynamic> json) => ShowroomModel(
|
||||
showroomId: json['showroom_id'] as String,
|
||||
@@ -32,11 +61,15 @@ class ShowroomModel extends HiveObject {
|
||||
area: (json['area'] as num).toDouble(),
|
||||
style: json['style'] as String,
|
||||
location: json['location'] as String,
|
||||
galleryImages: json['gallery_images'] != null ? jsonEncode(json['gallery_images']) : null,
|
||||
galleryImages: json['gallery_images'] != null
|
||||
? jsonEncode(json['gallery_images'])
|
||||
: null,
|
||||
viewCount: json['view_count'] as int? ?? 0,
|
||||
isFeatured: json['is_featured'] as bool? ?? false,
|
||||
isActive: json['is_active'] as bool? ?? true,
|
||||
publishedAt: json['published_at'] != null ? DateTime.parse(json['published_at']?.toString() ?? '') : null,
|
||||
publishedAt: json['published_at'] != null
|
||||
? DateTime.parse(json['published_at']?.toString() ?? '')
|
||||
: null,
|
||||
createdBy: json['created_by'] as String?,
|
||||
);
|
||||
|
||||
|
||||
@@ -5,17 +5,25 @@ part 'showroom_product_model.g.dart';
|
||||
|
||||
@HiveType(typeId: HiveTypeIds.showroomProductModel)
|
||||
class ShowroomProductModel extends HiveObject {
|
||||
ShowroomProductModel({required this.showroomId, required this.productId, required this.quantityUsed});
|
||||
|
||||
@HiveField(0) final String showroomId;
|
||||
@HiveField(1) final String productId;
|
||||
@HiveField(2) final double quantityUsed;
|
||||
ShowroomProductModel({
|
||||
required this.showroomId,
|
||||
required this.productId,
|
||||
required this.quantityUsed,
|
||||
});
|
||||
|
||||
factory ShowroomProductModel.fromJson(Map<String, dynamic> json) => ShowroomProductModel(
|
||||
showroomId: json['showroom_id'] as String,
|
||||
productId: json['product_id'] as String,
|
||||
quantityUsed: (json['quantity_used'] as num).toDouble(),
|
||||
);
|
||||
@HiveField(0)
|
||||
final String showroomId;
|
||||
@HiveField(1)
|
||||
final String productId;
|
||||
@HiveField(2)
|
||||
final double quantityUsed;
|
||||
|
||||
factory ShowroomProductModel.fromJson(Map<String, dynamic> json) =>
|
||||
ShowroomProductModel(
|
||||
showroomId: json['showroom_id'] as String,
|
||||
productId: json['product_id'] as String,
|
||||
quantityUsed: (json['quantity_used'] as num).toDouble(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'showroom_id': showroomId,
|
||||
|
||||
Reference in New Issue
Block a user