394 lines
10 KiB
Dart
394 lines
10 KiB
Dart
import 'dart:convert';
|
|
|
|
AllCartItems allCartItemsFromJson(String str) =>
|
|
AllCartItems.fromJson(json.decode(str));
|
|
|
|
String allCartItemsToJson(AllCartItems data) => json.encode(data.toJson());
|
|
|
|
class AllCartItems {
|
|
String? id;
|
|
String? userId;
|
|
String? subtotal;
|
|
DateTime? createdAt;
|
|
DateTime? updatedAt;
|
|
List<Item>? items;
|
|
|
|
AllCartItems({
|
|
this.id,
|
|
this.userId,
|
|
this.subtotal,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
this.items,
|
|
});
|
|
|
|
factory AllCartItems.fromJson(Map<String, dynamic> json) => AllCartItems(
|
|
id: json["id"],
|
|
userId: json["userId"],
|
|
subtotal: json["subtotal"],
|
|
createdAt: DateTime.parse(json["createdAt"]),
|
|
updatedAt: DateTime.parse(json["updatedAt"]),
|
|
items: List<Item>.from(json["items"].map((x) => Item.fromJson(x))),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"userId": userId,
|
|
"subtotal": subtotal,
|
|
"createdAt": createdAt,
|
|
"updatedAt": updatedAt,
|
|
"items": List<dynamic>.from(items!.map((x) => x.toJson())),
|
|
};
|
|
}
|
|
|
|
class Item {
|
|
String? id;
|
|
int? quantity;
|
|
String? priceSnapshot;
|
|
String? cartId;
|
|
String? productId;
|
|
String? storeId;
|
|
DateTime? createdAt;
|
|
DateTime? updatedAt;
|
|
ItemProduct? product;
|
|
Store? store;
|
|
|
|
Item({
|
|
this.id,
|
|
this.quantity,
|
|
this.priceSnapshot,
|
|
this.cartId,
|
|
this.productId,
|
|
this.storeId,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
this.product,
|
|
this.store,
|
|
});
|
|
|
|
factory Item.fromJson(Map<String, dynamic> json) => Item(
|
|
id: json["id"],
|
|
quantity: json["quantity"],
|
|
priceSnapshot: json["priceSnapshot"],
|
|
cartId: json["cartId"],
|
|
productId: json["productId"],
|
|
storeId: json["storeId"],
|
|
createdAt: DateTime.parse(json["createdAt"]),
|
|
updatedAt: DateTime.parse(json["updatedAt"]),
|
|
product: ItemProduct.fromJson(json["product"]),
|
|
store: Store.fromJson(json["store"]),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"quantity": quantity,
|
|
"priceSnapshot": priceSnapshot,
|
|
"cartId": cartId,
|
|
"productId": productId,
|
|
"storeId": storeId,
|
|
"createdAt": createdAt,
|
|
"updatedAt": updatedAt,
|
|
"product": product!.toJson(),
|
|
"store": store!.toJson(),
|
|
};
|
|
}
|
|
|
|
class ItemProduct {
|
|
String? id;
|
|
String? name;
|
|
String? description;
|
|
String? additionalInfo;
|
|
dynamic brand;
|
|
String? basePrice;
|
|
String? discountPrice;
|
|
int? stock;
|
|
int? quantity;
|
|
String? unit;
|
|
String? slug;
|
|
dynamic? averageRating;
|
|
bool? isInStock;
|
|
bool? isActive;
|
|
DateTime? createdAt;
|
|
DateTime? updatedAt;
|
|
String? storeId;
|
|
String? categoryId;
|
|
dynamic? productTypeId;
|
|
dynamic? timeSlotId;
|
|
List<ProductImage>? productImages;
|
|
Category? category;
|
|
List<ProductTag>? productTags;
|
|
List<dynamic>? zones;
|
|
List<dynamic>? productReview;
|
|
|
|
ItemProduct({
|
|
this.id,
|
|
this.name,
|
|
this.description,
|
|
this.additionalInfo,
|
|
this.brand,
|
|
this.basePrice,
|
|
this.discountPrice,
|
|
this.stock,
|
|
this.quantity,
|
|
this.unit,
|
|
this.slug,
|
|
this.averageRating,
|
|
this.isInStock,
|
|
this.isActive,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
this.storeId,
|
|
this.categoryId,
|
|
this.productTypeId,
|
|
this.timeSlotId,
|
|
this.productImages,
|
|
this.category,
|
|
this.productTags,
|
|
this.zones,
|
|
this.productReview,
|
|
});
|
|
|
|
factory ItemProduct.fromJson(Map<String, dynamic> json) => ItemProduct(
|
|
id: json["id"],
|
|
name: json["name"],
|
|
description: json["description"],
|
|
additionalInfo: json["additionalInfo"],
|
|
brand: json["brand"],
|
|
basePrice: json["basePrice"],
|
|
discountPrice: json["discountPrice"],
|
|
stock: json["stock"],
|
|
quantity: json["quantity"],
|
|
unit: json["unit"],
|
|
slug: json["slug"],
|
|
averageRating: json["averageRating"],
|
|
isInStock: json["isInStock"],
|
|
isActive: json["isActive"],
|
|
createdAt: DateTime.parse(json["createdAt"]),
|
|
updatedAt: DateTime.parse(json["updatedAt"]),
|
|
storeId: json["storeId"],
|
|
categoryId: json["categoryId"],
|
|
productTypeId: json["productTypeId"],
|
|
timeSlotId: json["timeSlotId"],
|
|
productImages: List<ProductImage>.from(
|
|
json["productImages"].map((x) => ProductImage.fromJson(x))),
|
|
category: Category.fromJson(json["category"]),
|
|
productTags: List<ProductTag>.from(
|
|
json["productTags"].map((x) => ProductTag.fromJson(x))),
|
|
zones: List<dynamic>.from(json["zones"].map((x) => x)),
|
|
productReview: List<dynamic>.from(json["ProductReview"].map((x) => x)),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"name": name,
|
|
"description": description,
|
|
"additionalInfo": additionalInfo,
|
|
"brand": brand,
|
|
"basePrice": basePrice,
|
|
"discountPrice": discountPrice,
|
|
"stock": stock,
|
|
"quantity": quantity,
|
|
"unit": unit,
|
|
"slug": slug,
|
|
"averageRating": averageRating,
|
|
"isInStock": isInStock,
|
|
"isActive": isActive,
|
|
"createdAt": createdAt!.toIso8601String(),
|
|
"updatedAt": updatedAt!.toIso8601String(),
|
|
"storeId": storeId,
|
|
"categoryId": categoryId,
|
|
"productTypeId": productTypeId,
|
|
"timeSlotId": timeSlotId,
|
|
"productImages":
|
|
List<dynamic>.from(productImages!.map((x) => x.toJson())),
|
|
"category": category!.toJson(),
|
|
"productTags": List<dynamic>.from(productTags!.map((x) => x.toJson())),
|
|
"zones": List<dynamic>.from(zones!.map((x) => x)),
|
|
"ProductReview": List<dynamic>.from(productReview!.map((x) => x)),
|
|
};
|
|
}
|
|
|
|
class Category {
|
|
String? id;
|
|
String? name;
|
|
String? description;
|
|
String? image;
|
|
String? slug;
|
|
int? level;
|
|
bool? isActive;
|
|
DateTime? createdAt;
|
|
DateTime? updatedAt;
|
|
String? parentCategoryId;
|
|
String? path;
|
|
|
|
Category({
|
|
this.id,
|
|
this.name,
|
|
this.description,
|
|
this.image,
|
|
this.slug,
|
|
this.level,
|
|
this.isActive,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
this.parentCategoryId,
|
|
this.path,
|
|
});
|
|
|
|
factory Category.fromJson(Map<String, dynamic> json) => Category(
|
|
id: json["id"],
|
|
name: json["name"],
|
|
description: json["description"],
|
|
image: json["image"],
|
|
slug: json["slug"],
|
|
level: json["level"],
|
|
isActive: json["isActive"],
|
|
createdAt: DateTime.parse(json["createdAt"]),
|
|
updatedAt: DateTime.parse(json["updatedAt"]),
|
|
parentCategoryId: json["parentCategoryId"],
|
|
path: json["path"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"name": name,
|
|
"description": description,
|
|
"image": image,
|
|
"slug": slug,
|
|
"level": level,
|
|
"isActive": isActive,
|
|
"createdAt": createdAt!.toIso8601String(),
|
|
"updatedAt": updatedAt!.toIso8601String(),
|
|
"parentCategoryId": parentCategoryId,
|
|
"path": path,
|
|
};
|
|
}
|
|
|
|
class ProductImage {
|
|
String? id;
|
|
String? url;
|
|
bool? isDefault;
|
|
String? productId;
|
|
|
|
ProductImage({
|
|
this.id,
|
|
this.url,
|
|
this.isDefault,
|
|
this.productId,
|
|
});
|
|
|
|
factory ProductImage.fromJson(Map<String, dynamic> json) => ProductImage(
|
|
id: json["id"],
|
|
url: json["url"],
|
|
isDefault: json["isDefault"],
|
|
productId: json["productId"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"url": url,
|
|
"isDefault": isDefault,
|
|
"productId": productId,
|
|
};
|
|
}
|
|
|
|
class ProductTag {
|
|
String? id;
|
|
String? name;
|
|
String? description;
|
|
bool? isActive;
|
|
DateTime? createdAt;
|
|
DateTime? updatedAt;
|
|
|
|
ProductTag({
|
|
this.id,
|
|
this.name,
|
|
this.description,
|
|
this.isActive,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
});
|
|
|
|
factory ProductTag.fromJson(Map<String, dynamic> json) => ProductTag(
|
|
id: json["id"],
|
|
name: json["name"],
|
|
description: json["description"],
|
|
isActive: json["isActive"],
|
|
createdAt: DateTime.parse(json["createdAt"]),
|
|
updatedAt: DateTime.parse(json["updatedAt"]),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"name": name,
|
|
"description": description,
|
|
"isActive": isActive,
|
|
"createdAt": createdAt!.toIso8601String(),
|
|
"updatedAt": updatedAt!.toIso8601String(),
|
|
};
|
|
}
|
|
|
|
class Store {
|
|
String? id;
|
|
String? storeName;
|
|
String? storeDescription;
|
|
String? officialPhoneNumber;
|
|
String? storeAddress;
|
|
String? gstNumber;
|
|
String? gumastaNumber;
|
|
String? storePicture;
|
|
DateTime? createdAt;
|
|
DateTime? updatedAt;
|
|
String? vendorId;
|
|
bool? isActive;
|
|
dynamic? couponId;
|
|
|
|
Store({
|
|
this.id,
|
|
this.storeName,
|
|
this.storeDescription,
|
|
this.officialPhoneNumber,
|
|
this.storeAddress,
|
|
this.gstNumber,
|
|
this.gumastaNumber,
|
|
this.storePicture,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
this.vendorId,
|
|
this.isActive,
|
|
this.couponId,
|
|
});
|
|
|
|
factory Store.fromJson(Map<String, dynamic> json) => Store(
|
|
id: json["id"],
|
|
storeName: json["storeName"],
|
|
storeDescription: json["storeDescription"],
|
|
officialPhoneNumber: json["officialPhoneNumber"],
|
|
storeAddress: json["storeAddress"],
|
|
gstNumber: json["gstNumber"],
|
|
gumastaNumber: json["gumastaNumber"],
|
|
storePicture: json["storePicture"],
|
|
createdAt: DateTime.parse(json["createdAt"]),
|
|
updatedAt: DateTime.parse(json["updatedAt"]),
|
|
vendorId: json["vendorId"],
|
|
isActive: json["isActive"],
|
|
couponId: json["couponId"],
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"id": id,
|
|
"storeName": storeName,
|
|
"storeDescription": storeDescription,
|
|
"officialPhoneNumber": officialPhoneNumber,
|
|
"storeAddress": storeAddress,
|
|
"gstNumber": gstNumber,
|
|
"gumastaNumber": gumastaNumber,
|
|
"storePicture": storePicture,
|
|
"createdAt": createdAt!.toIso8601String(),
|
|
"updatedAt": updatedAt!.toIso8601String(),
|
|
"vendorId": vendorId,
|
|
"isActive": isActive,
|
|
"couponId": couponId,
|
|
};
|
|
}
|