30228/backend/src/db/seeders/20231127130745-sample-data.js
2025-03-27 10:21:26 +00:00

273 lines
4.5 KiB
JavaScript

const db = require('../models');
const Users = db.users;
const CmsContents = db.cms_contents;
const Contacts = db.contacts;
const MarketTickers = db.market_tickers;
const Newsletters = db.newsletters;
const Pages = db.pages;
const TradingSignals = db.trading_signals;
const CmsContentsData = [
{
title: 'Welcome to VelmoraPro',
content: 'VelmoraPro is your trusted trading partner.',
// type code here for "images" field
},
{
title: 'Market Insights',
content: 'Get the latest market insights and trends.',
// type code here for "images" field
},
{
title: 'Trading Strategies',
content: 'Explore our expert trading strategies.',
// type code here for "images" field
},
{
title: 'Company News',
content: 'Stay updated with our latest news.',
// type code here for "images" field
},
{
title: 'Contact Us',
content: 'Reach out to us for any inquiries.',
// type code here for "images" field
},
];
const ContactsData = [
{
name: 'Alice Johnson',
email: 'alice@example.com',
message: 'I have a question about your services.',
},
{
name: 'Bob Williams',
email: 'bob@example.com',
message: 'Can you provide more information on trading signals?',
},
{
name: 'Charlie Brown',
email: 'charlie@example.com',
message: 'How do I subscribe to the newsletter?',
},
{
name: 'Diana Prince',
email: 'diana@example.com',
message: 'I need help with my account.',
},
{
name: 'Eve Adams',
email: 'eve@example.com',
message: 'What are your office hours?',
},
];
const MarketTickersData = [
{
ticker_name: 'AAPL',
current_value: 150.25,
last_updated: new Date('2023-10-01T10:00:00Z'),
},
{
ticker_name: 'GOOGL',
current_value: 2800.5,
last_updated: new Date('2023-10-01T10:05:00Z'),
},
{
ticker_name: 'AMZN',
current_value: 3400.75,
last_updated: new Date('2023-10-01T10:10:00Z'),
},
{
ticker_name: 'TSLA',
current_value: 750,
last_updated: new Date('2023-10-01T10:15:00Z'),
},
{
ticker_name: 'MSFT',
current_value: 299.99,
last_updated: new Date('2023-10-01T10:20:00Z'),
},
];
const NewslettersData = [
{
email: 'subscriber1@example.com',
},
{
email: 'subscriber2@example.com',
},
{
email: 'subscriber3@example.com',
},
{
email: 'subscriber4@example.com',
},
{
email: 'subscriber5@example.com',
},
];
const PagesData = [
{
page_name: 'Homepage',
content: 'Welcome to our homepage.',
},
{
page_name: 'About Us',
content: 'Learn more about our company.',
},
{
page_name: 'Our Services',
content: 'Discover our range of services.',
},
{
page_name: 'News',
content: 'Read the latest news.',
},
{
page_name: 'Blog',
content: 'Explore our blog articles.',
},
];
const TradingSignalsData = [
{
signal_name: 'Buy AAPL',
description: 'Strong buy signal for AAPL',
signal_time: new Date('2023-10-01T09:00:00Z'),
},
{
signal_name: 'Sell GOOGL',
description: 'Consider selling GOOGL',
signal_time: new Date('2023-10-01T09:30:00Z'),
},
{
signal_name: 'Hold AMZN',
description: 'Hold position on AMZN',
signal_time: new Date('2023-10-01T10:00:00Z'),
},
{
signal_name: 'Buy TSLA',
description: 'Buy TSLA at current price',
signal_time: new Date('2023-10-01T10:30:00Z'),
},
{
signal_name: 'Sell MSFT',
description: 'Sell MSFT before market close',
signal_time: new Date('2023-10-01T11:00:00Z'),
},
];
// Similar logic for "relation_many"
module.exports = {
up: async (queryInterface, Sequelize) => {
await CmsContents.bulkCreate(CmsContentsData);
await Contacts.bulkCreate(ContactsData);
await MarketTickers.bulkCreate(MarketTickersData);
await Newsletters.bulkCreate(NewslettersData);
await Pages.bulkCreate(PagesData);
await TradingSignals.bulkCreate(TradingSignalsData);
await Promise.all([
// Similar logic for "relation_many"
]);
},
down: async (queryInterface, Sequelize) => {
await queryInterface.bulkDelete('cms_contents', null, {});
await queryInterface.bulkDelete('contacts', null, {});
await queryInterface.bulkDelete('market_tickers', null, {});
await queryInterface.bulkDelete('newsletters', null, {});
await queryInterface.bulkDelete('pages', null, {});
await queryInterface.bulkDelete('trading_signals', null, {});
},
};