6798 lines
123 KiB
JavaScript
6798 lines
123 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Brands = db.brands;
|
|
|
|
const Categories = db.categories;
|
|
|
|
const Products = db.products;
|
|
|
|
const ProductAttributes = db.product_attributes;
|
|
|
|
const ProductAttributeValues = db.product_attribute_values;
|
|
|
|
const Wishlists = db.wishlists;
|
|
|
|
const Carts = db.carts;
|
|
|
|
const CartItems = db.cart_items;
|
|
|
|
const Addresses = db.addresses;
|
|
|
|
const Orders = db.orders;
|
|
|
|
const OrderItems = db.order_items;
|
|
|
|
const Payments = db.payments;
|
|
|
|
const Shipments = db.shipments;
|
|
|
|
const Reviews = db.reviews;
|
|
|
|
const Coupons = db.coupons;
|
|
|
|
const ContentPages = db.content_pages;
|
|
|
|
const Banners = db.banners;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const BrandsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"brand_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"brand_name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"brand_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"brand_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"brand_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CategoriesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"category_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 4,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"category_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 9,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"category_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 1,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"category_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 5,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"category_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 1,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ProductsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"product_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"short_description": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price": 3.71,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"compare_at_price": 4.93,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stock_quantity": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_status": "archived",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"viewer_mode": "both",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"average_rating": 5.74,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rating_count": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_featured": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"product_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"short_description": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price": 0.39,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"compare_at_price": 2.51,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stock_quantity": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"viewer_mode": "model_3d",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"average_rating": 6.64,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rating_count": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_featured": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"product_name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"short_description": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price": 1.88,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"compare_at_price": 6.4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stock_quantity": 8,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_status": "archived",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"viewer_mode": "model_3d",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"average_rating": 9.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rating_count": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_featured": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"product_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"short_description": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price": 0.36,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"compare_at_price": 1.59,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stock_quantity": 8,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_status": "archived",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"viewer_mode": "none",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"average_rating": 6.41,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rating_count": 6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_featured": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"product_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"short_description": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price": 4.17,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"compare_at_price": 1.29,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"stock_quantity": 6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"viewer_mode": "both",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"average_rating": 6.23,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rating_count": 7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_featured": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ProductAttributesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"attribute_name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_type": "boolean",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_filterable": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 4,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"attribute_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_type": "text",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_filterable": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 6,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"attribute_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_type": "text",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_filterable": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 2,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"attribute_name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_type": "boolean",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_filterable": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 8,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"attribute_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_type": "number",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_filterable": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 5,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ProductAttributeValuesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_text": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_number": 8.46,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_boolean": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_text": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_number": 7.86,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_boolean": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_text": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_number": 9.18,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_boolean": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_text": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_number": 9.15,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_boolean": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_text": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_number": 0.77,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"value_boolean": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const WishlistsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"wishlist_name": "Grace Hopper",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"wishlist_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"wishlist_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"wishlist_name": "Grace Hopper",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"wishlist_name": "Grace Hopper",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CartsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cart_status": "abandoned",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_activity_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cart_status": "abandoned",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_activity_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cart_status": "converted",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_activity_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cart_status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_activity_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cart_status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_activity_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CartItemsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 3.47,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 1.16,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 4.21,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 5.17,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 6.17,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 1.76,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 0.02,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 1.39,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 3.69,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 4.18,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const AddressesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recipient_name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recipient_phone": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_default": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recipient_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recipient_phone": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_default": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recipient_name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recipient_phone": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_default": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recipient_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recipient_phone": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_default": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"label": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recipient_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recipient_phone": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"city": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"state": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"postal_code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line1": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"address_line2": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_default": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const OrdersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"order_number": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_status": "delivered",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtotal_amount": 4.01,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipping_amount": 4.83,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_amount": 4.14,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_amount": 8.61,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_note": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"placed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"order_number": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_status": "processing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtotal_amount": 9.43,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipping_amount": 3.52,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_amount": 9.17,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_amount": 3.2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_note": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"placed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"order_number": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_status": "refunded",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtotal_amount": 9.68,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipping_amount": 2.91,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_amount": 1.7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_amount": 5.92,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_note": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"placed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"order_number": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_status": "cancelled",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtotal_amount": 0.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipping_amount": 1.52,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_amount": 6.7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_amount": 1.02,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_note": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"placed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"order_number": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"order_status": "shipped",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subtotal_amount": 1.39,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipping_amount": 0.75,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_amount": 8.95,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_amount": 2.08,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"customer_note": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"placed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const OrderItemsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 4.97,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 2.42,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 0.25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 2.13,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 9.35,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 7.93,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 8.58,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 5.04,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"unit_price": 2.14,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"line_total": 4.34,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const PaymentsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_method": "card",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_status": "authorized",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 2.79,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gateway_reference": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_method": "card",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_status": "refunded",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 7.42,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gateway_reference": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_method": "bank_transfer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_status": "refunded",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 1.16,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gateway_reference": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_method": "card",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_status": "authorized",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 6.49,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gateway_reference": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_method": "gateway",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_status": "failed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 4.19,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gateway_reference": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ShipmentsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipment_status": "shipped",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"carrier_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tracking_code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipped_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"delivered_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipment_status": "returned",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"carrier_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tracking_code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipped_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"delivered_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipment_status": "returned",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"carrier_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tracking_code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipped_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"delivered_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipment_status": "in_transit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"carrier_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tracking_code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipped_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"delivered_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipment_status": "in_transit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"carrier_name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tracking_code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shipped_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"delivered_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ReviewsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rating": 7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"comment": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"moderation_status": "rejected",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"submitted_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rating": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"comment": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"moderation_status": "rejected",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"submitted_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rating": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"comment": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"moderation_status": "approved",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"submitted_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rating": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"comment": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"moderation_status": "pending",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"submitted_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"rating": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"comment": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"moderation_status": "rejected",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"submitted_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CouponsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_type": "fixed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_value": 2.95,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"minimum_order_amount": 6.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"usage_limit_total": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"usage_limit_per_user": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_type": "fixed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_value": 2.48,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"minimum_order_amount": 1.35,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"usage_limit_total": 6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"usage_limit_per_user": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_type": "fixed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_value": 2.37,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"minimum_order_amount": 4.34,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"usage_limit_total": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"usage_limit_per_user": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_type": "percent",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_value": 9.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"minimum_order_amount": 8.67,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"usage_limit_total": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"usage_limit_per_user": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"code": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_type": "percent",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"discount_value": 0.97,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"minimum_order_amount": 7.27,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"usage_limit_total": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"usage_limit_per_user": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ContentPagesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"page_title": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"body": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publish_status": "published",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"page_title": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"body": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publish_status": "published",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"page_title": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"body": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publish_status": "published",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"page_title": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"body": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publish_status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"page_title": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"body": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publish_status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"published_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const BannersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"banner_title": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_url": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"placement": "category_top",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"banner_title": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_url": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"placement": "home_hero",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"banner_title": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_url": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"placement": "home_section",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"banner_title": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_url": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"placement": "home_hero",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"banner_title": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_url": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"placement": "product_sidebar",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCategoryWithParent_category() {
|
|
|
|
const relatedParent_category0 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Category0 = await Categories.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Category0?.setParent_category)
|
|
{
|
|
await
|
|
Category0.
|
|
setParent_category(relatedParent_category0);
|
|
}
|
|
|
|
const relatedParent_category1 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Category1 = await Categories.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Category1?.setParent_category)
|
|
{
|
|
await
|
|
Category1.
|
|
setParent_category(relatedParent_category1);
|
|
}
|
|
|
|
const relatedParent_category2 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Category2 = await Categories.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Category2?.setParent_category)
|
|
{
|
|
await
|
|
Category2.
|
|
setParent_category(relatedParent_category2);
|
|
}
|
|
|
|
const relatedParent_category3 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Category3 = await Categories.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Category3?.setParent_category)
|
|
{
|
|
await
|
|
Category3.
|
|
setParent_category(relatedParent_category3);
|
|
}
|
|
|
|
const relatedParent_category4 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Category4 = await Categories.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Category4?.setParent_category)
|
|
{
|
|
await
|
|
Category4.
|
|
setParent_category(relatedParent_category4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProductWithBrand() {
|
|
|
|
const relatedBrand0 = await Brands.findOne({
|
|
offset: Math.floor(Math.random() * (await Brands.count())),
|
|
});
|
|
const Product0 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Product0?.setBrand)
|
|
{
|
|
await
|
|
Product0.
|
|
setBrand(relatedBrand0);
|
|
}
|
|
|
|
const relatedBrand1 = await Brands.findOne({
|
|
offset: Math.floor(Math.random() * (await Brands.count())),
|
|
});
|
|
const Product1 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Product1?.setBrand)
|
|
{
|
|
await
|
|
Product1.
|
|
setBrand(relatedBrand1);
|
|
}
|
|
|
|
const relatedBrand2 = await Brands.findOne({
|
|
offset: Math.floor(Math.random() * (await Brands.count())),
|
|
});
|
|
const Product2 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Product2?.setBrand)
|
|
{
|
|
await
|
|
Product2.
|
|
setBrand(relatedBrand2);
|
|
}
|
|
|
|
const relatedBrand3 = await Brands.findOne({
|
|
offset: Math.floor(Math.random() * (await Brands.count())),
|
|
});
|
|
const Product3 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Product3?.setBrand)
|
|
{
|
|
await
|
|
Product3.
|
|
setBrand(relatedBrand3);
|
|
}
|
|
|
|
const relatedBrand4 = await Brands.findOne({
|
|
offset: Math.floor(Math.random() * (await Brands.count())),
|
|
});
|
|
const Product4 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Product4?.setBrand)
|
|
{
|
|
await
|
|
Product4.
|
|
setBrand(relatedBrand4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateProductWithCategory() {
|
|
|
|
const relatedCategory0 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Product0 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Product0?.setCategory)
|
|
{
|
|
await
|
|
Product0.
|
|
setCategory(relatedCategory0);
|
|
}
|
|
|
|
const relatedCategory1 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Product1 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Product1?.setCategory)
|
|
{
|
|
await
|
|
Product1.
|
|
setCategory(relatedCategory1);
|
|
}
|
|
|
|
const relatedCategory2 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Product2 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Product2?.setCategory)
|
|
{
|
|
await
|
|
Product2.
|
|
setCategory(relatedCategory2);
|
|
}
|
|
|
|
const relatedCategory3 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Product3 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Product3?.setCategory)
|
|
{
|
|
await
|
|
Product3.
|
|
setCategory(relatedCategory3);
|
|
}
|
|
|
|
const relatedCategory4 = await Categories.findOne({
|
|
offset: Math.floor(Math.random() * (await Categories.count())),
|
|
});
|
|
const Product4 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Product4?.setCategory)
|
|
{
|
|
await
|
|
Product4.
|
|
setCategory(relatedCategory4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProductAttributeValueWithProduct() {
|
|
|
|
const relatedProduct0 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const ProductAttributeValue0 = await ProductAttributeValues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductAttributeValue0?.setProduct)
|
|
{
|
|
await
|
|
ProductAttributeValue0.
|
|
setProduct(relatedProduct0);
|
|
}
|
|
|
|
const relatedProduct1 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const ProductAttributeValue1 = await ProductAttributeValues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductAttributeValue1?.setProduct)
|
|
{
|
|
await
|
|
ProductAttributeValue1.
|
|
setProduct(relatedProduct1);
|
|
}
|
|
|
|
const relatedProduct2 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const ProductAttributeValue2 = await ProductAttributeValues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductAttributeValue2?.setProduct)
|
|
{
|
|
await
|
|
ProductAttributeValue2.
|
|
setProduct(relatedProduct2);
|
|
}
|
|
|
|
const relatedProduct3 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const ProductAttributeValue3 = await ProductAttributeValues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductAttributeValue3?.setProduct)
|
|
{
|
|
await
|
|
ProductAttributeValue3.
|
|
setProduct(relatedProduct3);
|
|
}
|
|
|
|
const relatedProduct4 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const ProductAttributeValue4 = await ProductAttributeValues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (ProductAttributeValue4?.setProduct)
|
|
{
|
|
await
|
|
ProductAttributeValue4.
|
|
setProduct(relatedProduct4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateProductAttributeValueWithAttribute() {
|
|
|
|
const relatedAttribute0 = await ProductAttributes.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductAttributes.count())),
|
|
});
|
|
const ProductAttributeValue0 = await ProductAttributeValues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductAttributeValue0?.setAttribute)
|
|
{
|
|
await
|
|
ProductAttributeValue0.
|
|
setAttribute(relatedAttribute0);
|
|
}
|
|
|
|
const relatedAttribute1 = await ProductAttributes.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductAttributes.count())),
|
|
});
|
|
const ProductAttributeValue1 = await ProductAttributeValues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductAttributeValue1?.setAttribute)
|
|
{
|
|
await
|
|
ProductAttributeValue1.
|
|
setAttribute(relatedAttribute1);
|
|
}
|
|
|
|
const relatedAttribute2 = await ProductAttributes.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductAttributes.count())),
|
|
});
|
|
const ProductAttributeValue2 = await ProductAttributeValues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductAttributeValue2?.setAttribute)
|
|
{
|
|
await
|
|
ProductAttributeValue2.
|
|
setAttribute(relatedAttribute2);
|
|
}
|
|
|
|
const relatedAttribute3 = await ProductAttributes.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductAttributes.count())),
|
|
});
|
|
const ProductAttributeValue3 = await ProductAttributeValues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (ProductAttributeValue3?.setAttribute)
|
|
{
|
|
await
|
|
ProductAttributeValue3.
|
|
setAttribute(relatedAttribute3);
|
|
}
|
|
|
|
const relatedAttribute4 = await ProductAttributes.findOne({
|
|
offset: Math.floor(Math.random() * (await ProductAttributes.count())),
|
|
});
|
|
const ProductAttributeValue4 = await ProductAttributeValues.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (ProductAttributeValue4?.setAttribute)
|
|
{
|
|
await
|
|
ProductAttributeValue4.
|
|
setAttribute(relatedAttribute4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWishlistWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Wishlist0 = await Wishlists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Wishlist0?.setUser)
|
|
{
|
|
await
|
|
Wishlist0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Wishlist1 = await Wishlists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Wishlist1?.setUser)
|
|
{
|
|
await
|
|
Wishlist1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Wishlist2 = await Wishlists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Wishlist2?.setUser)
|
|
{
|
|
await
|
|
Wishlist2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Wishlist3 = await Wishlists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Wishlist3?.setUser)
|
|
{
|
|
await
|
|
Wishlist3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
const relatedUser4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Wishlist4 = await Wishlists.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Wishlist4?.setUser)
|
|
{
|
|
await
|
|
Wishlist4.
|
|
setUser(relatedUser4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCartWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Cart0 = await Carts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Cart0?.setUser)
|
|
{
|
|
await
|
|
Cart0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Cart1 = await Carts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Cart1?.setUser)
|
|
{
|
|
await
|
|
Cart1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Cart2 = await Carts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Cart2?.setUser)
|
|
{
|
|
await
|
|
Cart2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Cart3 = await Carts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Cart3?.setUser)
|
|
{
|
|
await
|
|
Cart3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
const relatedUser4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Cart4 = await Carts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Cart4?.setUser)
|
|
{
|
|
await
|
|
Cart4.
|
|
setUser(relatedUser4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCartItemWithCart() {
|
|
|
|
const relatedCart0 = await Carts.findOne({
|
|
offset: Math.floor(Math.random() * (await Carts.count())),
|
|
});
|
|
const CartItem0 = await CartItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (CartItem0?.setCart)
|
|
{
|
|
await
|
|
CartItem0.
|
|
setCart(relatedCart0);
|
|
}
|
|
|
|
const relatedCart1 = await Carts.findOne({
|
|
offset: Math.floor(Math.random() * (await Carts.count())),
|
|
});
|
|
const CartItem1 = await CartItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (CartItem1?.setCart)
|
|
{
|
|
await
|
|
CartItem1.
|
|
setCart(relatedCart1);
|
|
}
|
|
|
|
const relatedCart2 = await Carts.findOne({
|
|
offset: Math.floor(Math.random() * (await Carts.count())),
|
|
});
|
|
const CartItem2 = await CartItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (CartItem2?.setCart)
|
|
{
|
|
await
|
|
CartItem2.
|
|
setCart(relatedCart2);
|
|
}
|
|
|
|
const relatedCart3 = await Carts.findOne({
|
|
offset: Math.floor(Math.random() * (await Carts.count())),
|
|
});
|
|
const CartItem3 = await CartItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (CartItem3?.setCart)
|
|
{
|
|
await
|
|
CartItem3.
|
|
setCart(relatedCart3);
|
|
}
|
|
|
|
const relatedCart4 = await Carts.findOne({
|
|
offset: Math.floor(Math.random() * (await Carts.count())),
|
|
});
|
|
const CartItem4 = await CartItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (CartItem4?.setCart)
|
|
{
|
|
await
|
|
CartItem4.
|
|
setCart(relatedCart4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateCartItemWithProduct() {
|
|
|
|
const relatedProduct0 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const CartItem0 = await CartItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (CartItem0?.setProduct)
|
|
{
|
|
await
|
|
CartItem0.
|
|
setProduct(relatedProduct0);
|
|
}
|
|
|
|
const relatedProduct1 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const CartItem1 = await CartItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (CartItem1?.setProduct)
|
|
{
|
|
await
|
|
CartItem1.
|
|
setProduct(relatedProduct1);
|
|
}
|
|
|
|
const relatedProduct2 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const CartItem2 = await CartItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (CartItem2?.setProduct)
|
|
{
|
|
await
|
|
CartItem2.
|
|
setProduct(relatedProduct2);
|
|
}
|
|
|
|
const relatedProduct3 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const CartItem3 = await CartItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (CartItem3?.setProduct)
|
|
{
|
|
await
|
|
CartItem3.
|
|
setProduct(relatedProduct3);
|
|
}
|
|
|
|
const relatedProduct4 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const CartItem4 = await CartItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (CartItem4?.setProduct)
|
|
{
|
|
await
|
|
CartItem4.
|
|
setProduct(relatedProduct4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAddressWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Address0 = await Addresses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Address0?.setUser)
|
|
{
|
|
await
|
|
Address0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Address1 = await Addresses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Address1?.setUser)
|
|
{
|
|
await
|
|
Address1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Address2 = await Addresses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Address2?.setUser)
|
|
{
|
|
await
|
|
Address2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Address3 = await Addresses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Address3?.setUser)
|
|
{
|
|
await
|
|
Address3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
const relatedUser4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Address4 = await Addresses.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Address4?.setUser)
|
|
{
|
|
await
|
|
Address4.
|
|
setUser(relatedUser4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateOrderWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Order0 = await Orders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Order0?.setUser)
|
|
{
|
|
await
|
|
Order0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Order1 = await Orders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Order1?.setUser)
|
|
{
|
|
await
|
|
Order1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Order2 = await Orders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Order2?.setUser)
|
|
{
|
|
await
|
|
Order2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Order3 = await Orders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Order3?.setUser)
|
|
{
|
|
await
|
|
Order3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
const relatedUser4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Order4 = await Orders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Order4?.setUser)
|
|
{
|
|
await
|
|
Order4.
|
|
setUser(relatedUser4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateOrderWithShipping_addres() {
|
|
|
|
const relatedShipping_addres0 = await Addresses.findOne({
|
|
offset: Math.floor(Math.random() * (await Addresses.count())),
|
|
});
|
|
const Order0 = await Orders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Order0?.setShipping_addres)
|
|
{
|
|
await
|
|
Order0.
|
|
setShipping_addres(relatedShipping_addres0);
|
|
}
|
|
|
|
const relatedShipping_addres1 = await Addresses.findOne({
|
|
offset: Math.floor(Math.random() * (await Addresses.count())),
|
|
});
|
|
const Order1 = await Orders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Order1?.setShipping_addres)
|
|
{
|
|
await
|
|
Order1.
|
|
setShipping_addres(relatedShipping_addres1);
|
|
}
|
|
|
|
const relatedShipping_addres2 = await Addresses.findOne({
|
|
offset: Math.floor(Math.random() * (await Addresses.count())),
|
|
});
|
|
const Order2 = await Orders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Order2?.setShipping_addres)
|
|
{
|
|
await
|
|
Order2.
|
|
setShipping_addres(relatedShipping_addres2);
|
|
}
|
|
|
|
const relatedShipping_addres3 = await Addresses.findOne({
|
|
offset: Math.floor(Math.random() * (await Addresses.count())),
|
|
});
|
|
const Order3 = await Orders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Order3?.setShipping_addres)
|
|
{
|
|
await
|
|
Order3.
|
|
setShipping_addres(relatedShipping_addres3);
|
|
}
|
|
|
|
const relatedShipping_addres4 = await Addresses.findOne({
|
|
offset: Math.floor(Math.random() * (await Addresses.count())),
|
|
});
|
|
const Order4 = await Orders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Order4?.setShipping_addres)
|
|
{
|
|
await
|
|
Order4.
|
|
setShipping_addres(relatedShipping_addres4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateOrderItemWithOrder() {
|
|
|
|
const relatedOrder0 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const OrderItem0 = await OrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (OrderItem0?.setOrder)
|
|
{
|
|
await
|
|
OrderItem0.
|
|
setOrder(relatedOrder0);
|
|
}
|
|
|
|
const relatedOrder1 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const OrderItem1 = await OrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (OrderItem1?.setOrder)
|
|
{
|
|
await
|
|
OrderItem1.
|
|
setOrder(relatedOrder1);
|
|
}
|
|
|
|
const relatedOrder2 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const OrderItem2 = await OrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (OrderItem2?.setOrder)
|
|
{
|
|
await
|
|
OrderItem2.
|
|
setOrder(relatedOrder2);
|
|
}
|
|
|
|
const relatedOrder3 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const OrderItem3 = await OrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (OrderItem3?.setOrder)
|
|
{
|
|
await
|
|
OrderItem3.
|
|
setOrder(relatedOrder3);
|
|
}
|
|
|
|
const relatedOrder4 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const OrderItem4 = await OrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (OrderItem4?.setOrder)
|
|
{
|
|
await
|
|
OrderItem4.
|
|
setOrder(relatedOrder4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateOrderItemWithProduct() {
|
|
|
|
const relatedProduct0 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const OrderItem0 = await OrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (OrderItem0?.setProduct)
|
|
{
|
|
await
|
|
OrderItem0.
|
|
setProduct(relatedProduct0);
|
|
}
|
|
|
|
const relatedProduct1 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const OrderItem1 = await OrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (OrderItem1?.setProduct)
|
|
{
|
|
await
|
|
OrderItem1.
|
|
setProduct(relatedProduct1);
|
|
}
|
|
|
|
const relatedProduct2 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const OrderItem2 = await OrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (OrderItem2?.setProduct)
|
|
{
|
|
await
|
|
OrderItem2.
|
|
setProduct(relatedProduct2);
|
|
}
|
|
|
|
const relatedProduct3 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const OrderItem3 = await OrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (OrderItem3?.setProduct)
|
|
{
|
|
await
|
|
OrderItem3.
|
|
setProduct(relatedProduct3);
|
|
}
|
|
|
|
const relatedProduct4 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const OrderItem4 = await OrderItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (OrderItem4?.setProduct)
|
|
{
|
|
await
|
|
OrderItem4.
|
|
setProduct(relatedProduct4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePaymentWithOrder() {
|
|
|
|
const relatedOrder0 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const Payment0 = await Payments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Payment0?.setOrder)
|
|
{
|
|
await
|
|
Payment0.
|
|
setOrder(relatedOrder0);
|
|
}
|
|
|
|
const relatedOrder1 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const Payment1 = await Payments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Payment1?.setOrder)
|
|
{
|
|
await
|
|
Payment1.
|
|
setOrder(relatedOrder1);
|
|
}
|
|
|
|
const relatedOrder2 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const Payment2 = await Payments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Payment2?.setOrder)
|
|
{
|
|
await
|
|
Payment2.
|
|
setOrder(relatedOrder2);
|
|
}
|
|
|
|
const relatedOrder3 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const Payment3 = await Payments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Payment3?.setOrder)
|
|
{
|
|
await
|
|
Payment3.
|
|
setOrder(relatedOrder3);
|
|
}
|
|
|
|
const relatedOrder4 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const Payment4 = await Payments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Payment4?.setOrder)
|
|
{
|
|
await
|
|
Payment4.
|
|
setOrder(relatedOrder4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateShipmentWithOrder() {
|
|
|
|
const relatedOrder0 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const Shipment0 = await Shipments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Shipment0?.setOrder)
|
|
{
|
|
await
|
|
Shipment0.
|
|
setOrder(relatedOrder0);
|
|
}
|
|
|
|
const relatedOrder1 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const Shipment1 = await Shipments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Shipment1?.setOrder)
|
|
{
|
|
await
|
|
Shipment1.
|
|
setOrder(relatedOrder1);
|
|
}
|
|
|
|
const relatedOrder2 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const Shipment2 = await Shipments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Shipment2?.setOrder)
|
|
{
|
|
await
|
|
Shipment2.
|
|
setOrder(relatedOrder2);
|
|
}
|
|
|
|
const relatedOrder3 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const Shipment3 = await Shipments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Shipment3?.setOrder)
|
|
{
|
|
await
|
|
Shipment3.
|
|
setOrder(relatedOrder3);
|
|
}
|
|
|
|
const relatedOrder4 = await Orders.findOne({
|
|
offset: Math.floor(Math.random() * (await Orders.count())),
|
|
});
|
|
const Shipment4 = await Shipments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Shipment4?.setOrder)
|
|
{
|
|
await
|
|
Shipment4.
|
|
setOrder(relatedOrder4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateReviewWithProduct() {
|
|
|
|
const relatedProduct0 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const Review0 = await Reviews.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Review0?.setProduct)
|
|
{
|
|
await
|
|
Review0.
|
|
setProduct(relatedProduct0);
|
|
}
|
|
|
|
const relatedProduct1 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const Review1 = await Reviews.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Review1?.setProduct)
|
|
{
|
|
await
|
|
Review1.
|
|
setProduct(relatedProduct1);
|
|
}
|
|
|
|
const relatedProduct2 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const Review2 = await Reviews.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Review2?.setProduct)
|
|
{
|
|
await
|
|
Review2.
|
|
setProduct(relatedProduct2);
|
|
}
|
|
|
|
const relatedProduct3 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const Review3 = await Reviews.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Review3?.setProduct)
|
|
{
|
|
await
|
|
Review3.
|
|
setProduct(relatedProduct3);
|
|
}
|
|
|
|
const relatedProduct4 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const Review4 = await Reviews.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Review4?.setProduct)
|
|
{
|
|
await
|
|
Review4.
|
|
setProduct(relatedProduct4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateReviewWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Review0 = await Reviews.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Review0?.setUser)
|
|
{
|
|
await
|
|
Review0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Review1 = await Reviews.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Review1?.setUser)
|
|
{
|
|
await
|
|
Review1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Review2 = await Reviews.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Review2?.setUser)
|
|
{
|
|
await
|
|
Review2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Review3 = await Reviews.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Review3?.setUser)
|
|
{
|
|
await
|
|
Review3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
const relatedUser4 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Review4 = await Reviews.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 4
|
|
});
|
|
if (Review4?.setUser)
|
|
{
|
|
await
|
|
Review4.
|
|
setUser(relatedUser4);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Brands.bulkCreate(BrandsData);
|
|
|
|
|
|
|
|
|
|
await Categories.bulkCreate(CategoriesData);
|
|
|
|
|
|
|
|
|
|
await Products.bulkCreate(ProductsData);
|
|
|
|
|
|
|
|
|
|
await ProductAttributes.bulkCreate(ProductAttributesData);
|
|
|
|
|
|
|
|
|
|
await ProductAttributeValues.bulkCreate(ProductAttributeValuesData);
|
|
|
|
|
|
|
|
|
|
await Wishlists.bulkCreate(WishlistsData);
|
|
|
|
|
|
|
|
|
|
await Carts.bulkCreate(CartsData);
|
|
|
|
|
|
|
|
|
|
await CartItems.bulkCreate(CartItemsData);
|
|
|
|
|
|
|
|
|
|
await Addresses.bulkCreate(AddressesData);
|
|
|
|
|
|
|
|
|
|
await Orders.bulkCreate(OrdersData);
|
|
|
|
|
|
|
|
|
|
await OrderItems.bulkCreate(OrderItemsData);
|
|
|
|
|
|
|
|
|
|
await Payments.bulkCreate(PaymentsData);
|
|
|
|
|
|
|
|
|
|
await Shipments.bulkCreate(ShipmentsData);
|
|
|
|
|
|
|
|
|
|
await Reviews.bulkCreate(ReviewsData);
|
|
|
|
|
|
|
|
|
|
await Coupons.bulkCreate(CouponsData);
|
|
|
|
|
|
|
|
|
|
await ContentPages.bulkCreate(ContentPagesData);
|
|
|
|
|
|
|
|
|
|
await Banners.bulkCreate(BannersData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCategoryWithParent_category(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductWithBrand(),
|
|
|
|
|
|
|
|
|
|
await associateProductWithCategory(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductAttributeValueWithProduct(),
|
|
|
|
|
|
|
|
|
|
await associateProductAttributeValueWithAttribute(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWishlistWithUser(),
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCartWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCartItemWithCart(),
|
|
|
|
|
|
|
|
|
|
await associateCartItemWithProduct(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAddressWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateOrderWithUser(),
|
|
|
|
|
|
|
|
|
|
await associateOrderWithShipping_addres(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateOrderItemWithOrder(),
|
|
|
|
|
|
|
|
|
|
await associateOrderItemWithProduct(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePaymentWithOrder(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateShipmentWithOrder(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateReviewWithProduct(),
|
|
|
|
|
|
|
|
|
|
await associateReviewWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('brands', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('categories', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('products', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('product_attributes', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('product_attribute_values', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('wishlists', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('carts', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('cart_items', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('addresses', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('orders', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('order_items', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('payments', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('shipments', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('reviews', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('coupons', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('content_pages', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('banners', null, {});
|
|
|
|
|
|
},
|
|
}; |