addProductInformation

This commit is contained in:
2025-02-05 19:03:07 +05:30
parent f92e0300a4
commit 96e4c10656
14 changed files with 1399 additions and 1109 deletions

View File

@@ -8,7 +8,8 @@ import 'dart:ffi';
ProductDetailsData productDetailsdataFromJson(dynamic str) =>
ProductDetailsData.fromJson(json.decode(str));
dynamic productDetailsToJson(ProductDetailsData data) => json.encode(data.toJson());
dynamic productDetailsToJson(ProductDetailsData data) =>
json.encode(data.toJson());
class ProductDetailsData {
Data? data;
@@ -17,7 +18,8 @@ class ProductDetailsData {
this.data,
});
factory ProductDetailsData.fromJson(Map<dynamic, dynamic> json) => ProductDetailsData(
factory ProductDetailsData.fromJson(Map<dynamic, dynamic> json) =>
ProductDetailsData(
data: Data.fromJson(json["data"]),
);
@@ -54,7 +56,7 @@ class Data {
List<ProductImage>? productImages;
List<dynamic>? productTags;
List<dynamic>? zones;
List<dynamic>? productReview;
List<ProductReview>? productReview;
List<dynamic>? questions;
List<CartItem>? cartItems;
List<WishlistItem>? wishlistItem;
@@ -126,7 +128,8 @@ class Data {
json["productImages"].map((x) => ProductImage.fromJson(x))),
productTags: List<dynamic>.from(json["productTags"].map((x) => x)),
zones: List<dynamic>.from(json["zones"].map((x) => x)),
productReview: List<dynamic>.from(json["ProductReview"].map((x) => x)),
productReview: List<ProductReview>.from(
json["ProductReview"].map((x) => ProductReview.fromJson(x))),
questions: List<dynamic>.from(json["questions"].map((x) => x)),
cartItems: List<CartItem>.from(
json["cartItems"].map((x) => CartItem.fromJson(x))),
@@ -404,3 +407,211 @@ class WishlistItem {
"updatedAt": updatedAt,
};
}
class ProductReview {
dynamic id;
dynamic userId;
dynamic productId;
dynamic rating;
dynamic title;
dynamic description;
int? likes;
int? dislikes;
int? helpfulCount;
bool? verifiedPurchase;
dynamic status;
DateTime? createdAt;
DateTime? updatedAt;
User? user;
List<ProductReviewImage>? productReviewImage;
ProductReview({
this.id,
this.userId,
this.productId,
this.rating,
this.title,
this.description,
this.likes,
this.dislikes,
this.helpfulCount,
this.verifiedPurchase,
this.status,
this.createdAt,
this.updatedAt,
this.user,
this.productReviewImage,
});
factory ProductReview.fromJson(Map<dynamic, dynamic> json) => ProductReview(
id: json["id"],
userId: json["userId"],
productId: json["productId"],
rating: json["rating"],
title: json["title"],
description: json["description"],
likes: json["likes"],
dislikes: json["dislikes"],
helpfulCount: json["helpfulCount"],
verifiedPurchase: json["verifiedPurchase"],
status: json["status"],
createdAt: DateTime.parse(json["createdAt"]),
updatedAt: DateTime.parse(json["updatedAt"]),
user: User.fromJson(json["user"]),
productReviewImage: List<ProductReviewImage>.from(
json["ProductReviewImage"]
.map((x) => ProductReviewImage.fromJson(x))),
);
Map<dynamic, dynamic> toJson() => {
"id": id,
"userId": userId,
"productId": productId,
"rating": rating,
"title": title,
"description": description,
"likes": likes,
"dislikes": dislikes,
"helpfulCount": helpfulCount,
"verifiedPurchase": verifiedPurchase,
"status": status,
"createdAt": createdAt,
"updatedAt": updatedAt,
"user": user!.toJson(),
"ProductReviewImage":
List<dynamic>.from(productReviewImage!.map((x) => x.toJson())),
};
}
class ProductReviewImage {
dynamic id;
dynamic reviewId;
dynamic imageUrl;
bool? isDefault;
DateTime? createdAt;
ProductReviewImage({
this.id,
this.reviewId,
this.imageUrl,
this.isDefault,
this.createdAt,
});
factory ProductReviewImage.fromJson(Map<dynamic, dynamic> json) =>
ProductReviewImage(
id: json["id"],
reviewId: json["reviewId"],
imageUrl: json["imageUrl"],
isDefault: json["isDefault"],
createdAt: DateTime.parse(json["createdAt"]),
);
Map<dynamic, dynamic> toJson() => {
"id": id,
"reviewId": reviewId,
"imageUrl": imageUrl,
"isDefault": isDefault,
"createdAt": createdAt,
};
}
class User {
dynamic id;
dynamic email;
dynamic firstName;
dynamic lastName;
dynamic name;
dynamic img;
dynamic authType;
dynamic role;
dynamic phone;
dynamic password;
bool? isActive;
bool? isPhoneVerified;
dynamic vendorType;
dynamic businessId;
bool? isVendorAccountCreated;
bool? isVendorAccountActive;
bool? vendorTermsAccepted;
DateTime? createdAt;
DateTime? updatedAt;
dynamic rtHash;
dynamic resetToken;
dynamic resetTokenExpiresAt;
User({
this.id,
this.email,
this.firstName,
this.lastName,
this.name,
this.img,
this.authType,
this.role,
this.phone,
this.password,
this.isActive,
this.isPhoneVerified,
this.vendorType,
this.businessId,
this.isVendorAccountCreated,
this.isVendorAccountActive,
this.vendorTermsAccepted,
this.createdAt,
this.updatedAt,
this.rtHash,
this.resetToken,
this.resetTokenExpiresAt,
});
factory User.fromJson(Map<dynamic, dynamic> json) => User(
id: json["id"],
email: json["email"],
firstName: json["firstName"],
lastName: json["lastName"],
name: json["name"],
img: json["img"],
authType: json["authType"],
role: json["role"],
phone: json["phone"],
password: json["password"],
isActive: json["isActive"],
isPhoneVerified: json["isPhoneVerified"],
vendorType: json["vendorType"],
businessId: json["businessId"],
isVendorAccountCreated: json["isVendorAccountCreated"],
isVendorAccountActive: json["isVendorAccountActive"],
vendorTermsAccepted: json["vendorTermsAccepted"],
createdAt: DateTime.parse(json["createdAt"]),
updatedAt: DateTime.parse(json["updatedAt"]),
rtHash: json["rtHash"],
resetToken: json["resetToken"],
resetTokenExpiresAt: json["resetTokenExpiresAt"],
);
Map<dynamic, dynamic> toJson() => {
"id": id,
"email": email,
"firstName": firstName,
"lastName": lastName,
"name": name,
"img": img,
"authType": authType,
"role": role,
"phone": phone,
"password": password,
"isActive": isActive,
"isPhoneVerified": isPhoneVerified,
"vendorType": vendorType,
"businessId": businessId,
"isVendorAccountCreated": isVendorAccountCreated,
"isVendorAccountActive": isVendorAccountActive,
"vendorTermsAccepted": vendorTermsAccepted,
"createdAt": createdAt,
"updatedAt": updatedAt,
"rtHash": rtHash,
"resetToken": resetToken,
"resetTokenExpiresAt": resetTokenExpiresAt,
};
}