update database

This commit is contained in:
Phuoc Nguyen
2025-10-24 11:31:48 +07:00
parent f95fa9d0a6
commit c4272f9a21
126 changed files with 23528 additions and 2234 deletions

View File

@@ -0,0 +1,163 @@
/// Domain Entity: Showroom
///
/// Represents a virtual showroom display.
library;
/// Showroom Entity
///
/// Contains information about a showroom:
/// - Showroom details and description
/// - Media (images, 360 view)
/// - Metadata (style, location, area)
/// - Visibility settings
class Showroom {
/// Unique showroom identifier
final String showroomId;
/// Showroom title
final String title;
/// Showroom description
final String? description;
/// Cover image URL
final String? coverImage;
/// 360-degree view link
final String? link360;
/// Showroom area (square meters)
final double? area;
/// Design style
final String? style;
/// Location/address
final String? location;
/// Gallery image URLs
final List<String> galleryImages;
/// View count
final int viewCount;
/// Showroom is featured
final bool isFeatured;
/// Showroom is active and visible
final bool isActive;
/// Publication timestamp
final DateTime? publishedAt;
/// User ID who created the showroom
final String? createdBy;
const Showroom({
required this.showroomId,
required this.title,
this.description,
this.coverImage,
this.link360,
this.area,
this.style,
this.location,
required this.galleryImages,
required this.viewCount,
required this.isFeatured,
required this.isActive,
this.publishedAt,
this.createdBy,
});
/// Check if showroom is published
bool get isPublished =>
publishedAt != null && DateTime.now().isAfter(publishedAt!);
/// Check if showroom has 360 view
bool get has360View => link360 != null && link360!.isNotEmpty;
/// Check if showroom has gallery
bool get hasGallery => galleryImages.isNotEmpty;
/// Get gallery size
int get gallerySize => galleryImages.length;
/// Check if showroom has cover image
bool get hasCoverImage => coverImage != null && coverImage!.isNotEmpty;
/// Get display image (cover or first gallery image)
String? get displayImage {
if (hasCoverImage) return coverImage;
if (hasGallery) return galleryImages.first;
return null;
}
/// Check if showroom can be viewed
bool get canBeViewed => isActive && isPublished;
/// Copy with method for immutability
Showroom copyWith({
String? showroomId,
String? title,
String? description,
String? coverImage,
String? link360,
double? area,
String? style,
String? location,
List<String>? galleryImages,
int? viewCount,
bool? isFeatured,
bool? isActive,
DateTime? publishedAt,
String? createdBy,
}) {
return Showroom(
showroomId: showroomId ?? this.showroomId,
title: title ?? this.title,
description: description ?? this.description,
coverImage: coverImage ?? this.coverImage,
link360: link360 ?? this.link360,
area: area ?? this.area,
style: style ?? this.style,
location: location ?? this.location,
galleryImages: galleryImages ?? this.galleryImages,
viewCount: viewCount ?? this.viewCount,
isFeatured: isFeatured ?? this.isFeatured,
isActive: isActive ?? this.isActive,
publishedAt: publishedAt ?? this.publishedAt,
createdBy: createdBy ?? this.createdBy,
);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is Showroom &&
other.showroomId == showroomId &&
other.title == title &&
other.style == style &&
other.isFeatured == isFeatured &&
other.isActive == isActive;
}
@override
int get hashCode {
return Object.hash(
showroomId,
title,
style,
isFeatured,
isActive,
);
}
@override
String toString() {
return 'Showroom(showroomId: $showroomId, title: $title, style: $style, '
'area: $area, viewCount: $viewCount, isFeatured: $isFeatured, '
'isActive: $isActive)';
}
}

View File

@@ -0,0 +1,65 @@
/// Domain Entity: Showroom Product
///
/// Represents a product used in a showroom display.
library;
/// Showroom Product Entity
///
/// Contains information about a product featured in a showroom:
/// - Product reference
/// - Quantity used
/// - Showroom context
class ShowroomProduct {
/// Showroom ID
final String showroomId;
/// Product ID
final String productId;
/// Quantity of product used in the showroom
final double quantityUsed;
const ShowroomProduct({
required this.showroomId,
required this.productId,
required this.quantityUsed,
});
/// Copy with method for immutability
ShowroomProduct copyWith({
String? showroomId,
String? productId,
double? quantityUsed,
}) {
return ShowroomProduct(
showroomId: showroomId ?? this.showroomId,
productId: productId ?? this.productId,
quantityUsed: quantityUsed ?? this.quantityUsed,
);
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is ShowroomProduct &&
other.showroomId == showroomId &&
other.productId == productId &&
other.quantityUsed == quantityUsed;
}
@override
int get hashCode {
return Object.hash(
showroomId,
productId,
quantityUsed,
);
}
@override
String toString() {
return 'ShowroomProduct(showroomId: $showroomId, productId: $productId, '
'quantityUsed: $quantityUsed)';
}
}