4870 lines
90 KiB
JavaScript
4870 lines
90 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const AdvertiserOrganizations = db.advertiser_organizations;
|
|
|
|
const AdNetworks = db.ad_networks;
|
|
|
|
const Campaigns = db.campaigns;
|
|
|
|
const Ads = db.ads;
|
|
|
|
const AdEligibilityRules = db.ad_eligibility_rules;
|
|
|
|
const AdImpressions = db.ad_impressions;
|
|
|
|
const WalletAccounts = db.wallet_accounts;
|
|
|
|
const WalletTransactions = db.wallet_transactions;
|
|
|
|
const Payments = db.payments;
|
|
|
|
const WithdrawalRequests = db.withdrawal_requests;
|
|
|
|
const PayoutBatches = db.payout_batches;
|
|
|
|
const SupportTickets = db.support_tickets;
|
|
|
|
const AuditEvents = db.audit_events;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const AdvertiserOrganizationsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"organization_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website_url": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_email": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_country": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"verification_status": "pending",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"verified_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"organization_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website_url": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_email": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_country": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"verification_status": "unverified",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"verified_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"organization_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website_url": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_email": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_country": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"verification_status": "pending",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"verified_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"organization_name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"website_url": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_email": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"billing_country": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"verification_status": "rejected",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"verified_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const AdNetworksData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"network_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"network_type": "programmatic",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"api_base_url": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publisher_key_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"network_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"network_type": "affiliate",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"api_base_url": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publisher_key_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"network_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"network_type": "affiliate",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"api_base_url": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publisher_key_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"network_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"network_type": "affiliate",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"api_base_url": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"publisher_key_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "inactive",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const CampaignsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"campaign_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approval_status": "ended",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_budget": 7.44,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"daily_budget": 9.25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_countries": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"frequency_cap_per_user_per_day": 8,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tracking_template": "Alan Turing",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"campaign_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approval_status": "draft",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_budget": 3.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"daily_budget": 0.67,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_countries": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"frequency_cap_per_user_per_day": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tracking_template": "Grace Hopper",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"campaign_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approval_status": "submitted",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_budget": 1.88,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"daily_budget": 1.03,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_countries": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"frequency_cap_per_user_per_day": 7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tracking_template": "Marie Curie",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"campaign_name": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"approval_status": "ended",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"starts_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ends_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"total_budget": 2.97,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"daily_budget": 1.28,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"target_countries": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"frequency_cap_per_user_per_day": 6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"tracking_template": "Marie Curie",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const AdsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ad_title": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ad_format": "offerwall",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ad_status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"destination_url": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"required_watch_seconds": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cpm_cost": 0.11,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reward_per_view": 1.49,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ad_title": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ad_format": "video",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ad_status": "rejected",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"destination_url": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"required_watch_seconds": 6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cpm_cost": 9.18,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reward_per_view": 0.3,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ad_title": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ad_format": "video",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ad_status": "pending_review",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"destination_url": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"required_watch_seconds": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cpm_cost": 0.25,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reward_per_view": 3.8,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ad_title": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ad_format": "offerwall",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ad_status": "rejected",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"destination_url": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"required_watch_seconds": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"cpm_cost": 0.37,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reward_per_view": 5.83,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const AdEligibilityRulesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"allowed_countries": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"blocked_countries": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"min_age": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_age": 4,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"require_kyc": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"require_email_verified": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"require_phone_verified": true,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"allowed_countries": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"blocked_countries": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"min_age": 6,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_age": 9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"require_kyc": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"require_email_verified": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"require_phone_verified": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"allowed_countries": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"blocked_countries": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"min_age": 7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_age": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"require_kyc": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"require_email_verified": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"require_phone_verified": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"allowed_countries": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"blocked_countries": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"min_age": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"max_age": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"require_kyc": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"require_email_verified": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"require_phone_verified": false,
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const AdImpressionsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"impression_status": "invalid",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"watched_seconds": 3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ip_address": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"user_agent": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"device_fingerprint": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reward_amount": 4.93,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"fraud_flags": "Grace Hopper",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"impression_status": "invalid",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"watched_seconds": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ip_address": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"user_agent": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"device_fingerprint": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reward_amount": 0.56,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"fraud_flags": "Alan Turing",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"impression_status": "started",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"watched_seconds": 7,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ip_address": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"user_agent": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"device_fingerprint": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reward_amount": 5.37,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"fraud_flags": "Grace Hopper",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"impression_status": "reversed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"started_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"watched_seconds": 8,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ip_address": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"user_agent": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"device_fingerprint": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reward_amount": 8.55,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"fraud_flags": "Alan Turing",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const WalletAccountsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"wallet_type": "viewer_earnings",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"currency": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"available_balance": 8.99,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"on_hold_balance": 9.9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "locked",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"wallet_type": "advertiser_prepaid",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"currency": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"available_balance": 2.93,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"on_hold_balance": 0.27,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "locked",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"wallet_type": "advertiser_prepaid",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"currency": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"available_balance": 1.8,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"on_hold_balance": 9.3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "locked",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"wallet_type": "viewer_earnings",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"currency": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"available_balance": 0.92,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"on_hold_balance": 4.57,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "locked",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const WalletTransactionsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_type": "topup",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"direction": "credit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 8.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reference_code": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"posted_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_type": "adjustment",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"direction": "credit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 4.27,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reference_code": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"posted_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_type": "reward_credit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"direction": "debit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 7.3,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reference_code": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"posted_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"transaction_type": "ad_spend",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"direction": "debit",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 2.05,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"reference_code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"posted_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const PaymentsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider": "stripe",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 4.55,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"currency": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_status": "pending",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider_payment_ref": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider": "bank_transfer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 9.9,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"currency": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_status": "initiated",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider_payment_ref": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider": "paypal",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 3.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"currency": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_status": "initiated",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider_payment_ref": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider": "bank_transfer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 8.94,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"currency": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payment_status": "pending",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"provider_payment_ref": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"paid_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const WithdrawalRequestsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 8.89,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"currency": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payout_method": "paypal",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payout_destination": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"request_status": "rejected",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"fee_amount": 6.2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"processed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"admin_note": "Marie Curie",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 5.07,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"currency": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payout_method": "manual",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payout_destination": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"request_status": "canceled",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"fee_amount": 9.04,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"processed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"admin_note": "Grace Hopper",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 3.06,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"currency": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payout_method": "gift_card",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payout_destination": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"request_status": "rejected",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"fee_amount": 8.98,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"processed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"admin_note": "Ada Lovelace",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"amount": 3.68,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"currency": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payout_method": "paypal",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"payout_destination": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"request_status": "paid",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"fee_amount": 4.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"requested_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"processed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"admin_note": "Marie Curie",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const PayoutBatchesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"batch_code": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"batch_status": "failed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"executed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"batch_code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"batch_status": "created",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"executed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"batch_code": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"batch_status": "failed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"executed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"batch_code": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"batch_status": "created",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"scheduled_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"executed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const SupportTicketsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subject": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "normal",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ticket_status": "closed",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subject": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ticket_status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subject": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "high",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ticket_status": "resolved",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"subject": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"message": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "high",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"ticket_status": "resolved",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"opened_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"closed_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const AuditEventsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_name": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_key": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action": "approve",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"occurred_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_key": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action": "approve",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Ada Lovelace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"occurred_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_name": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_key": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action": "logout",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"occurred_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_name": "Marie Curie",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"entity_key": "Grace Hopper",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action": "update",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Alan Turing",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"occurred_at": new Date(Date.now()),
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAdvertiserOrganizationWithOwner() {
|
|
|
|
const relatedOwner0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AdvertiserOrganization0 = await AdvertiserOrganizations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (AdvertiserOrganization0?.setOwner)
|
|
{
|
|
await
|
|
AdvertiserOrganization0.
|
|
setOwner(relatedOwner0);
|
|
}
|
|
|
|
const relatedOwner1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AdvertiserOrganization1 = await AdvertiserOrganizations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (AdvertiserOrganization1?.setOwner)
|
|
{
|
|
await
|
|
AdvertiserOrganization1.
|
|
setOwner(relatedOwner1);
|
|
}
|
|
|
|
const relatedOwner2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AdvertiserOrganization2 = await AdvertiserOrganizations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (AdvertiserOrganization2?.setOwner)
|
|
{
|
|
await
|
|
AdvertiserOrganization2.
|
|
setOwner(relatedOwner2);
|
|
}
|
|
|
|
const relatedOwner3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AdvertiserOrganization3 = await AdvertiserOrganizations.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (AdvertiserOrganization3?.setOwner)
|
|
{
|
|
await
|
|
AdvertiserOrganization3.
|
|
setOwner(relatedOwner3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateCampaignWithAdvertiser_organization() {
|
|
|
|
const relatedAdvertiser_organization0 = await AdvertiserOrganizations.findOne({
|
|
offset: Math.floor(Math.random() * (await AdvertiserOrganizations.count())),
|
|
});
|
|
const Campaign0 = await Campaigns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Campaign0?.setAdvertiser_organization)
|
|
{
|
|
await
|
|
Campaign0.
|
|
setAdvertiser_organization(relatedAdvertiser_organization0);
|
|
}
|
|
|
|
const relatedAdvertiser_organization1 = await AdvertiserOrganizations.findOne({
|
|
offset: Math.floor(Math.random() * (await AdvertiserOrganizations.count())),
|
|
});
|
|
const Campaign1 = await Campaigns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Campaign1?.setAdvertiser_organization)
|
|
{
|
|
await
|
|
Campaign1.
|
|
setAdvertiser_organization(relatedAdvertiser_organization1);
|
|
}
|
|
|
|
const relatedAdvertiser_organization2 = await AdvertiserOrganizations.findOne({
|
|
offset: Math.floor(Math.random() * (await AdvertiserOrganizations.count())),
|
|
});
|
|
const Campaign2 = await Campaigns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Campaign2?.setAdvertiser_organization)
|
|
{
|
|
await
|
|
Campaign2.
|
|
setAdvertiser_organization(relatedAdvertiser_organization2);
|
|
}
|
|
|
|
const relatedAdvertiser_organization3 = await AdvertiserOrganizations.findOne({
|
|
offset: Math.floor(Math.random() * (await AdvertiserOrganizations.count())),
|
|
});
|
|
const Campaign3 = await Campaigns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Campaign3?.setAdvertiser_organization)
|
|
{
|
|
await
|
|
Campaign3.
|
|
setAdvertiser_organization(relatedAdvertiser_organization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateCampaignWithAd_network() {
|
|
|
|
const relatedAd_network0 = await AdNetworks.findOne({
|
|
offset: Math.floor(Math.random() * (await AdNetworks.count())),
|
|
});
|
|
const Campaign0 = await Campaigns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Campaign0?.setAd_network)
|
|
{
|
|
await
|
|
Campaign0.
|
|
setAd_network(relatedAd_network0);
|
|
}
|
|
|
|
const relatedAd_network1 = await AdNetworks.findOne({
|
|
offset: Math.floor(Math.random() * (await AdNetworks.count())),
|
|
});
|
|
const Campaign1 = await Campaigns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Campaign1?.setAd_network)
|
|
{
|
|
await
|
|
Campaign1.
|
|
setAd_network(relatedAd_network1);
|
|
}
|
|
|
|
const relatedAd_network2 = await AdNetworks.findOne({
|
|
offset: Math.floor(Math.random() * (await AdNetworks.count())),
|
|
});
|
|
const Campaign2 = await Campaigns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Campaign2?.setAd_network)
|
|
{
|
|
await
|
|
Campaign2.
|
|
setAd_network(relatedAd_network2);
|
|
}
|
|
|
|
const relatedAd_network3 = await AdNetworks.findOne({
|
|
offset: Math.floor(Math.random() * (await AdNetworks.count())),
|
|
});
|
|
const Campaign3 = await Campaigns.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Campaign3?.setAd_network)
|
|
{
|
|
await
|
|
Campaign3.
|
|
setAd_network(relatedAd_network3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAdWithCampaign() {
|
|
|
|
const relatedCampaign0 = await Campaigns.findOne({
|
|
offset: Math.floor(Math.random() * (await Campaigns.count())),
|
|
});
|
|
const Ad0 = await Ads.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Ad0?.setCampaign)
|
|
{
|
|
await
|
|
Ad0.
|
|
setCampaign(relatedCampaign0);
|
|
}
|
|
|
|
const relatedCampaign1 = await Campaigns.findOne({
|
|
offset: Math.floor(Math.random() * (await Campaigns.count())),
|
|
});
|
|
const Ad1 = await Ads.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Ad1?.setCampaign)
|
|
{
|
|
await
|
|
Ad1.
|
|
setCampaign(relatedCampaign1);
|
|
}
|
|
|
|
const relatedCampaign2 = await Campaigns.findOne({
|
|
offset: Math.floor(Math.random() * (await Campaigns.count())),
|
|
});
|
|
const Ad2 = await Ads.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Ad2?.setCampaign)
|
|
{
|
|
await
|
|
Ad2.
|
|
setCampaign(relatedCampaign2);
|
|
}
|
|
|
|
const relatedCampaign3 = await Campaigns.findOne({
|
|
offset: Math.floor(Math.random() * (await Campaigns.count())),
|
|
});
|
|
const Ad3 = await Ads.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Ad3?.setCampaign)
|
|
{
|
|
await
|
|
Ad3.
|
|
setCampaign(relatedCampaign3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAdEligibilityRuleWithAd() {
|
|
|
|
const relatedAd0 = await Ads.findOne({
|
|
offset: Math.floor(Math.random() * (await Ads.count())),
|
|
});
|
|
const AdEligibilityRule0 = await AdEligibilityRules.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (AdEligibilityRule0?.setAd)
|
|
{
|
|
await
|
|
AdEligibilityRule0.
|
|
setAd(relatedAd0);
|
|
}
|
|
|
|
const relatedAd1 = await Ads.findOne({
|
|
offset: Math.floor(Math.random() * (await Ads.count())),
|
|
});
|
|
const AdEligibilityRule1 = await AdEligibilityRules.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (AdEligibilityRule1?.setAd)
|
|
{
|
|
await
|
|
AdEligibilityRule1.
|
|
setAd(relatedAd1);
|
|
}
|
|
|
|
const relatedAd2 = await Ads.findOne({
|
|
offset: Math.floor(Math.random() * (await Ads.count())),
|
|
});
|
|
const AdEligibilityRule2 = await AdEligibilityRules.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (AdEligibilityRule2?.setAd)
|
|
{
|
|
await
|
|
AdEligibilityRule2.
|
|
setAd(relatedAd2);
|
|
}
|
|
|
|
const relatedAd3 = await Ads.findOne({
|
|
offset: Math.floor(Math.random() * (await Ads.count())),
|
|
});
|
|
const AdEligibilityRule3 = await AdEligibilityRules.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (AdEligibilityRule3?.setAd)
|
|
{
|
|
await
|
|
AdEligibilityRule3.
|
|
setAd(relatedAd3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAdImpressionWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AdImpression0 = await AdImpressions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (AdImpression0?.setUser)
|
|
{
|
|
await
|
|
AdImpression0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AdImpression1 = await AdImpressions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (AdImpression1?.setUser)
|
|
{
|
|
await
|
|
AdImpression1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AdImpression2 = await AdImpressions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (AdImpression2?.setUser)
|
|
{
|
|
await
|
|
AdImpression2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AdImpression3 = await AdImpressions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (AdImpression3?.setUser)
|
|
{
|
|
await
|
|
AdImpression3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateAdImpressionWithAd() {
|
|
|
|
const relatedAd0 = await Ads.findOne({
|
|
offset: Math.floor(Math.random() * (await Ads.count())),
|
|
});
|
|
const AdImpression0 = await AdImpressions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (AdImpression0?.setAd)
|
|
{
|
|
await
|
|
AdImpression0.
|
|
setAd(relatedAd0);
|
|
}
|
|
|
|
const relatedAd1 = await Ads.findOne({
|
|
offset: Math.floor(Math.random() * (await Ads.count())),
|
|
});
|
|
const AdImpression1 = await AdImpressions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (AdImpression1?.setAd)
|
|
{
|
|
await
|
|
AdImpression1.
|
|
setAd(relatedAd1);
|
|
}
|
|
|
|
const relatedAd2 = await Ads.findOne({
|
|
offset: Math.floor(Math.random() * (await Ads.count())),
|
|
});
|
|
const AdImpression2 = await AdImpressions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (AdImpression2?.setAd)
|
|
{
|
|
await
|
|
AdImpression2.
|
|
setAd(relatedAd2);
|
|
}
|
|
|
|
const relatedAd3 = await Ads.findOne({
|
|
offset: Math.floor(Math.random() * (await Ads.count())),
|
|
});
|
|
const AdImpression3 = await AdImpressions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (AdImpression3?.setAd)
|
|
{
|
|
await
|
|
AdImpression3.
|
|
setAd(relatedAd3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWalletAccountWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WalletAccount0 = await WalletAccounts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WalletAccount0?.setUser)
|
|
{
|
|
await
|
|
WalletAccount0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WalletAccount1 = await WalletAccounts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WalletAccount1?.setUser)
|
|
{
|
|
await
|
|
WalletAccount1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WalletAccount2 = await WalletAccounts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WalletAccount2?.setUser)
|
|
{
|
|
await
|
|
WalletAccount2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WalletAccount3 = await WalletAccounts.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WalletAccount3?.setUser)
|
|
{
|
|
await
|
|
WalletAccount3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWalletTransactionWithWallet_account() {
|
|
|
|
const relatedWallet_account0 = await WalletAccounts.findOne({
|
|
offset: Math.floor(Math.random() * (await WalletAccounts.count())),
|
|
});
|
|
const WalletTransaction0 = await WalletTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WalletTransaction0?.setWallet_account)
|
|
{
|
|
await
|
|
WalletTransaction0.
|
|
setWallet_account(relatedWallet_account0);
|
|
}
|
|
|
|
const relatedWallet_account1 = await WalletAccounts.findOne({
|
|
offset: Math.floor(Math.random() * (await WalletAccounts.count())),
|
|
});
|
|
const WalletTransaction1 = await WalletTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WalletTransaction1?.setWallet_account)
|
|
{
|
|
await
|
|
WalletTransaction1.
|
|
setWallet_account(relatedWallet_account1);
|
|
}
|
|
|
|
const relatedWallet_account2 = await WalletAccounts.findOne({
|
|
offset: Math.floor(Math.random() * (await WalletAccounts.count())),
|
|
});
|
|
const WalletTransaction2 = await WalletTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WalletTransaction2?.setWallet_account)
|
|
{
|
|
await
|
|
WalletTransaction2.
|
|
setWallet_account(relatedWallet_account2);
|
|
}
|
|
|
|
const relatedWallet_account3 = await WalletAccounts.findOne({
|
|
offset: Math.floor(Math.random() * (await WalletAccounts.count())),
|
|
});
|
|
const WalletTransaction3 = await WalletTransactions.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WalletTransaction3?.setWallet_account)
|
|
{
|
|
await
|
|
WalletTransaction3.
|
|
setWallet_account(relatedWallet_account3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associatePaymentWithAdvertiser_organization() {
|
|
|
|
const relatedAdvertiser_organization0 = await AdvertiserOrganizations.findOne({
|
|
offset: Math.floor(Math.random() * (await AdvertiserOrganizations.count())),
|
|
});
|
|
const Payment0 = await Payments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Payment0?.setAdvertiser_organization)
|
|
{
|
|
await
|
|
Payment0.
|
|
setAdvertiser_organization(relatedAdvertiser_organization0);
|
|
}
|
|
|
|
const relatedAdvertiser_organization1 = await AdvertiserOrganizations.findOne({
|
|
offset: Math.floor(Math.random() * (await AdvertiserOrganizations.count())),
|
|
});
|
|
const Payment1 = await Payments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Payment1?.setAdvertiser_organization)
|
|
{
|
|
await
|
|
Payment1.
|
|
setAdvertiser_organization(relatedAdvertiser_organization1);
|
|
}
|
|
|
|
const relatedAdvertiser_organization2 = await AdvertiserOrganizations.findOne({
|
|
offset: Math.floor(Math.random() * (await AdvertiserOrganizations.count())),
|
|
});
|
|
const Payment2 = await Payments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Payment2?.setAdvertiser_organization)
|
|
{
|
|
await
|
|
Payment2.
|
|
setAdvertiser_organization(relatedAdvertiser_organization2);
|
|
}
|
|
|
|
const relatedAdvertiser_organization3 = await AdvertiserOrganizations.findOne({
|
|
offset: Math.floor(Math.random() * (await AdvertiserOrganizations.count())),
|
|
});
|
|
const Payment3 = await Payments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Payment3?.setAdvertiser_organization)
|
|
{
|
|
await
|
|
Payment3.
|
|
setAdvertiser_organization(relatedAdvertiser_organization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associatePaymentWithWallet_account() {
|
|
|
|
const relatedWallet_account0 = await WalletAccounts.findOne({
|
|
offset: Math.floor(Math.random() * (await WalletAccounts.count())),
|
|
});
|
|
const Payment0 = await Payments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Payment0?.setWallet_account)
|
|
{
|
|
await
|
|
Payment0.
|
|
setWallet_account(relatedWallet_account0);
|
|
}
|
|
|
|
const relatedWallet_account1 = await WalletAccounts.findOne({
|
|
offset: Math.floor(Math.random() * (await WalletAccounts.count())),
|
|
});
|
|
const Payment1 = await Payments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Payment1?.setWallet_account)
|
|
{
|
|
await
|
|
Payment1.
|
|
setWallet_account(relatedWallet_account1);
|
|
}
|
|
|
|
const relatedWallet_account2 = await WalletAccounts.findOne({
|
|
offset: Math.floor(Math.random() * (await WalletAccounts.count())),
|
|
});
|
|
const Payment2 = await Payments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Payment2?.setWallet_account)
|
|
{
|
|
await
|
|
Payment2.
|
|
setWallet_account(relatedWallet_account2);
|
|
}
|
|
|
|
const relatedWallet_account3 = await WalletAccounts.findOne({
|
|
offset: Math.floor(Math.random() * (await WalletAccounts.count())),
|
|
});
|
|
const Payment3 = await Payments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Payment3?.setWallet_account)
|
|
{
|
|
await
|
|
Payment3.
|
|
setWallet_account(relatedWallet_account3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWithdrawalRequestWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WithdrawalRequest0 = await WithdrawalRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WithdrawalRequest0?.setUser)
|
|
{
|
|
await
|
|
WithdrawalRequest0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WithdrawalRequest1 = await WithdrawalRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WithdrawalRequest1?.setUser)
|
|
{
|
|
await
|
|
WithdrawalRequest1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WithdrawalRequest2 = await WithdrawalRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WithdrawalRequest2?.setUser)
|
|
{
|
|
await
|
|
WithdrawalRequest2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WithdrawalRequest3 = await WithdrawalRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WithdrawalRequest3?.setUser)
|
|
{
|
|
await
|
|
WithdrawalRequest3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateWithdrawalRequestWithWallet_account() {
|
|
|
|
const relatedWallet_account0 = await WalletAccounts.findOne({
|
|
offset: Math.floor(Math.random() * (await WalletAccounts.count())),
|
|
});
|
|
const WithdrawalRequest0 = await WithdrawalRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WithdrawalRequest0?.setWallet_account)
|
|
{
|
|
await
|
|
WithdrawalRequest0.
|
|
setWallet_account(relatedWallet_account0);
|
|
}
|
|
|
|
const relatedWallet_account1 = await WalletAccounts.findOne({
|
|
offset: Math.floor(Math.random() * (await WalletAccounts.count())),
|
|
});
|
|
const WithdrawalRequest1 = await WithdrawalRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WithdrawalRequest1?.setWallet_account)
|
|
{
|
|
await
|
|
WithdrawalRequest1.
|
|
setWallet_account(relatedWallet_account1);
|
|
}
|
|
|
|
const relatedWallet_account2 = await WalletAccounts.findOne({
|
|
offset: Math.floor(Math.random() * (await WalletAccounts.count())),
|
|
});
|
|
const WithdrawalRequest2 = await WithdrawalRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WithdrawalRequest2?.setWallet_account)
|
|
{
|
|
await
|
|
WithdrawalRequest2.
|
|
setWallet_account(relatedWallet_account2);
|
|
}
|
|
|
|
const relatedWallet_account3 = await WalletAccounts.findOne({
|
|
offset: Math.floor(Math.random() * (await WalletAccounts.count())),
|
|
});
|
|
const WithdrawalRequest3 = await WithdrawalRequests.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WithdrawalRequest3?.setWallet_account)
|
|
{
|
|
await
|
|
WithdrawalRequest3.
|
|
setWallet_account(relatedWallet_account3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateSupportTicketWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SupportTicket0 = await SupportTickets.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (SupportTicket0?.setUser)
|
|
{
|
|
await
|
|
SupportTicket0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SupportTicket1 = await SupportTickets.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (SupportTicket1?.setUser)
|
|
{
|
|
await
|
|
SupportTicket1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SupportTicket2 = await SupportTickets.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (SupportTicket2?.setUser)
|
|
{
|
|
await
|
|
SupportTicket2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const SupportTicket3 = await SupportTickets.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (SupportTicket3?.setUser)
|
|
{
|
|
await
|
|
SupportTicket3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateAuditEventWithActor() {
|
|
|
|
const relatedActor0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AuditEvent0 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (AuditEvent0?.setActor)
|
|
{
|
|
await
|
|
AuditEvent0.
|
|
setActor(relatedActor0);
|
|
}
|
|
|
|
const relatedActor1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AuditEvent1 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (AuditEvent1?.setActor)
|
|
{
|
|
await
|
|
AuditEvent1.
|
|
setActor(relatedActor1);
|
|
}
|
|
|
|
const relatedActor2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AuditEvent2 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (AuditEvent2?.setActor)
|
|
{
|
|
await
|
|
AuditEvent2.
|
|
setActor(relatedActor2);
|
|
}
|
|
|
|
const relatedActor3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const AuditEvent3 = await AuditEvents.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (AuditEvent3?.setActor)
|
|
{
|
|
await
|
|
AuditEvent3.
|
|
setActor(relatedActor3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await AdvertiserOrganizations.bulkCreate(AdvertiserOrganizationsData);
|
|
|
|
|
|
|
|
|
|
await AdNetworks.bulkCreate(AdNetworksData);
|
|
|
|
|
|
|
|
|
|
await Campaigns.bulkCreate(CampaignsData);
|
|
|
|
|
|
|
|
|
|
await Ads.bulkCreate(AdsData);
|
|
|
|
|
|
|
|
|
|
await AdEligibilityRules.bulkCreate(AdEligibilityRulesData);
|
|
|
|
|
|
|
|
|
|
await AdImpressions.bulkCreate(AdImpressionsData);
|
|
|
|
|
|
|
|
|
|
await WalletAccounts.bulkCreate(WalletAccountsData);
|
|
|
|
|
|
|
|
|
|
await WalletTransactions.bulkCreate(WalletTransactionsData);
|
|
|
|
|
|
|
|
|
|
await Payments.bulkCreate(PaymentsData);
|
|
|
|
|
|
|
|
|
|
await WithdrawalRequests.bulkCreate(WithdrawalRequestsData);
|
|
|
|
|
|
|
|
|
|
await PayoutBatches.bulkCreate(PayoutBatchesData);
|
|
|
|
|
|
|
|
|
|
await SupportTickets.bulkCreate(SupportTicketsData);
|
|
|
|
|
|
|
|
|
|
await AuditEvents.bulkCreate(AuditEventsData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAdvertiserOrganizationWithOwner(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateCampaignWithAdvertiser_organization(),
|
|
|
|
|
|
|
|
|
|
await associateCampaignWithAd_network(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAdWithCampaign(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAdEligibilityRuleWithAd(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAdImpressionWithUser(),
|
|
|
|
|
|
|
|
|
|
await associateAdImpressionWithAd(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWalletAccountWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWalletTransactionWithWallet_account(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associatePaymentWithAdvertiser_organization(),
|
|
|
|
|
|
|
|
|
|
await associatePaymentWithWallet_account(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWithdrawalRequestWithUser(),
|
|
|
|
|
|
|
|
|
|
await associateWithdrawalRequestWithWallet_account(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateSupportTicketWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateAuditEventWithActor(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('advertiser_organizations', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('ad_networks', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('campaigns', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('ads', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('ad_eligibility_rules', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('ad_impressions', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('wallet_accounts', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('wallet_transactions', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('payments', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('withdrawal_requests', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('payout_batches', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('support_tickets', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('audit_events', null, {});
|
|
|
|
|
|
},
|
|
}; |