38905-vm/backend/src/db/seeders/20231127130745-sample-data.js
2026-03-01 10:15:50 +00:00

4820 lines
91 KiB
JavaScript

const db = require('../models');
const Users = db.users;
const AirdropCategories = db.airdrop_categories;
const Blockchains = db.blockchains;
const AirdropProjects = db.airdrop_projects;
const AirdropTasks = db.airdrop_tasks;
const TaskCompletions = db.task_completions;
const Wallets = db.wallets;
const ProjectWalletLinks = db.project_wallet_links;
const OnchainEvents = db.onchain_events;
const BlogPosts = db.blog_posts;
const CommunityLinks = db.community_links;
const Announcements = db.announcements;
const AirdropCategoriesData = [
{
"name": "DeFi",
"slug": "defi",
"description": "Decentralized finance protocols and apps.",
"sort_order": 10,
"is_active": true,
},
{
"name": "Gaming",
"slug": "gaming",
"description": "Blockchain games and gaming infrastructure.",
"sort_order": 20,
"is_active": true,
},
{
"name": "Social",
"slug": "social",
"description": "Social apps and community-first networks.",
"sort_order": 30,
"is_active": true,
},
{
"name": "Infrastructure",
"slug": "infrastructure",
"description": "Core networks, tooling, and developer platforms.",
"sort_order": 40,
"is_active": true,
},
];
const BlockchainsData = [
{
"name": "Ethereum",
"symbol": "ETH",
"chain_id": "1",
"rpc_url": "https://rpc.ankr.com/eth",
"explorer_url": "https://etherscan.io",
"is_active": true,
},
{
"name": "Arbitrum One",
"symbol": "ARB",
"chain_id": "42161",
"rpc_url": "https://rpc.ankr.com/arbitrum",
"explorer_url": "https://arbiscan.io",
"is_active": true,
},
{
"name": "Optimism",
"symbol": "OP",
"chain_id": "10",
"rpc_url": "https://rpc.ankr.com/optimism",
"explorer_url": "https://optimistic.etherscan.io",
"is_active": true,
},
{
"name": "Polygon",
"symbol": "POL",
"chain_id": "137",
"rpc_url": "https://rpc.ankr.com/polygon",
"explorer_url": "https://polygonscan.com",
"is_active": true,
},
];
const AirdropProjectsData = [
{
"name": "NimbusSwap",
"ticker": "NIMB",
"slug": "nimbusswap",
"summary": "A cross-chain swap and routing aggregator focused on low fees.",
// type code here for "images" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"status": "active",
"entry_date": new Date('2026-02-10T00:00:00Z'),
"tge_date": new Date('2026-04-15T00:00:00Z'),
"snapshot_date": new Date('2026-03-20T00:00:00Z'),
"claim_start_at": new Date('2026-04-16T00:00:00Z'),
"claim_end_at": new Date('2026-05-16T00:00:00Z'),
"join_url": "https://nimbusswap.example/join",
"website_url": "https://nimbusswap.example",
"twitter_url": "https://x.com/nimbusswap",
"discord_url": "https://discord.gg/nimbusswap",
"telegram_url": "https://t.me/nimbusswap",
"medium_url": "https://medium.com/@nimbusswap",
"github_url": "https://github.com/nimbusswap",
"funding_amount_usd": 12500000,
"funding_round": "Seed",
"investors": "NorthBridge Ventures, Atlas Labs",
"requires_wallet": true,
"is_featured": true,
"priority": 90,
// type code here for "relation_one" field
"is_active": true,
},
{
"name": "AuroraQuest",
"ticker": "AQUEST",
"slug": "auroraquest",
"summary": "Quest platform for gaming communities with on-chain achievements.",
// type code here for "images" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"status": "active",
"entry_date": new Date('2026-02-05T00:00:00Z'),
"tge_date": new Date('2026-06-01T00:00:00Z'),
"snapshot_date": new Date('2026-03-25T00:00:00Z'),
"claim_start_at": new Date('2026-06-02T00:00:00Z'),
"claim_end_at": new Date('2026-07-02T00:00:00Z'),
"join_url": "https://auroraquest.example/start",
"website_url": "https://auroraquest.example",
"twitter_url": "https://x.com/auroraquest",
"discord_url": "https://discord.gg/auroraquest",
"telegram_url": "https://t.me/auroraquest",
"medium_url": "https://medium.com/@auroraquest",
"github_url": "https://github.com/auroraquest",
"funding_amount_usd": 4200000,
"funding_round": "Pre-Seed",
"investors": "PlayFoundry, SeedSpring",
"requires_wallet": true,
"is_featured": true,
"priority": 70,
// type code here for "relation_one" field
"is_active": true,
},
{
"name": "PulseSocial",
"ticker": "PULSE",
"slug": "pulsesocial",
"summary": "A social protocol enabling portable profiles and creator rewards.",
// type code here for "images" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"status": "reward_claim",
"entry_date": new Date('2026-01-20T00:00:00Z'),
"tge_date": new Date('2026-05-10T00:00:00Z'),
"snapshot_date": new Date('2026-02-28T00:00:00Z'),
"claim_start_at": new Date('2026-05-11T00:00:00Z'),
"claim_end_at": new Date('2026-06-11T00:00:00Z'),
"join_url": "https://pulsesocial.example/join",
"website_url": "https://pulsesocial.example",
"twitter_url": "https://x.com/pulsesocial",
"discord_url": "https://discord.gg/pulsesocial",
"telegram_url": "https://t.me/pulsesocial",
"medium_url": "https://medium.com/@pulsesocial",
"github_url": "https://github.com/pulsesocial",
"funding_amount_usd": 9800000,
"funding_round": "Seed",
"investors": "SignalWorks, Horizon Capital",
"requires_wallet": true,
"is_featured": true,
"priority": 85,
// type code here for "relation_one" field
"is_active": true,
},
{
"name": "BeaconNode Tools",
"ticker": "BNT",
"slug": "beaconnodetools",
"summary": "Developer tooling for node monitoring and automated alerts.",
// type code here for "images" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"status": "active",
"entry_date": new Date('2026-01-05T00:00:00Z'),
"tge_date": new Date('2026-03-05T00:00:00Z'),
"snapshot_date": new Date('2026-02-01T00:00:00Z'),
"claim_start_at": new Date('2026-03-06T00:00:00Z'),
"claim_end_at": new Date('2026-04-06T00:00:00Z'),
"join_url": "https://beaconnodetools.example/access",
"website_url": "https://beaconnodetools.example",
"twitter_url": "https://x.com/beaconnodetools",
"discord_url": "https://discord.gg/beaconnodetools",
"telegram_url": "https://t.me/beaconnodetools",
"medium_url": "https://medium.com/@beaconnodetools",
"github_url": "https://github.com/beaconnodetools",
"funding_amount_usd": 2500000,
"funding_round": "Angel",
"investors": "Kernel Angels",
"requires_wallet": false,
"is_featured": true,
"priority": 60,
// type code here for "relation_one" field
"is_active": true,
},
];
const AirdropTasksData = [
{
// type code here for "relation_one" field
"title": "Daily swap simulation",
"description": "Perform a small swap or use test mode if available and record completion.",
"task_type": "on_chain",
"frequency": "weekly",
"available_from": new Date('2026-03-01T00:00:00Z'),
"available_until": new Date('2026-03-31T23:59:59Z'),
"is_mandatory": true,
"points": 10,
"action_url": "https://nimbusswap.example/app",
"join_instructions": "Connect wallet and execute a low-value swap.",
"requires_proof": true,
"is_active": true,
},
{
// type code here for "relation_one" field
"title": "Bridge and return once",
"description": "Bridge tokens to Arbitrum and back to qualify for routing activity.",
"task_type": "social",
"frequency": "daily",
"available_from": new Date('2026-03-01T00:00:00Z'),
"available_until": new Date('2026-03-20T23:59:59Z'),
"is_mandatory": false,
"points": 30,
"action_url": "https://nimbusswap.example/bridge",
"join_instructions": "Use official bridge partners only.",
"requires_proof": true,
"is_active": true,
},
{
// type code here for "relation_one" field
"title": "Complete 3 quests",
"description": "Finish any three quests and claim the badge.",
"task_type": "social",
"frequency": "once",
"available_from": new Date('2026-03-01T00:00:00Z'),
"available_until": new Date('2026-04-15T23:59:59Z'),
"is_mandatory": true,
"points": 15,
"action_url": "https://auroraquest.example/quests",
"join_instructions": "Login, pick quests, and submit proof where required.",
"requires_proof": true,
"is_active": true,
},
{
// type code here for "relation_one" field
"title": "Post once and engage",
"description": "Create a post and leave two meaningful comments.",
"task_type": "weekly",
"frequency": "ad_hoc",
"available_from": new Date('2026-02-20T00:00:00Z'),
"available_until": new Date('2026-03-10T23:59:59Z'),
"is_mandatory": true,
"points": 8,
"action_url": "https://pulsesocial.example",
"join_instructions": "Avoid spam and keep interactions organic.",
"requires_proof": true,
"is_active": true,
},
];
const TaskCompletionsData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"completed_at": new Date('2026-03-01T08:10:00Z'),
"status": "failed",
"proof_url": "https://proofs.example/nimb-elen-0301",
"notes": "Completed swap in app.",
"due_at": new Date('2026-03-01T23:59:59Z'),
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"completed_at": new Date('2026-03-01T10:25:00Z'),
"status": "pending",
"proof_url": "https://proofs.example/nimb-noah-0301",
"notes": "Swap executed successfully.",
"due_at": new Date('2026-03-01T23:59:59Z'),
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"completed_at": new Date('2026-03-01T09:05:00Z'),
"status": "pending",
"proof_url": "https://proofs.example/aq-elen-0301",
"notes": "Finished three quests and claimed badge.",
"due_at": new Date('2026-03-01T23:59:59Z'),
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"completed_at": new Date('2026-02-28T18:45:00Z'),
"status": "pending",
"proof_url": "https://proofs.example/ps-noah-0228",
"notes": "Posted and commented twice.",
"due_at": new Date('2026-02-28T23:59:59Z'),
},
];
const WalletsData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"address": "0xA12b34c56D78e90fA12b34c56D78e90fA12b34c5",
"wallet_type": "sui",
"label": "Main EVM",
"is_primary": true,
"last_synced_at": new Date('2026-02-28T20:00:00Z'),
"is_active": true,
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"address": "0xB98c76d54E32f10aB98c76d54E32f10aB98c76d5",
"wallet_type": "cosmos",
"label": "Arbitrum Wallet",
"is_primary": true,
"last_synced_at": new Date('2026-03-01T07:55:00Z'),
"is_active": true,
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"address": "7nYwYp2Q4Rk2v5vG6pL7cQ9mQ1s3bT5uV7wX9yZ1a2b3",
"wallet_type": "sui",
"label": "Solana Wallet",
"is_primary": false,
"last_synced_at": new Date('2026-02-27T11:10:00Z'),
"is_active": true,
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"address": "0xC11d22e33F44a55bC11d22e33F44a55bC11d22e3",
"wallet_type": "cosmos",
"label": "Editorial Wallet",
"is_primary": true,
"last_synced_at": new Date('2026-02-26T15:20:00Z'),
"is_active": true,
},
];
const ProjectWalletLinksData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"notes": "Used for NimbusSwap daily swaps.",
"linked_at": new Date('2026-02-15T10:00:00Z'),
"is_active": true,
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"notes": "Arbitrum activity wallet for routing.",
"linked_at": new Date('2026-02-18T10:00:00Z'),
"is_active": true,
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"notes": "Primary wallet for PulseSocial interactions.",
"linked_at": new Date('2026-02-05T10:00:00Z'),
"is_active": true,
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
"notes": "Solana wallet used during MintGarden snapshot period.",
"linked_at": new Date('2026-01-08T10:00:00Z'),
"is_active": true,
},
];
const OnchainEventsData = [
{
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"tx_hash": "0x9f1a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8",
"event_type": "swap",
"contract_address": "0x1111111111111111111111111111111111111111",
"amount": 12.5,
"token_symbol": "USDC",
"event_at": new Date('2026-03-01T08:08:30Z'),
"raw_payload": "{action:swap,pair:USDC/ETH,status:success}",
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"tx_hash": "0x8e7d6c5b4a392817161514131211100f0e0d0c0b0a09080706050403020100ff",
"event_type": "bridge",
"contract_address": "0x2222222222222222222222222222222222222222",
"amount": 0.15,
"token_symbol": "ETH",
"event_at": new Date('2026-03-01T10:12:00Z'),
"raw_payload": "{action:bridge,direction:to_arbitrum,status:success}",
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"tx_hash": "0x7a6b5c4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a8b7c6d5e4f3a2b1c0d9e8f7a6b",
"event_type": "profile_mint",
"contract_address": "0x3333333333333333333333333333333333333333",
"amount": 1,
"token_symbol": "PULSE",
"event_at": new Date('2026-02-27T16:30:00Z'),
"raw_payload": "{action:mint,asset:profile,status:success}",
},
{
// type code here for "relation_one" field
// type code here for "relation_one" field
// type code here for "relation_one" field
"tx_hash": "5QpAq6m2b9Kc7dE1fG3hJ4kL8mN0pQr2sTuVwXyZ9aBcDeFgHiJkLmNoPqRsTuVwX",
"event_type": "claim_check",
"contract_address": "So11111111111111111111111111111111111111112",
"amount": 0,
"token_symbol": "MINTG",
"event_at": new Date('2026-02-25T12:28:00Z'),
"raw_payload": "{action:eligibility_check,status:eligible}",
},
];
const BlogPostsData = [
{
"title": "How to Stay Consistent With Daily Airdrop Tasks",
"slug": "stay-consistent-daily-airdrop-tasks",
"excerpt": "A simple routine for tracking daily tasks without burning out.",
"content": "Build a short checklist, schedule a consistent time, and focus on high-quality interactions over volume.",
// type code here for "images" field
"status": "draft",
"published_at": new Date('2026-02-20T10:00:00Z'),
// type code here for "relation_one" field
"view_count": 1240,
"is_featured": true,
},
{
"title": "Understanding Snapshots and Eligibility",
"slug": "understanding-snapshots-and-eligibility",
"excerpt": "What snapshots are and how they affect airdrop qualification.",
"content": "A snapshot records wallet state at a specific block or time. Always confirm the criteria and keep transaction history clean.",
// type code here for "images" field
"status": "draft",
"published_at": new Date('2026-02-22T09:30:00Z'),
// type code here for "relation_one" field
"view_count": 980,
"is_featured": true,
},
{
"title": "On-chain vs Social Tasks: What Matters Most",
"slug": "onchain-vs-social-tasks",
"excerpt": "A practical breakdown of task types and effort vs impact.",
"content": "On-chain actions are measurable, while social tasks can be subjective. Prioritize tasks aligned with the project goals.",
// type code here for "images" field
"status": "draft",
"published_at": new Date('2026-02-25T11:15:00Z'),
// type code here for "relation_one" field
"view_count": 760,
"is_featured": false,
},
{
"title": "Wallet Hygiene for Airdrop Hunters",
"slug": "wallet-hygiene-airdrop-hunters",
"excerpt": "Tips to reduce risk and keep your tracking organized.",
"content": "Use labeled wallets, avoid risky approvals, and keep a clean record of actions and claims.",
// type code here for "images" field
"status": "archived",
"published_at": new Date('2026-03-05T08:00:00Z'),
// type code here for "relation_one" field
"view_count": 0,
"is_featured": true,
},
];
const CommunityLinksData = [
{
"name": "Official Discord",
"link_type": "github",
"url": "https://discord.gg/airdropdaily",
"description": "Join the community for alerts and discussions.",
// type code here for "images" field
"is_active": true,
"sort_order": 10,
},
{
"name": "Telegram Updates",
"link_type": "github",
"url": "https://t.me/airdropdailyupdates",
"description": "Daily updates and task reminders.",
// type code here for "images" field
"is_active": true,
"sort_order": 20,
},
{
"name": "Project Alerts on X",
"link_type": "discord",
"url": "https://x.com/airdropdaily",
"description": "Announcements, snapshots, and claim reminders.",
// type code here for "images" field
"is_active": true,
"sort_order": 30,
},
{
"name": "Knowledge Base",
"link_type": "youtube",
"url": "https://airdropdaily.example/help",
"description": "Guides on tasks, wallets, and safety.",
// type code here for "images" field
"is_active": true,
"sort_order": 40,
},
];
const AnnouncementsData = [
{
"title": "Maintenance Window",
"message": "Scheduled maintenance on March 3. Some sync features may be temporarily unavailable.",
"severity": "success",
"starts_at": new Date('2026-03-03T01:00:00Z'),
"ends_at": new Date('2026-03-03T03:00:00Z'),
"is_active": true,
},
{
"title": "New Project Added: NimbusSwap",
"message": "NimbusSwap has been added with daily and on-chain tasks. Start tracking today.",
"severity": "warning",
"starts_at": new Date('2026-03-01T00:00:00Z'),
"ends_at": new Date('2026-03-08T00:00:00Z'),
"is_active": true,
},
{
"title": "Snapshot Reminder: PulseSocial",
"message": "PulseSocial snapshot is set. Review eligibility and ensure required actions are completed.",
"severity": "warning",
"starts_at": new Date('2026-02-27T00:00:00Z'),
"ends_at": new Date('2026-03-01T00:00:00Z'),
"is_active": true,
},
{
"title": "Claim Window Open: MintGarden",
"message": "MintGarden claim window is open. Verify eligibility and claim before the deadline.",
"severity": "warning",
"starts_at": new Date('2026-02-21T00:00:00Z'),
"ends_at": new Date('2026-03-21T23:59:59Z'),
"is_active": true,
},
];
// Similar logic for "relation_many"
async function associateAirdropProjectWithCategory() {
const relatedCategory0 = await AirdropCategories.findOne({
offset: Math.floor(Math.random() * (await AirdropCategories.count())),
});
const AirdropProject0 = await AirdropProjects.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AirdropProject0?.setCategory)
{
await
AirdropProject0.
setCategory(relatedCategory0);
}
const relatedCategory1 = await AirdropCategories.findOne({
offset: Math.floor(Math.random() * (await AirdropCategories.count())),
});
const AirdropProject1 = await AirdropProjects.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AirdropProject1?.setCategory)
{
await
AirdropProject1.
setCategory(relatedCategory1);
}
const relatedCategory2 = await AirdropCategories.findOne({
offset: Math.floor(Math.random() * (await AirdropCategories.count())),
});
const AirdropProject2 = await AirdropProjects.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AirdropProject2?.setCategory)
{
await
AirdropProject2.
setCategory(relatedCategory2);
}
const relatedCategory3 = await AirdropCategories.findOne({
offset: Math.floor(Math.random() * (await AirdropCategories.count())),
});
const AirdropProject3 = await AirdropProjects.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AirdropProject3?.setCategory)
{
await
AirdropProject3.
setCategory(relatedCategory3);
}
}
async function associateAirdropProjectWithBlockchain() {
const relatedBlockchain0 = await Blockchains.findOne({
offset: Math.floor(Math.random() * (await Blockchains.count())),
});
const AirdropProject0 = await AirdropProjects.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AirdropProject0?.setBlockchain)
{
await
AirdropProject0.
setBlockchain(relatedBlockchain0);
}
const relatedBlockchain1 = await Blockchains.findOne({
offset: Math.floor(Math.random() * (await Blockchains.count())),
});
const AirdropProject1 = await AirdropProjects.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AirdropProject1?.setBlockchain)
{
await
AirdropProject1.
setBlockchain(relatedBlockchain1);
}
const relatedBlockchain2 = await Blockchains.findOne({
offset: Math.floor(Math.random() * (await Blockchains.count())),
});
const AirdropProject2 = await AirdropProjects.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AirdropProject2?.setBlockchain)
{
await
AirdropProject2.
setBlockchain(relatedBlockchain2);
}
const relatedBlockchain3 = await Blockchains.findOne({
offset: Math.floor(Math.random() * (await Blockchains.count())),
});
const AirdropProject3 = await AirdropProjects.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AirdropProject3?.setBlockchain)
{
await
AirdropProject3.
setBlockchain(relatedBlockchain3);
}
}
async function associateAirdropProjectWithCreated_by_user() {
const relatedCreated_by_user0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AirdropProject0 = await AirdropProjects.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AirdropProject0?.setCreated_by_user)
{
await
AirdropProject0.
setCreated_by_user(relatedCreated_by_user0);
}
const relatedCreated_by_user1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AirdropProject1 = await AirdropProjects.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AirdropProject1?.setCreated_by_user)
{
await
AirdropProject1.
setCreated_by_user(relatedCreated_by_user1);
}
const relatedCreated_by_user2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AirdropProject2 = await AirdropProjects.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AirdropProject2?.setCreated_by_user)
{
await
AirdropProject2.
setCreated_by_user(relatedCreated_by_user2);
}
const relatedCreated_by_user3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const AirdropProject3 = await AirdropProjects.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AirdropProject3?.setCreated_by_user)
{
await
AirdropProject3.
setCreated_by_user(relatedCreated_by_user3);
}
}
async function associateAirdropTaskWithProject() {
const relatedProject0 = await AirdropProjects.findOne({
offset: Math.floor(Math.random() * (await AirdropProjects.count())),
});
const AirdropTask0 = await AirdropTasks.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (AirdropTask0?.setProject)
{
await
AirdropTask0.
setProject(relatedProject0);
}
const relatedProject1 = await AirdropProjects.findOne({
offset: Math.floor(Math.random() * (await AirdropProjects.count())),
});
const AirdropTask1 = await AirdropTasks.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (AirdropTask1?.setProject)
{
await
AirdropTask1.
setProject(relatedProject1);
}
const relatedProject2 = await AirdropProjects.findOne({
offset: Math.floor(Math.random() * (await AirdropProjects.count())),
});
const AirdropTask2 = await AirdropTasks.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (AirdropTask2?.setProject)
{
await
AirdropTask2.
setProject(relatedProject2);
}
const relatedProject3 = await AirdropProjects.findOne({
offset: Math.floor(Math.random() * (await AirdropProjects.count())),
});
const AirdropTask3 = await AirdropTasks.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (AirdropTask3?.setProject)
{
await
AirdropTask3.
setProject(relatedProject3);
}
}
async function associateTaskCompletionWithUser() {
const relatedUser0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const TaskCompletion0 = await TaskCompletions.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (TaskCompletion0?.setUser)
{
await
TaskCompletion0.
setUser(relatedUser0);
}
const relatedUser1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const TaskCompletion1 = await TaskCompletions.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (TaskCompletion1?.setUser)
{
await
TaskCompletion1.
setUser(relatedUser1);
}
const relatedUser2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const TaskCompletion2 = await TaskCompletions.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (TaskCompletion2?.setUser)
{
await
TaskCompletion2.
setUser(relatedUser2);
}
const relatedUser3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const TaskCompletion3 = await TaskCompletions.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (TaskCompletion3?.setUser)
{
await
TaskCompletion3.
setUser(relatedUser3);
}
}
async function associateTaskCompletionWithTask() {
const relatedTask0 = await AirdropTasks.findOne({
offset: Math.floor(Math.random() * (await AirdropTasks.count())),
});
const TaskCompletion0 = await TaskCompletions.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (TaskCompletion0?.setTask)
{
await
TaskCompletion0.
setTask(relatedTask0);
}
const relatedTask1 = await AirdropTasks.findOne({
offset: Math.floor(Math.random() * (await AirdropTasks.count())),
});
const TaskCompletion1 = await TaskCompletions.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (TaskCompletion1?.setTask)
{
await
TaskCompletion1.
setTask(relatedTask1);
}
const relatedTask2 = await AirdropTasks.findOne({
offset: Math.floor(Math.random() * (await AirdropTasks.count())),
});
const TaskCompletion2 = await TaskCompletions.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (TaskCompletion2?.setTask)
{
await
TaskCompletion2.
setTask(relatedTask2);
}
const relatedTask3 = await AirdropTasks.findOne({
offset: Math.floor(Math.random() * (await AirdropTasks.count())),
});
const TaskCompletion3 = await TaskCompletions.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (TaskCompletion3?.setTask)
{
await
TaskCompletion3.
setTask(relatedTask3);
}
}
async function associateWalletWithUser() {
const relatedUser0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Wallet0 = await Wallets.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Wallet0?.setUser)
{
await
Wallet0.
setUser(relatedUser0);
}
const relatedUser1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Wallet1 = await Wallets.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Wallet1?.setUser)
{
await
Wallet1.
setUser(relatedUser1);
}
const relatedUser2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Wallet2 = await Wallets.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Wallet2?.setUser)
{
await
Wallet2.
setUser(relatedUser2);
}
const relatedUser3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Wallet3 = await Wallets.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Wallet3?.setUser)
{
await
Wallet3.
setUser(relatedUser3);
}
}
async function associateWalletWithBlockchain() {
const relatedBlockchain0 = await Blockchains.findOne({
offset: Math.floor(Math.random() * (await Blockchains.count())),
});
const Wallet0 = await Wallets.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Wallet0?.setBlockchain)
{
await
Wallet0.
setBlockchain(relatedBlockchain0);
}
const relatedBlockchain1 = await Blockchains.findOne({
offset: Math.floor(Math.random() * (await Blockchains.count())),
});
const Wallet1 = await Wallets.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Wallet1?.setBlockchain)
{
await
Wallet1.
setBlockchain(relatedBlockchain1);
}
const relatedBlockchain2 = await Blockchains.findOne({
offset: Math.floor(Math.random() * (await Blockchains.count())),
});
const Wallet2 = await Wallets.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Wallet2?.setBlockchain)
{
await
Wallet2.
setBlockchain(relatedBlockchain2);
}
const relatedBlockchain3 = await Blockchains.findOne({
offset: Math.floor(Math.random() * (await Blockchains.count())),
});
const Wallet3 = await Wallets.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Wallet3?.setBlockchain)
{
await
Wallet3.
setBlockchain(relatedBlockchain3);
}
}
async function associateProjectWalletLinkWithProject() {
const relatedProject0 = await AirdropProjects.findOne({
offset: Math.floor(Math.random() * (await AirdropProjects.count())),
});
const ProjectWalletLink0 = await ProjectWalletLinks.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (ProjectWalletLink0?.setProject)
{
await
ProjectWalletLink0.
setProject(relatedProject0);
}
const relatedProject1 = await AirdropProjects.findOne({
offset: Math.floor(Math.random() * (await AirdropProjects.count())),
});
const ProjectWalletLink1 = await ProjectWalletLinks.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (ProjectWalletLink1?.setProject)
{
await
ProjectWalletLink1.
setProject(relatedProject1);
}
const relatedProject2 = await AirdropProjects.findOne({
offset: Math.floor(Math.random() * (await AirdropProjects.count())),
});
const ProjectWalletLink2 = await ProjectWalletLinks.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (ProjectWalletLink2?.setProject)
{
await
ProjectWalletLink2.
setProject(relatedProject2);
}
const relatedProject3 = await AirdropProjects.findOne({
offset: Math.floor(Math.random() * (await AirdropProjects.count())),
});
const ProjectWalletLink3 = await ProjectWalletLinks.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (ProjectWalletLink3?.setProject)
{
await
ProjectWalletLink3.
setProject(relatedProject3);
}
}
async function associateProjectWalletLinkWithWallet() {
const relatedWallet0 = await Wallets.findOne({
offset: Math.floor(Math.random() * (await Wallets.count())),
});
const ProjectWalletLink0 = await ProjectWalletLinks.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (ProjectWalletLink0?.setWallet)
{
await
ProjectWalletLink0.
setWallet(relatedWallet0);
}
const relatedWallet1 = await Wallets.findOne({
offset: Math.floor(Math.random() * (await Wallets.count())),
});
const ProjectWalletLink1 = await ProjectWalletLinks.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (ProjectWalletLink1?.setWallet)
{
await
ProjectWalletLink1.
setWallet(relatedWallet1);
}
const relatedWallet2 = await Wallets.findOne({
offset: Math.floor(Math.random() * (await Wallets.count())),
});
const ProjectWalletLink2 = await ProjectWalletLinks.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (ProjectWalletLink2?.setWallet)
{
await
ProjectWalletLink2.
setWallet(relatedWallet2);
}
const relatedWallet3 = await Wallets.findOne({
offset: Math.floor(Math.random() * (await Wallets.count())),
});
const ProjectWalletLink3 = await ProjectWalletLinks.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (ProjectWalletLink3?.setWallet)
{
await
ProjectWalletLink3.
setWallet(relatedWallet3);
}
}
async function associateOnchainEventWithProject() {
const relatedProject0 = await AirdropProjects.findOne({
offset: Math.floor(Math.random() * (await AirdropProjects.count())),
});
const OnchainEvent0 = await OnchainEvents.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (OnchainEvent0?.setProject)
{
await
OnchainEvent0.
setProject(relatedProject0);
}
const relatedProject1 = await AirdropProjects.findOne({
offset: Math.floor(Math.random() * (await AirdropProjects.count())),
});
const OnchainEvent1 = await OnchainEvents.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (OnchainEvent1?.setProject)
{
await
OnchainEvent1.
setProject(relatedProject1);
}
const relatedProject2 = await AirdropProjects.findOne({
offset: Math.floor(Math.random() * (await AirdropProjects.count())),
});
const OnchainEvent2 = await OnchainEvents.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (OnchainEvent2?.setProject)
{
await
OnchainEvent2.
setProject(relatedProject2);
}
const relatedProject3 = await AirdropProjects.findOne({
offset: Math.floor(Math.random() * (await AirdropProjects.count())),
});
const OnchainEvent3 = await OnchainEvents.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (OnchainEvent3?.setProject)
{
await
OnchainEvent3.
setProject(relatedProject3);
}
}
async function associateOnchainEventWithWallet() {
const relatedWallet0 = await Wallets.findOne({
offset: Math.floor(Math.random() * (await Wallets.count())),
});
const OnchainEvent0 = await OnchainEvents.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (OnchainEvent0?.setWallet)
{
await
OnchainEvent0.
setWallet(relatedWallet0);
}
const relatedWallet1 = await Wallets.findOne({
offset: Math.floor(Math.random() * (await Wallets.count())),
});
const OnchainEvent1 = await OnchainEvents.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (OnchainEvent1?.setWallet)
{
await
OnchainEvent1.
setWallet(relatedWallet1);
}
const relatedWallet2 = await Wallets.findOne({
offset: Math.floor(Math.random() * (await Wallets.count())),
});
const OnchainEvent2 = await OnchainEvents.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (OnchainEvent2?.setWallet)
{
await
OnchainEvent2.
setWallet(relatedWallet2);
}
const relatedWallet3 = await Wallets.findOne({
offset: Math.floor(Math.random() * (await Wallets.count())),
});
const OnchainEvent3 = await OnchainEvents.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (OnchainEvent3?.setWallet)
{
await
OnchainEvent3.
setWallet(relatedWallet3);
}
}
async function associateOnchainEventWithBlockchain() {
const relatedBlockchain0 = await Blockchains.findOne({
offset: Math.floor(Math.random() * (await Blockchains.count())),
});
const OnchainEvent0 = await OnchainEvents.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (OnchainEvent0?.setBlockchain)
{
await
OnchainEvent0.
setBlockchain(relatedBlockchain0);
}
const relatedBlockchain1 = await Blockchains.findOne({
offset: Math.floor(Math.random() * (await Blockchains.count())),
});
const OnchainEvent1 = await OnchainEvents.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (OnchainEvent1?.setBlockchain)
{
await
OnchainEvent1.
setBlockchain(relatedBlockchain1);
}
const relatedBlockchain2 = await Blockchains.findOne({
offset: Math.floor(Math.random() * (await Blockchains.count())),
});
const OnchainEvent2 = await OnchainEvents.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (OnchainEvent2?.setBlockchain)
{
await
OnchainEvent2.
setBlockchain(relatedBlockchain2);
}
const relatedBlockchain3 = await Blockchains.findOne({
offset: Math.floor(Math.random() * (await Blockchains.count())),
});
const OnchainEvent3 = await OnchainEvents.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (OnchainEvent3?.setBlockchain)
{
await
OnchainEvent3.
setBlockchain(relatedBlockchain3);
}
}
async function associateBlogPostWithAuthor() {
const relatedAuthor0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const BlogPost0 = await BlogPosts.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (BlogPost0?.setAuthor)
{
await
BlogPost0.
setAuthor(relatedAuthor0);
}
const relatedAuthor1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const BlogPost1 = await BlogPosts.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (BlogPost1?.setAuthor)
{
await
BlogPost1.
setAuthor(relatedAuthor1);
}
const relatedAuthor2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const BlogPost2 = await BlogPosts.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (BlogPost2?.setAuthor)
{
await
BlogPost2.
setAuthor(relatedAuthor2);
}
const relatedAuthor3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const BlogPost3 = await BlogPosts.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (BlogPost3?.setAuthor)
{
await
BlogPost3.
setAuthor(relatedAuthor3);
}
}
module.exports = {
up: async (queryInterface, Sequelize) => {
await AirdropCategories.bulkCreate(AirdropCategoriesData);
await Blockchains.bulkCreate(BlockchainsData);
await AirdropProjects.bulkCreate(AirdropProjectsData);
await AirdropTasks.bulkCreate(AirdropTasksData);
await TaskCompletions.bulkCreate(TaskCompletionsData);
await Wallets.bulkCreate(WalletsData);
await ProjectWalletLinks.bulkCreate(ProjectWalletLinksData);
await OnchainEvents.bulkCreate(OnchainEventsData);
await BlogPosts.bulkCreate(BlogPostsData);
await CommunityLinks.bulkCreate(CommunityLinksData);
await Announcements.bulkCreate(AnnouncementsData);
await Promise.all([
// Similar logic for "relation_many"
await associateAirdropProjectWithCategory(),
await associateAirdropProjectWithBlockchain(),
await associateAirdropProjectWithCreated_by_user(),
await associateAirdropTaskWithProject(),
await associateTaskCompletionWithUser(),
await associateTaskCompletionWithTask(),
await associateWalletWithUser(),
await associateWalletWithBlockchain(),
await associateProjectWalletLinkWithProject(),
await associateProjectWalletLinkWithWallet(),
await associateOnchainEventWithProject(),
await associateOnchainEventWithWallet(),
await associateOnchainEventWithBlockchain(),
await associateBlogPostWithAuthor(),
]);
},
down: async (queryInterface, Sequelize) => {
await queryInterface.bulkDelete('airdrop_categories', null, {});
await queryInterface.bulkDelete('blockchains', null, {});
await queryInterface.bulkDelete('airdrop_projects', null, {});
await queryInterface.bulkDelete('airdrop_tasks', null, {});
await queryInterface.bulkDelete('task_completions', null, {});
await queryInterface.bulkDelete('wallets', null, {});
await queryInterface.bulkDelete('project_wallet_links', null, {});
await queryInterface.bulkDelete('onchain_events', null, {});
await queryInterface.bulkDelete('blog_posts', null, {});
await queryInterface.bulkDelete('community_links', null, {});
await queryInterface.bulkDelete('announcements', null, {});
},
};