37857-vm/backend/src/db/seeders/20231127130745-sample-data.js
2026-01-27 01:36:09 +00:00

2005 lines
34 KiB
JavaScript

const db = require('../models');
const Users = db.users;
const Programs = db.programs;
const Resources = db.resources;
const Events = db.events;
const Applications = db.applications;
const Testimonials = db.testimonials;
const Pages = db.pages;
const ProgramsData = [
{
"title": "Pre-Seed Accelerator",
"slug": "pre-seed-accelerator",
"description": "Eight week intensive for founders preparing for product market fit",
// type code here for "images" field
"duration": 8,
"price": 2999.0,
"is_active": true,
// type code here for "relation_many" field
"start": new Date('2026-04-06T09:00:00Z'),
"end": new Date('2026-06-01T17:00:00Z'),
},
{
"title": "Growth Sprint",
"slug": "growth-sprint",
"description": "Four week program focused on growth experiments and metrics",
// type code here for "images" field
"duration": 4,
"price": 1499.0,
"is_active": true,
// type code here for "relation_many" field
"start": new Date('2026-05-03T09:00:00Z'),
"end": new Date('2026-05-31T17:00:00Z'),
},
{
"title": "Founder Fellowship",
"slug": "founder-fellowship",
"description": "Cohort-based mentorship and investor introductions",
// type code here for "images" field
"duration": 12,
"price": 0.0,
"is_active": false,
// type code here for "relation_many" field
"start": new Date('2026-07-01T09:00:00Z'),
"end": new Date('2026-09-22T17:00:00Z'),
},
{
"title": "Product Workshop Series",
"slug": "product-workshop-series",
"description": "Workshops on product discovery, UX, and roadmapping",
// type code here for "images" field
"duration": 3,
"price": 499.0,
"is_active": true,
// type code here for "relation_many" field
"start": new Date('2026-03-15T10:00:00Z'),
"end": new Date('2026-04-05T16:00:00Z'),
},
];
const ResourcesData = [
{
"title": "Product Market Fit Guide",
"slug": "product-market-fit-guide",
"excerpt": "A practical guide to finding product market fit quickly",
"content": "Step by step framework to test value propositions and iterate rapidly",
// type code here for "relation_one" field
"publish_date": new Date('2026-02-10T08:00:00Z'),
"featured": true,
"category": "news",
},
{
"title": "How to Build a Pitch Deck",
"slug": "build-a-pitch-deck",
"excerpt": "Essential slides every founder should include in their deck",
"content": "Templates and sample decks with commentary on investor expectations",
// type code here for "relation_one" field
"publish_date": new Date('2026-01-20T08:00:00Z'),
"featured": false,
"category": "case_study",
},
{
"title": "Case Study: Scaling to Series A",
"slug": "scaling-to-series-a",
"excerpt": "Lessons from a startup that reached Series A in 18 months",
"content": "Operational changes and fundraising tactics that made an impact",
// type code here for "relation_one" field
"publish_date": new Date('2026-03-01T09:00:00Z'),
"featured": true,
"category": "article",
},
{
"title": "Weekly Funding Roundups",
"slug": "weekly-funding-roundups",
"excerpt": "Recent investment news and notable seed rounds",
"content": "Short summaries of funding events and market trends",
// type code here for "relation_one" field
"publish_date": new Date('2026-02-25T09:00:00Z'),
"featured": false,
"category": "news",
},
];
const EventsData = [
{
"title": "Intro to Growth Metrics",
"description": "Workshop covering key metrics for early stage growth",
"start": new Date('2026-04-08T10:00:00Z'),
"end": new Date('2026-04-08T12:00:00Z'),
"location": "Community Hub Room A",
"online": true,
// type code here for "relation_one" field
"capacity": 40,
},
{
"title": "Virtual Office Hours with Mentors",
"description": "Drop in for 20 minute mentor sessions",
"start": new Date('2026-03-20T15:00:00Z'),
"end": new Date('2026-03-20T17:00:00Z'),
"location": "Zoom",
"online": true,
// type code here for "relation_one" field
"capacity": 100,
},
{
"title": "Investor Panel Night",
"description": "Panel of early stage investors and Q&A",
"start": new Date('2026-05-12T18:00:00Z'),
"end": new Date('2026-05-12T20:00:00Z'),
"location": "Main Hall",
"online": true,
// type code here for "relation_one" field
"capacity": 150,
},
{
"title": "Founder Office Hours",
"description": "One to one coaching sessions for cohort founders",
"start": new Date('2026-04-20T09:00:00Z'),
"end": new Date('2026-04-20T16:00:00Z'),
"location": "Workspace Room 3",
"online": true,
// type code here for "relation_one" field
"capacity": 12,
},
];
const ApplicationsData = [
{
"full_name": "Noah Williams",
"email": "noah.williams@example.com",
"phone": "+1-415-555-0123",
"message": "Excited to join the accelerator to refine our go to market strategy",
// type code here for "relation_one" field
"status": "rejected",
"submitted_at": new Date('2026-02-28T14:20:00Z'),
},
{
"full_name": "Emily Chen",
"email": "emily.chen@example.com",
"phone": "+1-212-555-0345",
"message": "Looking for mentorship on pricing and onboarding",
// type code here for "relation_one" field
"status": "rejected",
"submitted_at": new Date('2026-03-02T10:05:00Z'),
},
{
"full_name": "Omar Haddad",
"email": "omar.haddad@example.com",
"phone": "+44-20-7946-0123",
"message": "Our product is ready for growth stage and we seek investor intros",
// type code here for "relation_one" field
"status": "new",
"submitted_at": new Date('2026-01-18T09:30:00Z'),
},
{
"full_name": "Chloe Martin",
"email": "chloe.martin@example.com",
"phone": "+61-2-5550-1122",
"message": "Interested in the product workshops for user testing techniques",
// type code here for "relation_one" field
"status": "new",
"submitted_at": new Date('2026-03-10T11:45:00Z'),
},
];
const TestimonialsData = [
{
"author_name": "Dana Cooper",
// type code here for "relation_one" field
"content": "The accelerator helped us focus and secure our first customers",
"company": "BrightApps",
"published": true,
},
{
"author_name": "Ethan Park",
// type code here for "relation_one" field
"content": "Mentor feedback was practical and directly impacted our metrics",
"company": "GreenLoop",
"published": true,
},
{
"author_name": "Mariana Lopez",
// type code here for "relation_one" field
"content": "Great community and structured workshops that delivered results",
"company": "LumiTech",
"published": false,
},
{
"author_name": "Tom Becker",
// type code here for "relation_one" field
"content": "Access to experienced mentors accelerated our fundraising timeline",
"company": "ScaleMate",
"published": true,
},
];
const PagesData = [
{
"title": "Home",
"slug": "home",
"content": "Landing page with program highlights testimonials and call to action",
// type code here for "images" field
"is_published": true,
},
{
"title": "About",
"slug": "about",
"content": "Our mission is to support founders with mentorship resources and community",
// type code here for "images" field
"is_published": true,
},
{
"title": "Programs",
"slug": "programs",
"content": "Overview of cohort programs workshops and application details",
// type code here for "images" field
"is_published": true,
},
{
"title": "Resources",
"slug": "resources",
"content": "Library of guides case studies and templates for founders",
// type code here for "images" field
"is_published": true,
},
];
// Similar logic for "relation_many"
// Similar logic for "relation_many"
async function associateResourceWithAuthor() {
const relatedAuthor0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Resource0 = await Resources.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Resource0?.setAuthor)
{
await
Resource0.
setAuthor(relatedAuthor0);
}
const relatedAuthor1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Resource1 = await Resources.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Resource1?.setAuthor)
{
await
Resource1.
setAuthor(relatedAuthor1);
}
const relatedAuthor2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Resource2 = await Resources.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Resource2?.setAuthor)
{
await
Resource2.
setAuthor(relatedAuthor2);
}
const relatedAuthor3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Resource3 = await Resources.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Resource3?.setAuthor)
{
await
Resource3.
setAuthor(relatedAuthor3);
}
}
async function associateEventWithRelated_program() {
const relatedRelated_program0 = await Programs.findOne({
offset: Math.floor(Math.random() * (await Programs.count())),
});
const Event0 = await Events.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Event0?.setRelated_program)
{
await
Event0.
setRelated_program(relatedRelated_program0);
}
const relatedRelated_program1 = await Programs.findOne({
offset: Math.floor(Math.random() * (await Programs.count())),
});
const Event1 = await Events.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Event1?.setRelated_program)
{
await
Event1.
setRelated_program(relatedRelated_program1);
}
const relatedRelated_program2 = await Programs.findOne({
offset: Math.floor(Math.random() * (await Programs.count())),
});
const Event2 = await Events.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Event2?.setRelated_program)
{
await
Event2.
setRelated_program(relatedRelated_program2);
}
const relatedRelated_program3 = await Programs.findOne({
offset: Math.floor(Math.random() * (await Programs.count())),
});
const Event3 = await Events.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Event3?.setRelated_program)
{
await
Event3.
setRelated_program(relatedRelated_program3);
}
}
async function associateApplicationWithProgram() {
const relatedProgram0 = await Programs.findOne({
offset: Math.floor(Math.random() * (await Programs.count())),
});
const Application0 = await Applications.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Application0?.setProgram)
{
await
Application0.
setProgram(relatedProgram0);
}
const relatedProgram1 = await Programs.findOne({
offset: Math.floor(Math.random() * (await Programs.count())),
});
const Application1 = await Applications.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Application1?.setProgram)
{
await
Application1.
setProgram(relatedProgram1);
}
const relatedProgram2 = await Programs.findOne({
offset: Math.floor(Math.random() * (await Programs.count())),
});
const Application2 = await Applications.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Application2?.setProgram)
{
await
Application2.
setProgram(relatedProgram2);
}
const relatedProgram3 = await Programs.findOne({
offset: Math.floor(Math.random() * (await Programs.count())),
});
const Application3 = await Applications.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Application3?.setProgram)
{
await
Application3.
setProgram(relatedProgram3);
}
}
async function associateTestimonialWithAuthor() {
const relatedAuthor0 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Testimonial0 = await Testimonials.findOne({
order: [['id', 'ASC']],
offset: 0
});
if (Testimonial0?.setAuthor)
{
await
Testimonial0.
setAuthor(relatedAuthor0);
}
const relatedAuthor1 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Testimonial1 = await Testimonials.findOne({
order: [['id', 'ASC']],
offset: 1
});
if (Testimonial1?.setAuthor)
{
await
Testimonial1.
setAuthor(relatedAuthor1);
}
const relatedAuthor2 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Testimonial2 = await Testimonials.findOne({
order: [['id', 'ASC']],
offset: 2
});
if (Testimonial2?.setAuthor)
{
await
Testimonial2.
setAuthor(relatedAuthor2);
}
const relatedAuthor3 = await Users.findOne({
offset: Math.floor(Math.random() * (await Users.count())),
});
const Testimonial3 = await Testimonials.findOne({
order: [['id', 'ASC']],
offset: 3
});
if (Testimonial3?.setAuthor)
{
await
Testimonial3.
setAuthor(relatedAuthor3);
}
}
module.exports = {
up: async (queryInterface, Sequelize) => {
await Programs.bulkCreate(ProgramsData);
await Resources.bulkCreate(ResourcesData);
await Events.bulkCreate(EventsData);
await Applications.bulkCreate(ApplicationsData);
await Testimonials.bulkCreate(TestimonialsData);
await Pages.bulkCreate(PagesData);
await Promise.all([
// Similar logic for "relation_many"
// Similar logic for "relation_many"
await associateResourceWithAuthor(),
await associateEventWithRelated_program(),
await associateApplicationWithProgram(),
await associateTestimonialWithAuthor(),
]);
},
down: async (queryInterface, Sequelize) => {
await queryInterface.bulkDelete('programs', null, {});
await queryInterface.bulkDelete('resources', null, {});
await queryInterface.bulkDelete('events', null, {});
await queryInterface.bulkDelete('applications', null, {});
await queryInterface.bulkDelete('testimonials', null, {});
await queryInterface.bulkDelete('pages', null, {});
},
};