AgPerry's picture
Add files using upload-large-folder tool
9d4a3b0 verified
Raw History Blame Contribute Delete
9.87 kB
import { and, eq } from "drizzle-orm";
import { getDb } from "../db";
import {
comments,
connections,
conversationMembers,
conversations,
experiences,
jobs,
memberships,
messages,
notifications,
organizations,
postLikes,
posts,
users,
} from "../db/schema";
import { hashPassword } from "../lib/password";
const ids = {
maya: "11111111-1111-4111-8111-111111111111",
jordan: "22222222-2222-4222-8222-222222222222",
priya: "33333333-3333-4333-8333-333333333333",
noah: "44444444-4444-4444-8444-444444444444",
northstar: "55555555-5555-4555-8555-555555555555",
fieldnote: "66666666-6666-4666-8666-666666666666",
designerJob: "77777777-7777-4777-8777-777777777777",
engineerJob: "88888888-8888-4888-8888-888888888888",
opsJob: "99999999-9999-4999-8999-999999999999",
postOne: "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
postTwo: "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
conversation: "cccccccc-cccc-4ccc-8ccc-cccccccccccc",
expMaya: "d1111111-1111-4111-8111-111111111111",
expJordan: "d2222222-2222-4222-8222-222222222222",
expNoah: "d3333333-3333-4333-8333-333333333333",
commentOne: "e1111111-1111-4111-8111-111111111111",
commentTwo: "e2222222-2222-4222-8222-222222222222",
messageOne: "f1111111-1111-4111-8111-111111111111",
messageTwo: "f2222222-2222-4222-8222-222222222222",
messageThree: "f3333333-3333-4333-8333-333333333333",
noticeOne: "a1111111-1111-4111-8111-111111111111",
noticeTwo: "a2222222-2222-4222-8222-222222222222",
noticeThree: "a3333333-3333-4333-8333-333333333333",
};
async function main() {
const db = getDb();
const passwordHash = await hashPassword("LinkedInDemo123");
await db.insert(organizations).values([
{
id: ids.northstar,
name: "Northstar Systems",
slug: "northstar-systems",
tagline: "Infrastructure that lets ambitious teams move with confidence.",
description: "Northstar Systems builds dependable workflow infrastructure for complex operations teams.",
industry: "Enterprise Software",
website: "https://example.com/northstar",
location: "San Francisco, California",
employeeCount: 2800,
},
{
id: ids.fieldnote,
name: "Fieldnote Climate",
slug: "fieldnote-climate",
tagline: "Turning field intelligence into practical climate action.",
description: "Fieldnote Climate helps organizations coordinate climate field data and operational response.",
industry: "Climate Technology",
website: "https://example.com/fieldnote",
location: "Remote-first",
employeeCount: 420,
},
]).onConflictDoNothing();
await db.insert(users).values([
{ id: ids.maya, email: "maya@example.com", username: "maya-chen", passwordHash, emailVerifiedAt: new Date(), name: "Maya Chen", headline: "Product design lead building calm, useful software", about: "I design professional tools around clarity and useful collaboration.", location: "San Francisco Bay Area", avatarUrl: "/media/maya-chen.jpg", openToWork: false },
{ id: ids.jordan, email: "jordan@example.com", username: "jordan-lee", passwordHash, emailVerifiedAt: new Date(), name: "Jordan Lee", headline: "Engineering Manager at Northstar Systems", about: "Platform engineering leader focused on developer experience.", location: "New York City Metropolitan Area", avatarUrl: "/media/jordan-lee.jpg" },
{ id: ids.priya, email: "priya@example.com", username: "priya-raman", passwordHash, emailVerifiedAt: new Date(), name: "Priya Raman", headline: "Data scientist focused on responsible AI", about: "I help teams evaluate models before they reach customers.", location: "Seattle, Washington", avatarUrl: "/media/priya-raman.jpg" },
{ id: ids.noah, email: "noah@example.com", username: "noah-williams", passwordHash, emailVerifiedAt: new Date(), name: "Noah Williams", headline: "Founder, Fieldnote Climate", about: "Building climate operations software for field teams.", location: "Austin, Texas", avatarUrl: "/media/noah-williams.jpg" },
]).onConflictDoNothing();
await db.insert(memberships).values([
{ organizationId: ids.northstar, userId: ids.maya, role: "owner", title: "Product Design Lead" },
{ organizationId: ids.northstar, userId: ids.jordan, role: "admin", title: "Engineering Manager" },
{ organizationId: ids.fieldnote, userId: ids.noah, role: "owner", title: "Founder" },
{ organizationId: ids.fieldnote, userId: ids.priya, role: "recruiter", title: "AI Advisor" },
]).onConflictDoNothing();
await db.insert(experiences).values([
{ id: ids.expMaya, userId: ids.maya, organizationId: ids.northstar, companyName: "Northstar Systems", title: "Product Design Lead", location: "San Francisco Bay Area", description: "Leading design for workflow infrastructure used by operations teams.", startDate: "2022-01", current: true },
{ id: ids.expJordan, userId: ids.jordan, organizationId: ids.northstar, companyName: "Northstar Systems", title: "Engineering Manager", location: "New York", description: "Managing platform engineers focused on reliability and DX.", startDate: "2021-04", current: true },
{ id: ids.expNoah, userId: ids.noah, organizationId: ids.fieldnote, companyName: "Fieldnote Climate", title: "Founder", location: "Austin", description: "Building field intelligence tools for climate operations.", startDate: "2020-08", current: true },
]).onConflictDoNothing();
await db.insert(posts).values([
{ id: ids.postOne, authorId: ids.jordan, organizationId: ids.northstar, content: "The best platform teams I have worked with treat developer experience as a product. That means clear ownership, measured outcomes, and documentation that answers the question someone actually has." },
{ id: ids.postTwo, authorId: ids.priya, organizationId: ids.fieldnote, content: "We just published our model evaluation checklist for cross-functional teams. The most useful shift was simple: write the failure scenarios before choosing the metrics.", mediaUrl: "/media/workshop.jpg" },
]).onConflictDoNothing();
await db.insert(postLikes).values([
{ postId: ids.postOne, userId: ids.maya },
{ postId: ids.postTwo, userId: ids.maya },
{ postId: ids.postTwo, userId: ids.jordan },
]).onConflictDoNothing();
await db.insert(comments).values([
{ id: ids.commentOne, postId: ids.postOne, authorId: ids.maya, content: "This framing makes the work feel much more accountable." },
{ id: ids.commentTwo, postId: ids.postTwo, authorId: ids.noah, content: "Writing failure scenarios first changes the whole conversation." },
]).onConflictDoNothing();
const existingConnection = await db.select().from(connections).where(and(eq(connections.requesterId, ids.jordan), eq(connections.recipientId, ids.maya))).limit(1);
if (!existingConnection.length) await db.insert(connections).values({ requesterId: ids.jordan, recipientId: ids.maya, status: "pending" });
await db.insert(jobs).values([
{ id: ids.designerJob, organizationId: ids.northstar, createdBy: ids.jordan, title: "Senior Product Designer", description: "Lead end-to-end product design for complex professional workflows.", requirements: "Portfolio showing complex product decisions; strong facilitation; systems thinking.", location: "New York, NY", workplaceType: "Hybrid", employmentType: "Full-time", seniority: "Senior", salaryMin: 155000, salaryMax: 198000 },
{ id: ids.engineerJob, organizationId: ids.fieldnote, createdBy: ids.noah, title: "Staff Frontend Engineer", description: "Build responsive, accessible applications for climate operations teams.", requirements: "Deep TypeScript and React experience; excellent product instincts.", location: "United States", workplaceType: "Remote", employmentType: "Full-time", seniority: "Staff", salaryMin: 180000, salaryMax: 225000 },
{ id: ids.opsJob, organizationId: ids.northstar, createdBy: ids.jordan, title: "Product Operations Lead", description: "Scale product rituals, feedback loops, and roadmap operations.", requirements: "Strong operating cadence, analytics, and stakeholder management.", location: "Austin, TX", workplaceType: "On-site", employmentType: "Full-time", seniority: "Lead", salaryMin: 130000, salaryMax: 165000 },
]).onConflictDoNothing();
await db.insert(conversations).values({ id: ids.conversation, subject: "Design review rituals" }).onConflictDoNothing();
await db.insert(conversationMembers).values([
{ conversationId: ids.conversation, userId: ids.maya },
{ conversationId: ids.conversation, userId: ids.jordan },
]).onConflictDoNothing();
await db.insert(messages).values([
{ id: ids.messageOne, conversationId: ids.conversation, senderId: ids.jordan, body: "Hey Maya, your post about design reviews landed with our team." },
{ id: ids.messageTwo, conversationId: ids.conversation, senderId: ids.maya, body: "I’m glad it was useful. We changed the format after a lot of trial and error." },
{ id: ids.messageThree, conversationId: ids.conversation, senderId: ids.jordan, body: "Would you be open to sharing how you structure the pre-read?" },
]).onConflictDoNothing();
await db.insert(notifications).values([
{ id: ids.noticeOne, userId: ids.maya, actorId: ids.jordan, type: "connection", title: "Jordan Lee invited you to connect", href: "/my-network" },
{ id: ids.noticeTwo, userId: ids.maya, actorId: ids.priya, type: "post_like", title: "Priya Raman reacted to your post", href: "/feed" },
{ id: ids.noticeThree, userId: ids.maya, actorId: ids.noah, type: "comment", title: "Noah Williams commented on a discussion", body: "This is exactly the tradeoff our team is discussing.", href: "/feed" },
]).onConflictDoNothing();
console.log("Seeded LinkedIn demo data. Login with maya@example.com / LinkedInDemo123");
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});