5042 lines
97 KiB
JavaScript
5042 lines
97 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const SizeProfiles = db.size_profiles;
|
|
|
|
const UserPhotos = db.user_photos;
|
|
|
|
const Stores = db.stores;
|
|
|
|
const Brands = db.brands;
|
|
|
|
const Products = db.products;
|
|
|
|
const Colors = db.colors;
|
|
|
|
const ProductSizes = db.product_sizes;
|
|
|
|
const TryOnSessions = db.try_on_sessions;
|
|
|
|
const TryOnRenders = db.try_on_renders;
|
|
|
|
const StyleRequests = db.style_requests;
|
|
|
|
const Recommendations = db.recommendations;
|
|
|
|
const RecommendationItems = db.recommendation_items;
|
|
|
|
const Looks = db.looks;
|
|
|
|
const SharedLinks = db.shared_links;
|
|
|
|
const Favorites = db.favorites;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const SizeProfilesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"profile_name": "Jordan Default",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gender_presentation": "non_binary",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"fit_preference": "regular",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "United States",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"region": "CA",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tops_size": "M",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bottoms_size": "32",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"dress_size": "M",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shoe_size": "10",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"height_cm": 178,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"weight_kg": 77.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"chest_cm": 102,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"waist_cm": 84,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"hip_cm": 100,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Prefers breathable fabrics and neutral palettes",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_default": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"profile_name": "Avery Workwear",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gender_presentation": "prefer_not_to_say",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"fit_preference": "regular",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "United States",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"region": "NY",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tops_size": "S",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bottoms_size": "30",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"dress_size": "S",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shoe_size": "8.5",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"height_cm": 170,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"weight_kg": 63.2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"chest_cm": 92,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"waist_cm": 76,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"hip_cm": 94,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Often shops for business casual looks",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_default": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"profile_name": "Morgan Weekend",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"gender_presentation": "male",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"fit_preference": "regular",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "United States",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"region": "WA",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tops_size": "L",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"bottoms_size": "12",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"dress_size": "L",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"shoe_size": "9",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"height_cm": 168,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"weight_kg": 70.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"chest_cm": 100,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"waist_cm": 82,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"hip_cm": 106,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Likes layered outfits and sneakers",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_default": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const UserPhotosData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"photo_type": "back",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_primary": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capture_notes": "Full body photo against plain wall",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"captured_at": new Date('2026-02-05T17:10:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"photo_type": "side",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_primary": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capture_notes": "Side profile for fit accuracy",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"captured_at": new Date('2026-02-05T17:12:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"photo_type": "full_body",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_primary": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"capture_notes": "Natural lighting, neutral background",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"captured_at": new Date('2026-01-28T09:20:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const StoresData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"store_name": "Nordic Outfitters",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website_url": "https://nordicoutfitters.example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "United States",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"affiliate_tag": "nordic-tryon-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"store_name": "Metro Style Market",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website_url": "https://metrostylenarket.example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "United States",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"affiliate_tag": "metro-tryon-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"store_name": "Coastal Threads",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website_url": "https://coastalthreads.example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"country": "United States",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"affiliate_tag": "coastal-tryon-01",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const BrandsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"brand_name": "Arden & Co",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website_url": "https://ardenandco.example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"brand_name": "Lumen Studio",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website_url": "https://lumenstudio.example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"brand_name": "Stonebridge Denim",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website_url": "https://stonebridgedenim.example.com",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ProductsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"product_name": "Tailored Wool Blazer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_type": "other",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_url": "https://nordicoutfitters.example.com/products/tailored-wool-blazer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "NO-BLZ-001",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price_amount": 189.99,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price_currency": "USD",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"availability": "out_of_stock",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"primary_color": "Navy",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"material": "Wool blend",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Structured blazer suitable for work and events",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_checked_at": new Date('2026-02-12T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"product_name": "Silk Midi Dress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_type": "bottom",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_url": "https://evergreenboutique.example.com/products/silk-midi-dress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "EB-DRS-204",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price_amount": 149.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price_currency": "USD",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"availability": "out_of_stock",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"primary_color": "Burgundy",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"material": "Silk",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Elegant midi dress with subtle sheen",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_checked_at": new Date('2026-02-12T10:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"product_name": "Straight Fit Denim",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_type": "shoes",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"product_url": "https://metrostylenarket.example.com/products/straight-fit-denim",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sku": "MSM-DNM-310",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price_amount": 79.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"price_currency": "USD",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"availability": "out_of_stock",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"primary_color": "Black",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"material": "Cotton denim",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Classic straight fit denim for everyday wear",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"last_checked_at": new Date('2026-02-11T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_active": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ColorsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"color_name": "Black",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"hex_value": "#000000",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color_family": "multi",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"color_name": "Navy",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"hex_value": "#0A1F44",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color_family": "other",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"color_name": "Ivory",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"hex_value": "#FFFFF0",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color_family": "yellow",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ProductSizesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"size_label": "S",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"size_type": "waist_inseam",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_available": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"size_label": "M",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"size_type": "numeric",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_available": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"size_label": "S",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"size_type": "waist_inseam",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_available": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const TryOnSessionsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"input_product_url": "https://evergreenboutique.example.com/products/silk-midi-dress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "queued",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"render_mode": "ai_360",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_cost": 1.25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"error_message": "None",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-02-06T18:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-02-06T18:07:30Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"input_product_url": "https://cityfootwear.example.com/products/minimal-leather-sneakers",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "completed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"render_mode": "ai_360",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_cost": 0.75,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"error_message": "None",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-02-02T09:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-02-02T09:13:10Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"input_product_url": "https://nordicoutfitters.example.com/products/tailored-wool-blazer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "processing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"render_mode": "ai_try_on",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimated_cost": 0.75,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"error_message": "None",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date('2026-02-14T14:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-02-14T14:25:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const TryOnRendersData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"render_type": "mesh",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider_name": "TryOnAPI",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider_job_ref": "job_6f1a2c",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"frame_count": 36,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quality_score": 0.92,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"generated_at": new Date('2026-02-06T18:07:20Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"render_type": "spin_360",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider_name": "TryOnAPI",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider_job_ref": "job_19bd77",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"frame_count": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quality_score": 0.88,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"generated_at": new Date('2026-02-02T09:13:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"render_type": "image",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider_name": "MockRenderer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider_job_ref": "mock_0a21",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"frame_count": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quality_score": 0.6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"generated_at": new Date('2026-02-09T20:05:18Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const StyleRequestsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"request_title": "Wedding guest outfit in emerald",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_type": "party",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_location": "Austin, TX",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_start_at": new Date('2026-03-01T23:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_end_at": new Date('2026-03-02T03:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"preferred_color": "Emerald",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"budget_min": 150.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"budget_max": 350.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"budget_currency": "USD",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"style_vibe": "streetwear",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Prefer midi length and comfortable shoes",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "ready",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"submitted_at": new Date('2026-02-12T19:30:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"request_title": "Casual weekend capsule refresh",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_type": "other",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_location": "Seattle, WA",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_start_at": new Date('2026-02-22T18:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_end_at": new Date('2026-02-23T02:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"preferred_color": "Navy",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"budget_min": 80.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"budget_max": 220.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"budget_currency": "USD",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"style_vibe": "minimal",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Looking for versatile sneakers and layering pieces",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "archived",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"submitted_at": new Date('2026-02-10T08:20:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"request_title": "Interview outfit under 250",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_type": "gym",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_location": "New York, NY",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_start_at": new Date('2026-02-26T14:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"event_end_at": new Date('2026-02-26T16:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"preferred_color": "Black",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"budget_min": 120.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"budget_max": 250.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"budget_currency": "USD",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"style_vibe": "preppy",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Prefer tailored look, not overly formal",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "archived",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"submitted_at": new Date('2026-02-11T15:05:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const RecommendationsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recommendation_type": "full_outfit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recommendation_title": "Emerald wedding guest look",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reasoning": "Elegant silhouette with refined accessories and balanced budget",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_price_amount": 278.99,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_price_currency": "USD",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "dismissed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"generated_at": new Date('2026-02-12T20:05:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recommendation_type": "single_item",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recommendation_title": "Minimal weekend essentials",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reasoning": "Clean basics with comfortable footwear for repeat wear",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_price_amount": 209.49,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_price_currency": "USD",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "saved",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"generated_at": new Date('2026-02-10T09:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recommendation_type": "full_outfit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recommendation_title": "Interview ready tailoring",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reasoning": "Structured outerwear and dark denim for a sharp but approachable look",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_price_amount": 269.49,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_price_currency": "USD",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "purchased",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"generated_at": new Date('2026-02-11T15:40:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const RecommendationItemsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_role": "bag",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_price_amount": 149.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_price_currency": "USD",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_role": "other",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_price_amount": 110.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_price_currency": "USD",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_role": "dress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"quantity": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_price_amount": 129.99,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"item_price_currency": "USD",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const LooksData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"look_name": "Emerald Wedding Guest Preview",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"visibility": "private",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Saved for final decision after accessories",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"saved_at": new Date('2026-02-06T19:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"look_name": "Weekend Minimal Fit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"visibility": "public",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Good everyday combo for errands and coffee",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"saved_at": new Date('2026-02-02T10:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"look_name": "Client Meeting Outfit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"visibility": "public",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"notes": "Waiting for blazer render completion",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"saved_at": new Date('2026-02-14T15:10:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const SharedLinksData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"share_token": "sh_tok_8c2f1a9b",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2026-03-02T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_revoked": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"share_token": "sh_tok_14d7c3e1",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2026-02-28T19:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_revoked": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"share_token": "sh_tok_a91b0d2c",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"expires_at": new Date('2026-03-10T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_revoked": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const FavoritesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"favorite_type": "brand",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"favorited_at": new Date('2026-02-07T09:00:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"favorite_type": "product",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"favorited_at": new Date('2026-02-07T09:05:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"favorite_type": "product",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"favorited_at": new Date('2026-02-03T11:15:00Z'),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateSizeProfileWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SizeProfile0 = await SizeProfiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (SizeProfile0?.setUser)
|
|
{
|
|
await
|
|
SizeProfile0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SizeProfile1 = await SizeProfiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (SizeProfile1?.setUser)
|
|
{
|
|
await
|
|
SizeProfile1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SizeProfile2 = await SizeProfiles.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (SizeProfile2?.setUser)
|
|
{
|
|
await
|
|
SizeProfile2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateUserPhotoWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const UserPhoto0 = await UserPhotos.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (UserPhoto0?.setUser)
|
|
{
|
|
await
|
|
UserPhoto0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const UserPhoto1 = await UserPhotos.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (UserPhoto1?.setUser)
|
|
{
|
|
await
|
|
UserPhoto1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const UserPhoto2 = await UserPhotos.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (UserPhoto2?.setUser)
|
|
{
|
|
await
|
|
UserPhoto2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateProductWithStore() {
|
|
|
|
const relatedStore0 = await Stores.findOne({
|
|
offset: Math.floor(Math.random() * (await Stores.count())),
|
|
});
|
|
const Product0 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Product0?.setStore)
|
|
{
|
|
await
|
|
Product0.
|
|
setStore(relatedStore0);
|
|
}
|
|
|
|
const relatedStore1 = await Stores.findOne({
|
|
offset: Math.floor(Math.random() * (await Stores.count())),
|
|
});
|
|
const Product1 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Product1?.setStore)
|
|
{
|
|
await
|
|
Product1.
|
|
setStore(relatedStore1);
|
|
}
|
|
|
|
const relatedStore2 = await Stores.findOne({
|
|
offset: Math.floor(Math.random() * (await Stores.count())),
|
|
});
|
|
const Product2 = await Products.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Product2?.setStore)
|
|
{
|
|
await
|
|
Product2.
|
|
setStore(relatedStore2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProductSizeWithProduct() {
|
|
|
|
const relatedProduct0 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const ProductSize0 = await ProductSizes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (ProductSize0?.setProduct)
|
|
{
|
|
await
|
|
ProductSize0.
|
|
setProduct(relatedProduct0);
|
|
}
|
|
|
|
const relatedProduct1 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const ProductSize1 = await ProductSizes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (ProductSize1?.setProduct)
|
|
{
|
|
await
|
|
ProductSize1.
|
|
setProduct(relatedProduct1);
|
|
}
|
|
|
|
const relatedProduct2 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const ProductSize2 = await ProductSizes.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (ProductSize2?.setProduct)
|
|
{
|
|
await
|
|
ProductSize2.
|
|
setProduct(relatedProduct2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTryOnSessionWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TryOnSession0 = await TryOnSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TryOnSession0?.setUser)
|
|
{
|
|
await
|
|
TryOnSession0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TryOnSession1 = await TryOnSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TryOnSession1?.setUser)
|
|
{
|
|
await
|
|
TryOnSession1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TryOnSession2 = await TryOnSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TryOnSession2?.setUser)
|
|
{
|
|
await
|
|
TryOnSession2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateTryOnSessionWithUser_photo() {
|
|
|
|
const relatedUser_photo0 = await UserPhotos.findOne({
|
|
offset: Math.floor(Math.random() * (await UserPhotos.count())),
|
|
});
|
|
const TryOnSession0 = await TryOnSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TryOnSession0?.setUser_photo)
|
|
{
|
|
await
|
|
TryOnSession0.
|
|
setUser_photo(relatedUser_photo0);
|
|
}
|
|
|
|
const relatedUser_photo1 = await UserPhotos.findOne({
|
|
offset: Math.floor(Math.random() * (await UserPhotos.count())),
|
|
});
|
|
const TryOnSession1 = await TryOnSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TryOnSession1?.setUser_photo)
|
|
{
|
|
await
|
|
TryOnSession1.
|
|
setUser_photo(relatedUser_photo1);
|
|
}
|
|
|
|
const relatedUser_photo2 = await UserPhotos.findOne({
|
|
offset: Math.floor(Math.random() * (await UserPhotos.count())),
|
|
});
|
|
const TryOnSession2 = await TryOnSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TryOnSession2?.setUser_photo)
|
|
{
|
|
await
|
|
TryOnSession2.
|
|
setUser_photo(relatedUser_photo2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateTryOnSessionWithSize_profile() {
|
|
|
|
const relatedSize_profile0 = await SizeProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await SizeProfiles.count())),
|
|
});
|
|
const TryOnSession0 = await TryOnSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TryOnSession0?.setSize_profile)
|
|
{
|
|
await
|
|
TryOnSession0.
|
|
setSize_profile(relatedSize_profile0);
|
|
}
|
|
|
|
const relatedSize_profile1 = await SizeProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await SizeProfiles.count())),
|
|
});
|
|
const TryOnSession1 = await TryOnSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TryOnSession1?.setSize_profile)
|
|
{
|
|
await
|
|
TryOnSession1.
|
|
setSize_profile(relatedSize_profile1);
|
|
}
|
|
|
|
const relatedSize_profile2 = await SizeProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await SizeProfiles.count())),
|
|
});
|
|
const TryOnSession2 = await TryOnSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TryOnSession2?.setSize_profile)
|
|
{
|
|
await
|
|
TryOnSession2.
|
|
setSize_profile(relatedSize_profile2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTryOnSessionWithProduct() {
|
|
|
|
const relatedProduct0 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const TryOnSession0 = await TryOnSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TryOnSession0?.setProduct)
|
|
{
|
|
await
|
|
TryOnSession0.
|
|
setProduct(relatedProduct0);
|
|
}
|
|
|
|
const relatedProduct1 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const TryOnSession1 = await TryOnSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TryOnSession1?.setProduct)
|
|
{
|
|
await
|
|
TryOnSession1.
|
|
setProduct(relatedProduct1);
|
|
}
|
|
|
|
const relatedProduct2 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const TryOnSession2 = await TryOnSessions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TryOnSession2?.setProduct)
|
|
{
|
|
await
|
|
TryOnSession2.
|
|
setProduct(relatedProduct2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTryOnRenderWithSession() {
|
|
|
|
const relatedSession0 = await TryOnSessions.findOne({
|
|
offset: Math.floor(Math.random() * (await TryOnSessions.count())),
|
|
});
|
|
const TryOnRender0 = await TryOnRenders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TryOnRender0?.setSession)
|
|
{
|
|
await
|
|
TryOnRender0.
|
|
setSession(relatedSession0);
|
|
}
|
|
|
|
const relatedSession1 = await TryOnSessions.findOne({
|
|
offset: Math.floor(Math.random() * (await TryOnSessions.count())),
|
|
});
|
|
const TryOnRender1 = await TryOnRenders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TryOnRender1?.setSession)
|
|
{
|
|
await
|
|
TryOnRender1.
|
|
setSession(relatedSession1);
|
|
}
|
|
|
|
const relatedSession2 = await TryOnSessions.findOne({
|
|
offset: Math.floor(Math.random() * (await TryOnSessions.count())),
|
|
});
|
|
const TryOnRender2 = await TryOnRenders.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TryOnRender2?.setSession)
|
|
{
|
|
await
|
|
TryOnRender2.
|
|
setSession(relatedSession2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateStyleRequestWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const StyleRequest0 = await StyleRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (StyleRequest0?.setUser)
|
|
{
|
|
await
|
|
StyleRequest0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const StyleRequest1 = await StyleRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (StyleRequest1?.setUser)
|
|
{
|
|
await
|
|
StyleRequest1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const StyleRequest2 = await StyleRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (StyleRequest2?.setUser)
|
|
{
|
|
await
|
|
StyleRequest2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateStyleRequestWithSize_profile() {
|
|
|
|
const relatedSize_profile0 = await SizeProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await SizeProfiles.count())),
|
|
});
|
|
const StyleRequest0 = await StyleRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (StyleRequest0?.setSize_profile)
|
|
{
|
|
await
|
|
StyleRequest0.
|
|
setSize_profile(relatedSize_profile0);
|
|
}
|
|
|
|
const relatedSize_profile1 = await SizeProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await SizeProfiles.count())),
|
|
});
|
|
const StyleRequest1 = await StyleRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (StyleRequest1?.setSize_profile)
|
|
{
|
|
await
|
|
StyleRequest1.
|
|
setSize_profile(relatedSize_profile1);
|
|
}
|
|
|
|
const relatedSize_profile2 = await SizeProfiles.findOne({
|
|
offset: Math.floor(Math.random() * (await SizeProfiles.count())),
|
|
});
|
|
const StyleRequest2 = await StyleRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (StyleRequest2?.setSize_profile)
|
|
{
|
|
await
|
|
StyleRequest2.
|
|
setSize_profile(relatedSize_profile2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateRecommendationWithStyle_request() {
|
|
|
|
const relatedStyle_request0 = await StyleRequests.findOne({
|
|
offset: Math.floor(Math.random() * (await StyleRequests.count())),
|
|
});
|
|
const Recommendation0 = await Recommendations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Recommendation0?.setStyle_request)
|
|
{
|
|
await
|
|
Recommendation0.
|
|
setStyle_request(relatedStyle_request0);
|
|
}
|
|
|
|
const relatedStyle_request1 = await StyleRequests.findOne({
|
|
offset: Math.floor(Math.random() * (await StyleRequests.count())),
|
|
});
|
|
const Recommendation1 = await Recommendations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Recommendation1?.setStyle_request)
|
|
{
|
|
await
|
|
Recommendation1.
|
|
setStyle_request(relatedStyle_request1);
|
|
}
|
|
|
|
const relatedStyle_request2 = await StyleRequests.findOne({
|
|
offset: Math.floor(Math.random() * (await StyleRequests.count())),
|
|
});
|
|
const Recommendation2 = await Recommendations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Recommendation2?.setStyle_request)
|
|
{
|
|
await
|
|
Recommendation2.
|
|
setStyle_request(relatedStyle_request2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateRecommendationItemWithRecommendation() {
|
|
|
|
const relatedRecommendation0 = await Recommendations.findOne({
|
|
offset: Math.floor(Math.random() * (await Recommendations.count())),
|
|
});
|
|
const RecommendationItem0 = await RecommendationItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (RecommendationItem0?.setRecommendation)
|
|
{
|
|
await
|
|
RecommendationItem0.
|
|
setRecommendation(relatedRecommendation0);
|
|
}
|
|
|
|
const relatedRecommendation1 = await Recommendations.findOne({
|
|
offset: Math.floor(Math.random() * (await Recommendations.count())),
|
|
});
|
|
const RecommendationItem1 = await RecommendationItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (RecommendationItem1?.setRecommendation)
|
|
{
|
|
await
|
|
RecommendationItem1.
|
|
setRecommendation(relatedRecommendation1);
|
|
}
|
|
|
|
const relatedRecommendation2 = await Recommendations.findOne({
|
|
offset: Math.floor(Math.random() * (await Recommendations.count())),
|
|
});
|
|
const RecommendationItem2 = await RecommendationItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (RecommendationItem2?.setRecommendation)
|
|
{
|
|
await
|
|
RecommendationItem2.
|
|
setRecommendation(relatedRecommendation2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateRecommendationItemWithProduct() {
|
|
|
|
const relatedProduct0 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const RecommendationItem0 = await RecommendationItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (RecommendationItem0?.setProduct)
|
|
{
|
|
await
|
|
RecommendationItem0.
|
|
setProduct(relatedProduct0);
|
|
}
|
|
|
|
const relatedProduct1 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const RecommendationItem1 = await RecommendationItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (RecommendationItem1?.setProduct)
|
|
{
|
|
await
|
|
RecommendationItem1.
|
|
setProduct(relatedProduct1);
|
|
}
|
|
|
|
const relatedProduct2 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const RecommendationItem2 = await RecommendationItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (RecommendationItem2?.setProduct)
|
|
{
|
|
await
|
|
RecommendationItem2.
|
|
setProduct(relatedProduct2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateLookWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Look0 = await Looks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Look0?.setUser)
|
|
{
|
|
await
|
|
Look0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Look1 = await Looks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Look1?.setUser)
|
|
{
|
|
await
|
|
Look1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Look2 = await Looks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Look2?.setUser)
|
|
{
|
|
await
|
|
Look2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
async function associateLookWithTry_on_session() {
|
|
|
|
const relatedTry_on_session0 = await TryOnSessions.findOne({
|
|
offset: Math.floor(Math.random() * (await TryOnSessions.count())),
|
|
});
|
|
const Look0 = await Looks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Look0?.setTry_on_session)
|
|
{
|
|
await
|
|
Look0.
|
|
setTry_on_session(relatedTry_on_session0);
|
|
}
|
|
|
|
const relatedTry_on_session1 = await TryOnSessions.findOne({
|
|
offset: Math.floor(Math.random() * (await TryOnSessions.count())),
|
|
});
|
|
const Look1 = await Looks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Look1?.setTry_on_session)
|
|
{
|
|
await
|
|
Look1.
|
|
setTry_on_session(relatedTry_on_session1);
|
|
}
|
|
|
|
const relatedTry_on_session2 = await TryOnSessions.findOne({
|
|
offset: Math.floor(Math.random() * (await TryOnSessions.count())),
|
|
});
|
|
const Look2 = await Looks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Look2?.setTry_on_session)
|
|
{
|
|
await
|
|
Look2.
|
|
setTry_on_session(relatedTry_on_session2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateSharedLinkWithLook() {
|
|
|
|
const relatedLook0 = await Looks.findOne({
|
|
offset: Math.floor(Math.random() * (await Looks.count())),
|
|
});
|
|
const SharedLink0 = await SharedLinks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (SharedLink0?.setLook)
|
|
{
|
|
await
|
|
SharedLink0.
|
|
setLook(relatedLook0);
|
|
}
|
|
|
|
const relatedLook1 = await Looks.findOne({
|
|
offset: Math.floor(Math.random() * (await Looks.count())),
|
|
});
|
|
const SharedLink1 = await SharedLinks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (SharedLink1?.setLook)
|
|
{
|
|
await
|
|
SharedLink1.
|
|
setLook(relatedLook1);
|
|
}
|
|
|
|
const relatedLook2 = await Looks.findOne({
|
|
offset: Math.floor(Math.random() * (await Looks.count())),
|
|
});
|
|
const SharedLink2 = await SharedLinks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (SharedLink2?.setLook)
|
|
{
|
|
await
|
|
SharedLink2.
|
|
setLook(relatedLook2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateFavoriteWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Favorite0 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Favorite0?.setUser)
|
|
{
|
|
await
|
|
Favorite0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Favorite1 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Favorite1?.setUser)
|
|
{
|
|
await
|
|
Favorite1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Favorite2 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Favorite2?.setUser)
|
|
{
|
|
await
|
|
Favorite2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateFavoriteWithProduct() {
|
|
|
|
const relatedProduct0 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const Favorite0 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Favorite0?.setProduct)
|
|
{
|
|
await
|
|
Favorite0.
|
|
setProduct(relatedProduct0);
|
|
}
|
|
|
|
const relatedProduct1 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const Favorite1 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Favorite1?.setProduct)
|
|
{
|
|
await
|
|
Favorite1.
|
|
setProduct(relatedProduct1);
|
|
}
|
|
|
|
const relatedProduct2 = await Products.findOne({
|
|
offset: Math.floor(Math.random() * (await Products.count())),
|
|
});
|
|
const Favorite2 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Favorite2?.setProduct)
|
|
{
|
|
await
|
|
Favorite2.
|
|
setProduct(relatedProduct2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateFavoriteWithLook() {
|
|
|
|
const relatedLook0 = await Looks.findOne({
|
|
offset: Math.floor(Math.random() * (await Looks.count())),
|
|
});
|
|
const Favorite0 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Favorite0?.setLook)
|
|
{
|
|
await
|
|
Favorite0.
|
|
setLook(relatedLook0);
|
|
}
|
|
|
|
const relatedLook1 = await Looks.findOne({
|
|
offset: Math.floor(Math.random() * (await Looks.count())),
|
|
});
|
|
const Favorite1 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Favorite1?.setLook)
|
|
{
|
|
await
|
|
Favorite1.
|
|
setLook(relatedLook1);
|
|
}
|
|
|
|
const relatedLook2 = await Looks.findOne({
|
|
offset: Math.floor(Math.random() * (await Looks.count())),
|
|
});
|
|
const Favorite2 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Favorite2?.setLook)
|
|
{
|
|
await
|
|
Favorite2.
|
|
setLook(relatedLook2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateFavoriteWithStore() {
|
|
|
|
const relatedStore0 = await Stores.findOne({
|
|
offset: Math.floor(Math.random() * (await Stores.count())),
|
|
});
|
|
const Favorite0 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Favorite0?.setStore)
|
|
{
|
|
await
|
|
Favorite0.
|
|
setStore(relatedStore0);
|
|
}
|
|
|
|
const relatedStore1 = await Stores.findOne({
|
|
offset: Math.floor(Math.random() * (await Stores.count())),
|
|
});
|
|
const Favorite1 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Favorite1?.setStore)
|
|
{
|
|
await
|
|
Favorite1.
|
|
setStore(relatedStore1);
|
|
}
|
|
|
|
const relatedStore2 = await Stores.findOne({
|
|
offset: Math.floor(Math.random() * (await Stores.count())),
|
|
});
|
|
const Favorite2 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Favorite2?.setStore)
|
|
{
|
|
await
|
|
Favorite2.
|
|
setStore(relatedStore2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateFavoriteWithBrand() {
|
|
|
|
const relatedBrand0 = await Brands.findOne({
|
|
offset: Math.floor(Math.random() * (await Brands.count())),
|
|
});
|
|
const Favorite0 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Favorite0?.setBrand)
|
|
{
|
|
await
|
|
Favorite0.
|
|
setBrand(relatedBrand0);
|
|
}
|
|
|
|
const relatedBrand1 = await Brands.findOne({
|
|
offset: Math.floor(Math.random() * (await Brands.count())),
|
|
});
|
|
const Favorite1 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Favorite1?.setBrand)
|
|
{
|
|
await
|
|
Favorite1.
|
|
setBrand(relatedBrand1);
|
|
}
|
|
|
|
const relatedBrand2 = await Brands.findOne({
|
|
offset: Math.floor(Math.random() * (await Brands.count())),
|
|
});
|
|
const Favorite2 = await Favorites.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Favorite2?.setBrand)
|
|
{
|
|
await
|
|
Favorite2.
|
|
setBrand(relatedBrand2);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await SizeProfiles.bulkCreate(SizeProfilesData);
|
|
|
|
|
|
|
|
|
|
await UserPhotos.bulkCreate(UserPhotosData);
|
|
|
|
|
|
|
|
|
|
await Stores.bulkCreate(StoresData);
|
|
|
|
|
|
|
|
|
|
await Brands.bulkCreate(BrandsData);
|
|
|
|
|
|
|
|
|
|
await Products.bulkCreate(ProductsData);
|
|
|
|
|
|
|
|
|
|
await Colors.bulkCreate(ColorsData);
|
|
|
|
|
|
|
|
|
|
await ProductSizes.bulkCreate(ProductSizesData);
|
|
|
|
|
|
|
|
|
|
await TryOnSessions.bulkCreate(TryOnSessionsData);
|
|
|
|
|
|
|
|
|
|
await TryOnRenders.bulkCreate(TryOnRendersData);
|
|
|
|
|
|
|
|
|
|
await StyleRequests.bulkCreate(StyleRequestsData);
|
|
|
|
|
|
|
|
|
|
await Recommendations.bulkCreate(RecommendationsData);
|
|
|
|
|
|
|
|
|
|
await RecommendationItems.bulkCreate(RecommendationItemsData);
|
|
|
|
|
|
|
|
|
|
await Looks.bulkCreate(LooksData);
|
|
|
|
|
|
|
|
|
|
await SharedLinks.bulkCreate(SharedLinksData);
|
|
|
|
|
|
|
|
|
|
await Favorites.bulkCreate(FavoritesData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateSizeProfileWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateUserPhotoWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductWithBrand(),
|
|
|
|
|
|
|
|
|
|
await associateProductWithStore(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProductSizeWithProduct(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTryOnSessionWithUser(),
|
|
|
|
|
|
|
|
|
|
await associateTryOnSessionWithUser_photo(),
|
|
|
|
|
|
|
|
|
|
await associateTryOnSessionWithSize_profile(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTryOnSessionWithProduct(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTryOnRenderWithSession(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateStyleRequestWithUser(),
|
|
|
|
|
|
|
|
|
|
await associateStyleRequestWithSize_profile(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateRecommendationWithStyle_request(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateRecommendationItemWithRecommendation(),
|
|
|
|
|
|
|
|
|
|
await associateRecommendationItemWithProduct(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateLookWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
await associateLookWithTry_on_session(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateSharedLinkWithLook(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateFavoriteWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateFavoriteWithProduct(),
|
|
|
|
|
|
|
|
|
|
await associateFavoriteWithLook(),
|
|
|
|
|
|
|
|
|
|
await associateFavoriteWithStore(),
|
|
|
|
|
|
|
|
|
|
await associateFavoriteWithBrand(),
|
|
|
|
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('size_profiles', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('user_photos', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('stores', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('brands', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('products', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('colors', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('product_sizes', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('try_on_sessions', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('try_on_renders', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('style_requests', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('recommendations', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('recommendation_items', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('looks', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('shared_links', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('favorites', null, {});
|
|
|
|
|
|
},
|
|
}; |