Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
π± Replace random seed data with hand-crafted realistic fixtures (#2257)
Luke Vella85b16d0a491a
diff --git a/packages/database/prisma/seed.ts b/packages/database/prisma/seed.tsindex 32b5e69f2..dead9647e 100644--- a/packages/database/prisma/seed.ts+++ b/packages/database/prisma/seed.ts@@ -1,15 +1,169 @@-import { prisma } from "@rallly/database";-import { seedPolls } from "./seed/polls";-import { seedScheduledEvents } from "./seed/scheduled-events";-import { seedUsers } from "./seed/users";+import { PrismaPg } from "@prisma/adapter-pg";+import { PrismaClient } from "../generated/prisma/client";+import {+ polls,+ scheduledEvents,+ spaceMembers,+ spaces,+ users,+} from "./seed/data";++const adapter = new PrismaPg({+ connectionString: process.env.DATABASE_URL,+});+const prisma = new PrismaClient({ adapter });++let idCounter = 0;+function nextId() {+ return `seed-${(++idCounter).toString().padStart(4, "0")}`;+}async function main() {- const users = await seedUsers();+ // 1. Users+ await prisma.user.createMany({ data: users.map((u) => ({ ...u })) });+ console.info(`β ${users.length} users`);++ // 2. Spaces+ await prisma.space.createMany({ data: spaces });+ console.info(`β ${spaces.length} spaces`);++ // 3. Space members+ await prisma.spaceMember.createMany({ data: spaceMembers });+ console.info(`β ${spaceMembers.length} space members`);++ // 4. Scheduled events + invites+ let inviteCount = 0;+ for (const evt of scheduledEvents) {+ const eventId = nextId();+ const uid = crypto.randomUUID();++ await prisma.scheduledEvent.create({+ data: {+ id: eventId,+ uid,+ title: evt.title,+ description: evt.description,+ location: evt.location,+ status: evt.status,+ timeZone: evt.timeZone,+ start: new Date(evt.start),+ end: new Date(evt.end),+ allDay: evt.allDay,+ userId: evt.userId,+ spaceId: evt.spaceId,+ },+ });++ if (evt.invites?.length) {+ await prisma.scheduledEventInvite.createMany({+ data: evt.invites.map((inv) => ({+ id: nextId(),+ scheduledEventId: eventId,+ inviteeName: inv.inviteeName,+ inviteeEmail: inv.inviteeEmail,+ inviteeTimeZone: inv.inviteeTimeZone,+ inviteeId: inv.inviteeId,+ status: inv.status,+ })),+ });+ inviteCount += evt.invites.length;+ }+ }+ console.info(+ `β ${scheduledEvents.length} scheduled events, ${inviteCount} invites`,+ );++ // 5. Polls + options + participants + votes + comments+ let optionCount = 0;+ let participantCount = 0;+ let voteCount = 0;+ let commentCount = 0;++ for (const poll of polls) {+ const pollId = nextId();+ const adminUrlId = nextId();+ const participantUrlId = nextId();++ await prisma.poll.create({+ data: {+ id: pollId,+ title: poll.title,+ description: poll.description,+ location: poll.location,+ status: poll.status,+ timeZone: poll.timeZone,+ deadline: poll.deadline ? new Date(poll.deadline) : undefined,+ userId: poll.userId,+ spaceId: poll.spaceId,+ adminUrlId,+ participantUrlId,+ hideParticipants: poll.hideParticipants,+ hideScores: poll.hideScores,+ disableComments: poll.disableComments,+ requireParticipantEmail: poll.requireParticipantEmail,+ },+ });- for (const user of users) {- await seedPolls(user.id);- await seedScheduledEvents(user.id);+ // Options+ const optionIds: string[] = [];+ for (let i = 0; i < poll.options.length; i++) {+ optionIds.push(nextId());+ }+ await prisma.option.createMany({+ data: poll.options.map((opt, i) => ({+ id: optionIds[i],+ pollId,+ startTime: new Date(opt.startTime),+ duration: opt.duration,+ })),+ });+ optionCount += poll.options.length;++ // Participants + votes+ for (const part of poll.participants) {+ const participantId = nextId();+ await prisma.participant.create({+ data: {+ id: participantId,+ pollId,+ name: part.name,+ email: part.email,+ userId: part.userId,+ },+ });+ participantCount++;++ // Votes β one per option+ await prisma.vote.createMany({+ data: part.votes.map((voteType, i) => ({+ id: nextId(),+ pollId,+ participantId,+ optionId: optionIds[i],+ type: voteType,+ })),+ });+ voteCount += part.votes.length;+ }++ // Comments+ if (poll.comments?.length) {+ await prisma.comment.createMany({+ data: poll.comments.map((c) => ({+ id: nextId(),+ pollId,+ content: c.content,+ authorName: c.authorName,+ userId: c.userId,+ })),+ });+ commentCount += poll.comments.length;+ }}++ console.info(+ `β ${polls.length} polls, ${optionCount} options, ${participantCount} participants, ${voteCount} votes, ${commentCount} comments`,+ );}main()diff --git a/packages/database/prisma/seed/data.ts b/packages/database/prisma/seed/data.tsnew file mode 100644index 000000000..f27705449--- /dev/null+++ b/packages/database/prisma/seed/data.ts@@ -0,0 +1,1389 @@+import type {+ PollStatus,+ ScheduledEventInviteStatus,+ ScheduledEventStatus,+ SpaceMemberRole,+ SpaceTier,+ VoteType,+} from "../../generated/prisma/client";++// βββ Users βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ++export const users = [+ {+ id: "user-1",+ name: "Dev User",+ email: "[email protected]",+ timeZone: "America/New_York",+ weekStart: 1,+ },+ {+ id: "user-2",+ name: "Sarah Chen",+ email: "[email protected]",+ timeZone: "America/Los_Angeles",+ },+ {+ id: "user-3",+ name: "Michael Torres",+ email: "[email protected]",+ timeZone: "Europe/London",+ },+ {+ id: "user-4",+ name: "Emily Nakamura",+ email: "[email protected]",+ timeZone: "Asia/Tokyo",+ },+ {+ id: "user-5",+ name: "James Okonkwo",+ email: "[email protected]",+ timeZone: "America/Chicago",+ },+] as const;++// βββ Spaces ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ++export const spaces: Array<{+ id: string;+ name: string;+ ownerId: string;+ tier: SpaceTier;+}> = [+ { id: "space-1", name: "Personal", ownerId: "user-1", tier: "hobby" },+ { id: "space-2", name: "Acme Inc", ownerId: "user-1", tier: "pro" },+];++export const spaceMembers: Array<{+ id: string;+ spaceId: string;+ userId: string;+ role: SpaceMemberRole;+}> = [+ { id: "sm-1", spaceId: "space-1", userId: "user-1", role: "ADMIN" },+ { id: "sm-2", spaceId: "space-2", userId: "user-1", role: "ADMIN" },+ { id: "sm-3", spaceId: "space-2", userId: "user-2", role: "ADMIN" },+ { id: "sm-4", spaceId: "space-2", userId: "user-3", role: "MEMBER" },+ { id: "sm-5", spaceId: "space-2", userId: "user-4", role: "MEMBER" },+ { id: "sm-6", spaceId: "space-2", userId: "user-5", role: "MEMBER" },+];++// βββ Poll definitions ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ+// Each participant's `votes` array maps 1:1 with the `options` array.++export type PollDef = {+ title: string;+ description?: string;+ location?: string;+ status: PollStatus;+ timeZone?: string;+ deadline?: string;+ userId: string;+ spaceId: string;+ hideParticipants?: boolean;+ hideScores?: boolean;+ disableComments?: boolean;+ requireParticipantEmail?: boolean;+ options: Array<{ startTime: string; duration: number }>;+ participants: Array<{+ name: string;+ email?: string;+ userId?: string;+ votes: VoteType[];+ }>;+ comments?: Array<{+ content: string;+ authorName: string;+ userId?: string;+ }>;+};++// ββ Personal space polls βββββββββββββββββββββββββββββββββββββββββββββββββββββ++const personalPolls: PollDef[] = [+ {+ title: "Coffee chat with Alex",+ description:+ "Quick catch-up over coffee. Any of these times work for the cafΓ© on 5th.",+ status: "open",+ timeZone: "America/New_York",+ userId: "user-1",+ spaceId: "space-1",+ options: [+ { startTime: "2026-03-10T10:00:00Z", duration: 60 },+ { startTime: "2026-03-11T14:00:00Z", duration: 60 },+ { startTime: "2026-03-12T10:00:00Z", duration: 60 },+ ],+ participants: [+ {+ name: "Alex Rivera",+ email: "[email protected]",+ votes: ["yes", "no", "yes"],+ },+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "yes", "ifNeedBe"],+ },+ ],+ },+ {+ title: "Dentist appointment",+ description: "Need to book my six-month check-up.",+ status: "open",+ userId: "user-1",+ spaceId: "space-1",+ options: [+ { startTime: "2026-03-17T00:00:00Z", duration: 0 },+ { startTime: "2026-03-18T00:00:00Z", duration: 0 },+ { startTime: "2026-03-19T00:00:00Z", duration: 0 },+ { startTime: "2026-03-20T00:00:00Z", duration: 0 },+ ],+ participants: [+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "yes", "no", "yes"],+ },+ ],+ },+ {+ title: "Weekend hike",+ description:+ "Planning a group hike at Bear Mountain. Bring water and sunscreen!",+ status: "open",+ userId: "user-1",+ spaceId: "space-1",+ options: [+ { startTime: "2026-03-14T00:00:00Z", duration: 0 },+ { startTime: "2026-03-15T00:00:00Z", duration: 0 },+ { startTime: "2026-03-21T00:00:00Z", duration: 0 },+ { startTime: "2026-03-22T00:00:00Z", duration: 0 },+ ],+ participants: [+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "yes", "yes", "no"],+ },+ {+ name: "Jordan Lee",+ email: "[email protected]",+ votes: ["yes", "no", "yes", "yes"],+ },+ {+ name: "Priya Patel",+ email: "[email protected]",+ votes: ["no", "yes", "yes", "ifNeedBe"],+ },+ {+ name: "Marcus Johnson",+ email: "[email protected]",+ votes: ["yes", "yes", "no", "no"],+ },+ {+ name: "Olivia Smith",+ email: "[email protected]",+ votes: ["ifNeedBe", "yes", "yes", "yes"],+ },+ ],+ comments: [+ {+ content: "Can we do the 6-mile loop this time?",+ authorName: "Jordan Lee",+ },+ {+ content: "I'd prefer the shorter trail if possible.",+ authorName: "Priya Patel",+ },+ ],+ },+ {+ title: "Dinner with the Johnsons",+ description: "Finding a good evening for dinner at their place.",+ status: "closed",+ timeZone: "America/New_York",+ userId: "user-1",+ spaceId: "space-1",+ options: [+ { startTime: "2026-03-13T19:00:00Z", duration: 120 },+ { startTime: "2026-03-14T18:00:00Z", duration: 120 },+ { startTime: "2026-03-20T19:00:00Z", duration: 120 },+ ],+ participants: [+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "yes", "yes"],+ },+ {+ name: "Karen Johnson",+ email: "[email protected]",+ votes: ["no", "yes", "yes"],+ },+ {+ name: "Tom Johnson",+ email: "[email protected]",+ votes: ["no", "yes", "ifNeedBe"],+ },+ ],+ },+ {+ title: "Book club meeting",+ description:+ "Discussing 'Project Hail Mary' by Andy Weir. Chapter 15 onwards.",+ status: "open",+ timeZone: "America/New_York",+ deadline: "2026-03-15T00:00:00Z",+ userId: "user-1",+ spaceId: "space-1",+ options: [+ { startTime: "2026-03-18T19:00:00Z", duration: 90 },+ { startTime: "2026-03-19T19:00:00Z", duration: 90 },+ { startTime: "2026-03-20T19:00:00Z", duration: 90 },+ { startTime: "2026-03-25T19:00:00Z", duration: 90 },+ ],+ participants: [+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "yes", "no", "yes"],+ },+ {+ name: "Nadia Kowalski",+ email: "[email protected]",+ votes: ["yes", "no", "yes", "yes"],+ },+ {+ name: "David Chen",+ email: "[email protected]",+ votes: ["yes", "ifNeedBe", "no", "no"],+ },+ {+ name: "Rachel Green",+ email: "[email protected]",+ votes: ["no", "yes", "yes", "ifNeedBe"],+ },+ {+ name: "Sam Williams",+ email: "[email protected]",+ votes: ["yes", "yes", "no", "no"],+ },+ {+ name: "Lisa Park",+ email: "[email protected]",+ votes: ["ifNeedBe", "yes", "yes", "yes"],+ },+ ],+ comments: [+ {+ content: "Can't wait to discuss the ending!",+ authorName: "Nadia Kowalski",+ },+ {+ content: "Wednesday works best for most people it seems.",+ authorName: "Dev User",+ userId: "user-1",+ },+ ],+ },+ {+ title: "Car service appointment",+ description: "Oil change and tire rotation at Mike's Auto.",+ location: "Mike's Auto Shop, 234 Elm St",+ status: "scheduled",+ timeZone: "America/New_York",+ userId: "user-1",+ spaceId: "space-1",+ options: [+ { startTime: "2026-03-09T09:00:00Z", duration: 60 },+ { startTime: "2026-03-10T09:00:00Z", duration: 60 },+ { startTime: "2026-03-11T09:00:00Z", duration: 60 },+ ],+ participants: [+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "yes", "ifNeedBe"],+ },+ ],+ },+ {+ title: "Photography class",+ description:+ "Beginner landscape photography workshop at the community center.",+ status: "open",+ userId: "user-1",+ spaceId: "space-1",+ options: [+ { startTime: "2026-03-21T00:00:00Z", duration: 0 },+ { startTime: "2026-03-22T00:00:00Z", duration: 0 },+ { startTime: "2026-03-28T00:00:00Z", duration: 0 },+ ],+ participants: [+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "yes", "no"],+ },+ {+ name: "Mei Lin",+ email: "[email protected]",+ votes: ["yes", "no", "yes"],+ },+ {+ name: "Chris Anderson",+ email: "[email protected]",+ votes: ["no", "yes", "yes"],+ },+ ],+ },+ {+ title: "Birthday party venue",+ description:+ "Picking a weekend for the surprise party. Keep it secret from Jake!",+ status: "open",+ userId: "user-1",+ spaceId: "space-1",+ options: [+ { startTime: "2026-04-04T00:00:00Z", duration: 0 },+ { startTime: "2026-04-05T00:00:00Z", duration: 0 },+ { startTime: "2026-04-11T00:00:00Z", duration: 0 },+ { startTime: "2026-04-12T00:00:00Z", duration: 0 },+ ],+ participants: [+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "yes", "yes", "yes"],+ },+ {+ name: "Aisha Mohammed",+ email: "[email protected]",+ votes: ["yes", "no", "yes", "no"],+ },+ {+ name: "Tyler Brooks",+ email: "[email protected]",+ votes: ["no", "yes", "no", "yes"],+ },+ {+ name: "Hannah Kim",+ email: "[email protected]",+ votes: ["yes", "yes", "no", "ifNeedBe"],+ },+ {+ name: "Daniel Russo",+ email: "[email protected]",+ votes: ["yes", "ifNeedBe", "yes", "no"],+ },+ {+ name: "Sophie Turner",+ email: "[email protected]",+ votes: ["ifNeedBe", "yes", "yes", "yes"],+ },+ {+ name: "Ben Carter",+ email: "[email protected]",+ votes: ["yes", "yes", "no", "no"],+ },+ {+ name: "Nina Fernandez",+ email: "[email protected]",+ votes: ["yes", "no", "yes", "yes"],+ },+ ],+ comments: [+ {+ content: "Should we do a potluck or order catering?",+ authorName: "Aisha Mohammed",+ },+ {+ content: "Potluck sounds great! I can bring dessert.",+ authorName: "Hannah Kim",+ },+ {+ content: "I'll handle the decorations!",+ authorName: "Sophie Turner",+ },+ ],+ },+];++// ββ Acme Inc polls βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ++const acmePolls: PollDef[] = [+ {+ title: "Q2 Kickoff Meeting",+ description:+ "All-hands to review Q1 results and set Q2 objectives. Mandatory for all team leads.",+ status: "open",+ timeZone: "America/New_York",+ userId: "user-1",+ spaceId: "space-2",+ options: [+ { startTime: "2026-03-31T13:00:00Z", duration: 120 },+ { startTime: "2026-04-01T13:00:00Z", duration: 120 },+ { startTime: "2026-04-02T13:00:00Z", duration: 120 },+ { startTime: "2026-04-03T13:00:00Z", duration: 120 },+ ],+ participants: [+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "yes", "yes", "no"],+ },+ {+ name: "Sarah Chen",+ userId: "user-2",+ email: "[email protected]",+ votes: ["yes", "no", "yes", "yes"],+ },+ {+ name: "Michael Torres",+ userId: "user-3",+ email: "[email protected]",+ votes: ["yes", "yes", "no", "ifNeedBe"],+ },+ {+ name: "Emily Nakamura",+ userId: "user-4",+ email: "[email protected]",+ votes: ["no", "yes", "yes", "yes"],+ },+ {+ name: "James Okonkwo",+ userId: "user-5",+ email: "[email protected]",+ votes: ["yes", "ifNeedBe", "yes", "no"],+ },+ ],+ comments: [+ {+ content: "Can we allocate 30 min for the engineering roadmap section?",+ authorName: "Michael Torres",+ userId: "user-3",+ },+ ],+ },+ {+ title: "Design Review: Homepage Redesign",+ description:+ "Walking through the new homepage mockups. Please review the Figma link before the meeting.",+ status: "open",+ timeZone: "America/New_York",+ userId: "user-2",+ spaceId: "space-2",+ options: [+ { startTime: "2026-03-12T14:00:00Z", duration: 60 },+ { startTime: "2026-03-13T14:00:00Z", duration: 60 },+ { startTime: "2026-03-14T10:00:00Z", duration: 60 },+ ],+ participants: [+ {+ name: "Sarah Chen",+ userId: "user-2",+ email: "[email protected]",+ votes: ["yes", "yes", "yes"],+ },+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "ifNeedBe", "no"],+ },+ {+ name: "Emily Nakamura",+ userId: "user-4",+ email: "[email protected]",+ votes: ["no", "yes", "yes"],+ },+ {+ name: "Andrea Walsh",+ email: "[email protected]",+ votes: ["yes", "yes", "no"],+ },+ ],+ },+ {+ title: "Sprint Retrospective",+ description: "Reflecting on Sprint 14. What went well, what didn't.",+ status: "closed",+ timeZone: "America/New_York",+ userId: "user-3",+ spaceId: "space-2",+ options: [+ { startTime: "2026-03-06T15:00:00Z", duration: 60 },+ { startTime: "2026-03-06T16:00:00Z", duration: 60 },+ { startTime: "2026-03-09T15:00:00Z", duration: 60 },+ ],+ participants: [+ {+ name: "Michael Torres",+ userId: "user-3",+ email: "[email protected]",+ votes: ["yes", "yes", "yes"],+ },+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["no", "yes", "yes"],+ },+ {+ name: "Sarah Chen",+ userId: "user-2",+ email: "[email protected]",+ votes: ["yes", "no", "yes"],+ },+ {+ name: "James Okonkwo",+ userId: "user-5",+ email: "[email protected]",+ votes: ["ifNeedBe", "no", "yes"],+ },+ {+ name: "Emily Nakamura",+ userId: "user-4",+ email: "[email protected]",+ votes: ["no", "no", "yes"],+ },+ ],+ },+ {+ title: "Client Presentation Prep",+ description:+ "Final run-through before the Globex Corp pitch. Bring your slides.",+ status: "open",+ timeZone: "America/New_York",+ userId: "user-1",+ spaceId: "space-2",+ options: [+ { startTime: "2026-03-17T10:00:00Z", duration: 60 },+ { startTime: "2026-03-17T14:00:00Z", duration: 60 },+ { startTime: "2026-03-18T10:00:00Z", duration: 60 },+ { startTime: "2026-03-18T14:00:00Z", duration: 60 },+ { startTime: "2026-03-19T10:00:00Z", duration: 60 },+ ],+ participants: [+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "no", "yes", "yes", "ifNeedBe"],+ },+ {+ name: "Sarah Chen",+ userId: "user-2",+ email: "[email protected]",+ votes: ["yes", "yes", "no", "yes", "no"],+ },+ {+ name: "Michael Torres",+ userId: "user-3",+ email: "[email protected]",+ votes: ["no", "yes", "yes", "no", "yes"],+ },+ {+ name: "James Okonkwo",+ userId: "user-5",+ email: "[email protected]",+ votes: ["yes", "ifNeedBe", "yes", "no", "no"],+ },+ ],+ },+ {+ title: "Team Offsite Planning",+ description:+ "Picking a date for our spring team offsite. Thinking somewhere outdoors!",+ status: "open",+ userId: "user-1",+ spaceId: "space-2",+ options: [+ { startTime: "2026-04-14T00:00:00Z", duration: 0 },+ { startTime: "2026-04-15T00:00:00Z", duration: 0 },+ { startTime: "2026-04-21T00:00:00Z", duration: 0 },+ { startTime: "2026-04-22T00:00:00Z", duration: 0 },+ ],+ participants: [+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "yes", "yes", "no"],+ },+ {+ name: "Sarah Chen",+ userId: "user-2",+ email: "[email protected]",+ votes: ["yes", "yes", "no", "yes"],+ },+ {+ name: "Michael Torres",+ userId: "user-3",+ email: "[email protected]",+ votes: ["yes", "no", "yes", "yes"],+ },+ {+ name: "Emily Nakamura",+ userId: "user-4",+ email: "[email protected]",+ votes: ["no", "yes", "yes", "ifNeedBe"],+ },+ {+ name: "James Okonkwo",+ userId: "user-5",+ email: "[email protected]",+ votes: ["yes", "yes", "ifNeedBe", "no"],+ },+ {+ name: "Raj Gupta",+ email: "[email protected]",+ votes: ["yes", "no", "yes", "yes"],+ },+ ],+ comments: [+ {+ content: "How about that ropes course in the Catskills?",+ authorName: "James Okonkwo",+ userId: "user-5",+ },+ {+ content: "Love that idea! We could do a BBQ afterwards.",+ authorName: "Sarah Chen",+ userId: "user-2",+ },+ ],+ },+ {+ title: "1:1 with Sarah",+ description: "Weekly sync β career goals and project updates.",+ status: "open",+ timeZone: "America/New_York",+ userId: "user-1",+ spaceId: "space-2",+ options: [+ { startTime: "2026-03-11T15:00:00Z", duration: 30 },+ { startTime: "2026-03-12T15:00:00Z", duration: 30 },+ { startTime: "2026-03-13T15:00:00Z", duration: 30 },+ ],+ participants: [+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "yes", "ifNeedBe"],+ },+ {+ name: "Sarah Chen",+ userId: "user-2",+ email: "[email protected]",+ votes: ["no", "yes", "yes"],+ },+ ],+ },+ {+ title: "Engineering Standup Time Change",+ description:+ "Our current 9am ET standup doesn't work for everyone. Let's find a better slot.",+ status: "closed",+ timeZone: "America/New_York",+ userId: "user-3",+ spaceId: "space-2",+ options: [+ { startTime: "2026-03-10T13:00:00Z", duration: 15 },+ { startTime: "2026-03-10T13:30:00Z", duration: 15 },+ { startTime: "2026-03-10T14:00:00Z", duration: 15 },+ { startTime: "2026-03-10T14:30:00Z", duration: 15 },+ ],+ participants: [+ {+ name: "Michael Torres",+ userId: "user-3",+ email: "[email protected]",+ votes: ["yes", "yes", "yes", "yes"],+ },+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "yes", "ifNeedBe", "no"],+ },+ {+ name: "Emily Nakamura",+ userId: "user-4",+ email: "[email protected]",+ votes: ["no", "no", "yes", "yes"],+ },+ {+ name: "James Okonkwo",+ userId: "user-5",+ email: "[email protected]",+ votes: ["yes", "yes", "no", "no"],+ },+ {+ name: "Ana Costa",+ email: "[email protected]",+ votes: ["ifNeedBe", "yes", "yes", "no"],+ },+ ],+ },+ {+ title: "Product Roadmap Workshop",+ description:+ "Half-day session to align on H2 priorities. We'll use the RICE framework.",+ status: "open",+ timeZone: "America/New_York",+ userId: "user-2",+ spaceId: "space-2",+ options: [+ { startTime: "2026-03-19T13:00:00Z", duration: 180 },+ { startTime: "2026-03-20T13:00:00Z", duration: 180 },+ { startTime: "2026-03-21T13:00:00Z", duration: 180 },+ ],+ participants: [+ {+ name: "Sarah Chen",+ userId: "user-2",+ email: "[email protected]",+ votes: ["yes", "yes", "yes"],+ },+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "no", "ifNeedBe"],+ },+ {+ name: "Michael Torres",+ userId: "user-3",+ email: "[email protected]",+ votes: ["yes", "yes", "no"],+ },+ {+ name: "Emily Nakamura",+ userId: "user-4",+ email: "[email protected]",+ votes: ["no", "yes", "yes"],+ },+ {+ name: "James Okonkwo",+ userId: "user-5",+ email: "[email protected]",+ votes: ["yes", "ifNeedBe", "yes"],+ },+ ],+ },+ {+ title: "Quarterly Business Review",+ description:+ "Presenting Q1 numbers to leadership. Finance team please prepare slides by Thursday.",+ status: "scheduled",+ timeZone: "America/New_York",+ userId: "user-1",+ spaceId: "space-2",+ options: [+ { startTime: "2026-03-28T14:00:00Z", duration: 120 },+ { startTime: "2026-03-31T14:00:00Z", duration: 120 },+ { startTime: "2026-04-01T14:00:00Z", duration: 120 },+ { startTime: "2026-04-02T14:00:00Z", duration: 120 },+ ],+ participants: [+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "yes", "yes", "ifNeedBe"],+ },+ {+ name: "Sarah Chen",+ userId: "user-2",+ email: "[email protected]",+ votes: ["no", "yes", "yes", "yes"],+ },+ {+ name: "Michael Torres",+ userId: "user-3",+ email: "[email protected]",+ votes: ["yes", "no", "yes", "no"],+ },+ {+ name: "Carla Mendez",+ email: "[email protected]",+ votes: ["ifNeedBe", "yes", "no", "yes"],+ },+ {+ name: "Owen Bradley",+ email: "[email protected]",+ votes: ["yes", "yes", "no", "no"],+ },+ ],+ },+ {+ title: "Lunch & Learn: AI Tools",+ description:+ "Informal session on how we can use AI tools to speed up our workflow. Pizza provided!",+ location: "Conference Room B",+ status: "open",+ timeZone: "America/New_York",+ userId: "user-5",+ spaceId: "space-2",+ options: [+ { startTime: "2026-03-13T12:00:00Z", duration: 60 },+ { startTime: "2026-03-14T12:00:00Z", duration: 60 },+ { startTime: "2026-03-20T12:00:00Z", duration: 60 },+ ],+ participants: [+ {+ name: "James Okonkwo",+ userId: "user-5",+ email: "[email protected]",+ votes: ["yes", "yes", "yes"],+ },+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "no", "yes"],+ },+ {+ name: "Sarah Chen",+ userId: "user-2",+ email: "[email protected]",+ votes: ["yes", "yes", "no"],+ },+ {+ name: "Michael Torres",+ userId: "user-3",+ email: "[email protected]",+ votes: ["no", "yes", "yes"],+ },+ {+ name: "Emily Nakamura",+ userId: "user-4",+ email: "[email protected]",+ votes: ["yes", "ifNeedBe", "no"],+ },+ {+ name: "Derek Hoffman",+ email: "[email protected]",+ votes: ["ifNeedBe", "yes", "yes"],+ },+ ],+ comments: [+ {+ content: "Can we cover GitHub Copilot tips?",+ authorName: "Michael Torres",+ userId: "user-3",+ },+ {+ content: "I'd love to demo some prompt engineering techniques.",+ authorName: "James Okonkwo",+ userId: "user-5",+ },+ ],+ },+ {+ title: "Interview Panel: Senior Designer",+ description:+ "We have 3 candidates next week. Need at least 3 panelists per slot.",+ status: "open",+ timeZone: "America/New_York",+ requireParticipantEmail: true,+ userId: "user-2",+ spaceId: "space-2",+ options: [+ { startTime: "2026-03-18T14:00:00Z", duration: 90 },+ { startTime: "2026-03-19T14:00:00Z", duration: 90 },+ { startTime: "2026-03-20T14:00:00Z", duration: 90 },+ { startTime: "2026-03-21T14:00:00Z", duration: 90 },+ ],+ participants: [+ {+ name: "Sarah Chen",+ userId: "user-2",+ email: "[email protected]",+ votes: ["yes", "yes", "yes", "no"],+ },+ {+ name: "Dev User",+ userId: "user-1",+ email: "[email protected]",+ votes: ["yes", "no", "yes", "yes"],+ },+ {+ name: "Emily Nakamura",+ userId: "user-4",+ email: "[email protected]",+ votes: ["no", "yes", "no", "yes"],+ },+ {+ name: "Lena Novak",+ email: "[email protected]",+ votes: ["yes", "yes", "no", "ifNeedBe"],+ },+ ],+ },+ {+ title: "Holiday Party Planning",+ description:+ "It's never too early! Let's lock down a date so we can book the venue.",+ status: "open",+ userId: "user-4",+ spaceId: "space-2",+ options: [+ { startTime: "2026-12-12T00:00:00Z", duration: 0 },+ { startTime: "2026-12-13T00:00:00Z", duration: 0 },+ { startTime: "2026-12-19T00:00:00Z", duration: 0 },+ { startTime: "2026-12-20T00:00:00Z", duration: 0 },+ ],+ participants: [+ {+ name: "Emily Nakamura",+ userId: "user-4",+ email: "[email protected]",+ votes: ["yes", "yes", "yes", "yes"],+ },+ {+ name: "Dev User",+ userId: "user-1",+ votes: ["yes", "no", "yes", "ifNeedBe"],+ },+ {+ name: "Sarah Chen",+ userId: "user-2",+ email: "[email protected]",+ votes: ["yes", "yes", "no", "yes"],+ },+ {+ name: "Michael Torres",+ userId: "user-3",+ email: "[email protected]",+ votes: ["no", "yes", "yes", "yes"],+ },+ {+ name: "James Okonkwo",+ userId: "user-5",+ email: "[email protected]",+ votes: ["yes", "ifNeedBe", "yes", "no"],+ },+ {+ name: "Raj Gupta",+ email: "[email protected]",+ votes: ["yes", "yes", "no", "yes"],+ },+ {+ name: "Ana Costa",+ email: "[email protected]",+ votes: ["ifNeedBe", "yes", "yes", "yes"],+ },+ ],+ comments: [+ {+ content:+ "The rooftop bar on 8th Ave has availability for both December weekends.",+ authorName: "Emily Nakamura",+ userId: "user-4",+ },+ ],+ },+];++export const polls: PollDef[] = [...personalPolls, ...acmePolls];++// βββ Scheduled Events ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ++export type ScheduledEventDef = {+ title: string;+ description?: string;+ location?: string;+ status: ScheduledEventStatus;+ timeZone?: string;+ start: string;+ end: string;+ allDay: boolean;+ userId: string;+ spaceId: string;+ invites?: Array<{+ inviteeName: string;+ inviteeEmail: string;+ inviteeTimeZone?: string;+ inviteeId?: string;+ status: ScheduledEventInviteStatus;+ }>;+};++export const scheduledEvents: ScheduledEventDef[] = [+ // ββ Personal space events ββββββββββββββββββββββββββββββββββββββββββββββββββ+ {+ title: "Dentist Appointment",+ location: "Dr. Lee's Office, 45 Oak St",+ status: "confirmed",+ timeZone: "America/New_York",+ start: "2026-03-09T14:00:00Z",+ end: "2026-03-09T15:00:00Z",+ allDay: false,+ userId: "user-1",+ spaceId: "space-1",+ },+ {+ title: "Dinner with Mom",+ location: "Olive Garden, Paramus",+ status: "confirmed",+ timeZone: "America/New_York",+ start: "2026-03-14T18:00:00Z",+ end: "2026-03-14T20:00:00Z",+ allDay: false,+ userId: "user-1",+ spaceId: "space-1",+ },+ {+ title: "Weekend Hiking Trip",+ description: "Bear Mountain β meet at the trailhead parking lot at 8am.",+ status: "confirmed",+ timeZone: "America/New_York",+ start: "2026-03-15T00:00:00Z",+ end: "2026-03-16T00:00:00Z",+ allDay: true,+ userId: "user-1",+ spaceId: "space-1",+ invites: [+ {+ inviteeName: "Jordan Lee",+ inviteeEmail: "[email protected]",+ status: "accepted",+ },+ {+ inviteeName: "Priya Patel",+ inviteeEmail: "[email protected]",+ status: "accepted",+ },+ {+ inviteeName: "Marcus Johnson",+ inviteeEmail: "[email protected]",+ status: "declined",+ },+ ],+ },+ {+ title: "Book Club",+ description: "Discussing 'Project Hail Mary'.",+ location: "Public Library, Room 2B",+ status: "confirmed",+ timeZone: "America/New_York",+ start: "2026-03-18T19:00:00Z",+ end: "2026-03-18T20:30:00Z",+ allDay: false,+ userId: "user-1",+ spaceId: "space-1",+ invites: [+ {+ inviteeName: "Nadia Kowalski",+ inviteeEmail: "[email protected]",+ status: "accepted",+ },+ {+ inviteeName: "David Chen",+ inviteeEmail: "[email protected]",+ status: "tentative",+ },+ {+ inviteeName: "Rachel Green",+ inviteeEmail: "[email protected]",+ status: "accepted",+ },+ {+ inviteeName: "Sam Williams",+ inviteeEmail: "[email protected]",+ status: "pending",+ },+ ],+ },+ {+ title: "Car Service",+ location: "Mike's Auto Shop, 234 Elm St",+ status: "confirmed",+ timeZone: "America/New_York",+ start: "2026-03-10T09:00:00Z",+ end: "2026-03-10T10:00:00Z",+ allDay: false,+ userId: "user-1",+ spaceId: "space-1",+ },++ // ββ Acme Inc events ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ+ {+ title: "Sprint 14 Retrospective",+ description: "Reflecting on what went well and what to improve.",+ location: "Zoom",+ status: "confirmed",+ timeZone: "America/New_York",+ start: "2026-03-06T15:00:00Z",+ end: "2026-03-06T16:00:00Z",+ allDay: false,+ userId: "user-3",+ spaceId: "space-2",+ invites: [+ {+ inviteeName: "Dev User",+ inviteeEmail: "[email protected]",+ inviteeId: "user-1",+ inviteeTimeZone: "America/New_York",+ status: "accepted",+ },+ {+ inviteeName: "Sarah Chen",+ inviteeEmail: "[email protected]",+ inviteeId: "user-2",+ inviteeTimeZone: "America/Los_Angeles",+ status: "accepted",+ },+ {+ inviteeName: "Emily Nakamura",+ inviteeEmail: "[email protected]",+ inviteeId: "user-4",+ inviteeTimeZone: "Asia/Tokyo",+ status: "declined",+ },+ {+ inviteeName: "James Okonkwo",+ inviteeEmail: "[email protected]",+ inviteeId: "user-5",+ inviteeTimeZone: "America/Chicago",+ status: "accepted",+ },+ ],+ },+ {+ title: "Design Review: Homepage",+ description: "Review the latest homepage mockups in Figma.",+ location: "Conference Room A",+ status: "confirmed",+ timeZone: "America/New_York",+ start: "2026-03-12T14:00:00Z",+ end: "2026-03-12T15:00:00Z",+ allDay: false,+ userId: "user-2",+ spaceId: "space-2",+ invites: [+ {+ inviteeName: "Dev User",+ inviteeEmail: "[email protected]",+ inviteeId: "user-1",+ inviteeTimeZone: "America/New_York",+ status: "accepted",+ },+ {+ inviteeName: "Emily Nakamura",+ inviteeEmail: "[email protected]",+ inviteeId: "user-4",+ inviteeTimeZone: "Asia/Tokyo",+ status: "accepted",+ },+ ],+ },+ {+ title: "Client Presentation: Globex Corp",+ description: "Final pitch to the Globex leadership team.",+ location: "Globex HQ, 100 Innovation Blvd",+ status: "confirmed",+ timeZone: "America/New_York",+ start: "2026-03-20T10:00:00Z",+ end: "2026-03-20T11:30:00Z",+ allDay: false,+ userId: "user-1",+ spaceId: "space-2",+ invites: [+ {+ inviteeName: "Sarah Chen",+ inviteeEmail: "[email protected]",+ inviteeId: "user-2",+ inviteeTimeZone: "America/Los_Angeles",+ status: "accepted",+ },+ {+ inviteeName: "Michael Torres",+ inviteeEmail: "[email protected]",+ inviteeId: "user-3",+ inviteeTimeZone: "Europe/London",+ status: "accepted",+ },+ {+ inviteeName: "James Okonkwo",+ inviteeEmail: "[email protected]",+ inviteeId: "user-5",+ inviteeTimeZone: "America/Chicago",+ status: "tentative",+ },+ ],+ },+ {+ title: "Team Offsite",+ description: "Spring team-building day at the Catskills ropes course.",+ status: "confirmed",+ timeZone: "America/New_York",+ start: "2026-04-15T00:00:00Z",+ end: "2026-04-16T00:00:00Z",+ allDay: true,+ userId: "user-1",+ spaceId: "space-2",+ invites: [+ {+ inviteeName: "Sarah Chen",+ inviteeEmail: "[email protected]",+ inviteeId: "user-2",+ status: "accepted",+ },+ {+ inviteeName: "Michael Torres",+ inviteeEmail: "[email protected]",+ inviteeId: "user-3",+ status: "accepted",+ },+ {+ inviteeName: "Emily Nakamura",+ inviteeEmail: "[email protected]",+ inviteeId: "user-4",+ status: "accepted",+ },+ {+ inviteeName: "James Okonkwo",+ inviteeEmail: "[email protected]",+ inviteeId: "user-5",+ status: "pending",+ },+ ],+ },+ {+ title: "Lunch & Learn: AI Tools",+ description: "Exploring AI productivity tools. Pizza provided!",+ location: "Conference Room B",+ status: "confirmed",+ timeZone: "America/New_York",+ start: "2026-03-13T12:00:00Z",+ end: "2026-03-13T13:00:00Z",+ allDay: false,+ userId: "user-5",+ spaceId: "space-2",+ invites: [+ {+ inviteeName: "Dev User",+ inviteeEmail: "[email protected]",+ inviteeId: "user-1",+ status: "accepted",+ },+ {+ inviteeName: "Sarah Chen",+ inviteeEmail: "[email protected]",+ inviteeId: "user-2",+ status: "accepted",+ },+ {+ inviteeName: "Michael Torres",+ inviteeEmail: "[email protected]",+ inviteeId: "user-3",+ status: "accepted",+ },+ {+ inviteeName: "Emily Nakamura",+ inviteeEmail: "[email protected]",+ inviteeId: "user-4",+ status: "tentative",+ },+ ],+ },+ {+ title: "Q2 Kickoff",+ description: "All-hands to review Q1 and set Q2 objectives.",+ location: "Main Conference Room",+ status: "confirmed",+ timeZone: "America/New_York",+ start: "2026-04-01T13:00:00Z",+ end: "2026-04-01T15:00:00Z",+ allDay: false,+ userId: "user-1",+ spaceId: "space-2",+ invites: [+ {+ inviteeName: "Sarah Chen",+ inviteeEmail: "[email protected]",+ inviteeId: "user-2",+ status: "accepted",+ },+ {+ inviteeName: "Michael Torres",+ inviteeEmail: "[email protected]",+ inviteeId: "user-3",+ status: "accepted",+ },+ {+ inviteeName: "Emily Nakamura",+ inviteeEmail: "[email protected]",+ inviteeId: "user-4",+ status: "accepted",+ },+ {+ inviteeName: "James Okonkwo",+ inviteeEmail: "[email protected]",+ inviteeId: "user-5",+ status: "accepted",+ },+ ],+ },+ {+ title: "Engineering All-Hands",+ description: "Monthly engineering department sync.",+ status: "canceled",+ timeZone: "America/New_York",+ start: "2026-03-07T17:00:00Z",+ end: "2026-03-07T18:00:00Z",+ allDay: false,+ userId: "user-3",+ spaceId: "space-2",+ invites: [+ {+ inviteeName: "Dev User",+ inviteeEmail: "[email protected]",+ inviteeId: "user-1",+ status: "accepted",+ },+ {+ inviteeName: "Emily Nakamura",+ inviteeEmail: "[email protected]",+ inviteeId: "user-4",+ status: "accepted",+ },+ ],+ },+ {+ title: "Product Roadmap Workshop",+ description:+ "Half-day session to align on H2 priorities using RICE framework.",+ location: "Conference Room A",+ status: "confirmed",+ timeZone: "America/New_York",+ start: "2026-03-19T13:00:00Z",+ end: "2026-03-19T16:00:00Z",+ allDay: false,+ userId: "user-2",+ spaceId: "space-2",+ invites: [+ {+ inviteeName: "Dev User",+ inviteeEmail: "[email protected]",+ inviteeId: "user-1",+ status: "accepted",+ },+ {+ inviteeName: "Michael Torres",+ inviteeEmail: "[email protected]",+ inviteeId: "user-3",+ status: "accepted",+ },+ {+ inviteeName: "Emily Nakamura",+ inviteeEmail: "[email protected]",+ inviteeId: "user-4",+ status: "accepted",+ },+ {+ inviteeName: "James Okonkwo",+ inviteeEmail: "[email protected]",+ inviteeId: "user-5",+ status: "tentative",+ },+ ],+ },+];diff --git a/packages/database/prisma/seed/polls.ts b/packages/database/prisma/seed/polls.tsdeleted file mode 100644index da64811ee..000000000--- a/packages/database/prisma/seed/polls.ts+++ /dev/null@@ -1,321 +0,0 @@-import { faker } from "@faker-js/faker";-import { prisma } from "@rallly/database";-import dayjs from "dayjs";-import type { VoteType } from "../../generated/prisma/client";--import { randInt } from "./utils";--function generateTitle() {- const titleTemplates = [- () => `${faker.company.catchPhrase()} Meeting`,- () => `${faker.commerce.department()} Team Sync`,- () => `Q${faker.datatype.number({ min: 1, max: 4 })} Planning`,- () => `${faker.name.jobArea()} Workshop`,- () => `Project ${faker.word.adjective()} Update`,- () => `${faker.company.bsBuzz()} Strategy Session`,- () => faker.company.catchPhrase(),- () => `${faker.name.jobType()} Interview`,- () => `${faker.commerce.productAdjective()} Product Review`,- () => `Team ${faker.word.verb()} Day`,- // More team-focused titles- () => "Weekly All-Hands Meeting",- () => "Sprint Planning Session",- () => "Product Roadmap Discussion",- () => "Team Building Event",- () => "Client Presentation Review",- () => "Budget Planning Meeting",- () => "New Feature Brainstorming",- () => "Performance Review Check-in",- () => "Company Town Hall",- () => "Training Workshop Session",- ];-- return faker.helpers.arrayElement(titleTemplates)();-}--// Function to generate realistic descriptions-function generateDescription() {- const descriptions = [- "Discuss the quarterly results and strategize for the upcoming quarter. Please come prepared with your reports.",- "Team meeting to align on project goals and timelines. Bring your ideas and feedback.",- "An informal catch-up to discuss ongoing projects and any roadblocks. Open to all team members.",- "Monthly review of our marketing strategies and performance metrics. Let's brainstorm new ideas.",- "A brief meeting to go over the new software updates and how they will impact our workflow.",- "Discussion on the upcoming product launch and marketing strategies. Your input is valuable!",- "Weekly sync to check in on project progress and address any concerns. Please be on time.",- "A brainstorming session for the new campaign. All creative minds are welcome!",- "Review of the last sprint and planning for the next one. Let's ensure we're on track.",- "An open forum for team members to share updates and challenges. Everyone is encouraged to speak up.",- // More team-focused descriptions- "Company-wide meeting to discuss strategic initiatives and answer questions from all departments.",- "Planning session for the next sprint cycle. We'll review backlog items and set priorities.",- "Review our product roadmap and get alignment on upcoming features and releases.",- "Fun team activity to improve collaboration and build stronger relationships across departments.",- "Preparation meeting for the upcoming client presentation. Let's align on key messaging.",- "Annual budget planning session to discuss resource allocation for the next fiscal year.",- "Creative session to generate ideas for the new product feature. All perspectives welcome!",- "Regular one-on-one meetings to discuss performance, goals, and career development.",- "Quarterly company update covering financial performance, new hires, and strategic direction.",- "Hands-on workshop to develop new skills and improve team capabilities.",- ];-- // Randomly select a description- return faker.helpers.arrayElement(descriptions);-}--async function addTeamParticipantsToPolls() {- console.info("Adding team members as participants to polls...");-- // Get all team members- const teamMembers = await prisma.user.findMany({- where: {- id: {- in: [- "team-owner",- "team-admin",- "team-member-1",- "team-member-2",- "team-member-3",- ],- },- },- });-- // Get team space polls- const teamPolls = await prisma.poll.findMany({- where: {- spaceId: "team-space-1",- },- include: {- options: true,- participants: true,- },- });-- // Add team members as participants to some polls- for (const poll of teamPolls) {- // Skip if poll already has team participants- const existingTeamParticipants = poll.participants.filter((p) =>- teamMembers.some((tm) => tm.email === p.email),- );-- if (existingTeamParticipants.length > 0) continue;-- // Add 2-4 random team members as participants- const numParticipants = randInt(3, 2);- const selectedMembers = faker.helpers.arrayElements(- teamMembers,- numParticipants,- );-- for (const member of selectedMembers) {- const participant = await prisma.participant.create({- data: {- pollId: poll.id,- name: member.name,- email: member.email,- },- });-- // Add votes for this participant- const voteData = poll.options.map((option) => ({- id: faker.random.alpha(10),- optionId: option.id,- participantId: participant.id,- pollId: poll.id,- type: faker.helpers.arrayElement(["yes", "no", "ifNeedBe"]) as VoteType,- }));-- if (voteData.length > 0) {- await prisma.vote.createMany({- data: voteData,- });- }- }- }-- console.info("β Added team participation to polls");-}--async function createPollForUser({- userId,- spaceId,-}: {- userId: string;- spaceId: string;-}) {- const duration = 60 * randInt(8);- let cursor = dayjs().add(randInt(30), "day").second(0).minute(0);- const numberOfOptions = randInt(5, 2); // Reduced for realism-- const poll = await prisma.poll.create({- include: {- participants: true,- options: true,- },- data: {- id: faker.random.alpha(10),- title: generateTitle(),- description: generateDescription(),- location: faker.address.streetAddress(),- deadline: faker.date.future(),- user: {- connect: {- id: userId,- },- },- space: {- connect: {- id: spaceId,- },- },- status: faker.helpers.arrayElement([- "open",- "closed",- "scheduled",- "canceled",- ]),- timeZone: duration !== 0 ? "Europe/London" : undefined,- options: {- create: Array.from({ length: numberOfOptions }).map(() => {- const startTime = cursor.toDate();- cursor = cursor.add(randInt(72, 1), "hour");- return {- startTime,- duration,- };- }),- },- participants: {- create: Array.from({ length: randInt(10) }).map(() => ({- name: faker.name.fullName(),- email: faker.internet.email(),- })),- },- adminUrlId: faker.random.alpha(10),- participantUrlId: faker.random.alpha(10),- },- });-- // Generate vote data for all participants and options- const voteData = poll.participants.flatMap((participant) =>- poll.options.map((option) => ({- id: faker.random.alpha(10),- optionId: option.id,- participantId: participant.id,- pollId: poll.id,- type: faker.helpers.arrayElement(["yes", "no", "ifNeedBe"]) as VoteType,- })),- );-- // Create all votes in a single query- if (voteData.length > 0) {- await prisma.vote.createMany({- data: voteData,- });- }-- return poll;-}--async function seedTeamPolls() {- console.info("Seeding team polls...");- const teamSpace = await prisma.space.findUnique({- where: { id: "team-space-1" },- include: {- members: {- include: { user: true },- },- },- });-- if (!teamSpace) {- console.warn("Team space not found, skipping team polls");- return;- }-- // Create more realistic team polls- const teamPollPromises = [- // Owner creates strategic polls- ...Array.from({ length: 8 }).map(() =>- createPollForUser({- userId: "team-owner",- spaceId: teamSpace.id,- }),- ),- // Admin creates operational polls- ...Array.from({ length: 6 }).map(() =>- createPollForUser({- userId: "team-admin",- spaceId: teamSpace.id,- }),- ),- // Members create various polls- ...Array.from({ length: 4 }).map(() =>- createPollForUser({- userId: "team-member-1",- spaceId: teamSpace.id,- }),- ),- ...Array.from({ length: 3 }).map(() =>- createPollForUser({- userId: "team-member-2",- spaceId: teamSpace.id,- }),- ),- ...Array.from({ length: 2 }).map(() =>- createPollForUser({- userId: "team-member-3",- spaceId: teamSpace.id,- }),- ),- ];-- await Promise.all(teamPollPromises);- console.info(`β Seeded ${teamPollPromises.length} team polls`);-- // Add cross-team participation- await addTeamParticipantsToPolls();-}--export async function seedPolls(userId: string) {- console.info(`Seeding polls for user ${userId}...`);-- // Handle team space separately- if (userId === "team-owner") {- await seedTeamPolls();- return;- }-- // Skip other team members as they're handled in team polling- const teamMemberIds = [- "team-admin",- "team-member-1",- "team-member-2",- "team-member-3",- ];- if (teamMemberIds.includes(userId)) {- console.info(- `Skipping individual polls for team member ${userId} (included in team polls)`,- );- return;- }-- const space = await prisma.space.findFirst({- where: {- ownerId: userId,- },- });-- if (!space) {- throw new Error(`No space found for user ${userId}`);- }-- const pollPromises = Array.from({ length: 20 }).map(() =>- createPollForUser({ userId, spaceId: space.id }),- );-- await Promise.all(pollPromises);-- console.info(`β Seeded polls for ${userId}`);-}diff --git a/packages/database/prisma/seed/scheduled-events.ts b/packages/database/prisma/seed/scheduled-events.tsdeleted file mode 100644index 58eecd0ac..000000000--- a/packages/database/prisma/seed/scheduled-events.ts+++ /dev/null@@ -1,243 +0,0 @@-import { faker } from "@faker-js/faker";-import { prisma } from "@rallly/database";-import dayjs from "dayjs";-import type { ScheduledEventInviteStatus } from "../../generated/prisma/client";-import { ScheduledEventStatus } from "../../generated/prisma/client";-import { randInt } from "./utils";--// Realistic event titles and descriptions-function generateEventDetails() {- const titles = [- "Team Sync Meeting",- "Product Strategy Session",- "Design Review",- "Engineering Standup",- "Client Check-in Call",- "Marketing Campaign Kickoff",- "Sales Pipeline Review",- "HR Training Workshop",- "Finance Budget Planning",- "All Hands Company Update",- "Sprint Retrospective",- "User Research Debrief",- "Technical Deep Dive",- "Content Calendar Planning",- "Partnership Discussion",- ];- const descriptions = [- "Discussing project updates and blockers.",- "Aligning on the product roadmap for the next quarter.",- "Gathering feedback on the latest UI mockups.",- "Quick daily updates from the engineering team.",- "Reviewing progress and addressing client concerns.",- "Launching the new social media campaign.",- "Analyzing the current sales funnel and opportunities.",- "Mandatory compliance training session.",- "Meeting to finalize budget decisions across different departments.",- "Sharing company performance and upcoming goals.",- "Reflecting on the past sprint, celebrating successes, and identifying areas for improvement.",- "Sharing key insights gathered from recent user research sessions.",- "Exploring the architecture of the new microservice.",- "Planning blog posts and social media content for the month.",- "Exploring potential collaboration opportunities with external partners.",- "Team building activity to foster collaboration.",- "Workshop on improving presentation skills.",- "Onboarding session for new hires.",- "Reviewing customer feedback and planning improvements.",- "Brainstorming session for new feature ideas.",- ];-- return {- title: faker.helpers.arrayElement(titles),- description: faker.helpers.arrayElement(descriptions),- };-}--async function createScheduledEventForUser({- userId,- spaceId,-}: {- userId: string;- spaceId: string;-}) {- const { title, description } = generateEventDetails();- const isAllDay = Math.random() < 0.3; // ~30% chance of being all-day-- let startTime: Date;- let endTime: Date | null;-- if (isAllDay) {- const startDate = dayjs(- faker.datatype.boolean() ? faker.date.past(1) : faker.date.soon(30),- )- .startOf("day")- .toDate();- startTime = startDate;-- // Decide if it's a multi-day event- const isMultiDay = Math.random() < 0.2; // ~20% chance of multi-day- if (isMultiDay) {- const durationDays = faker.datatype.number({ min: 1, max: 3 });- // End date is the start of the day *after* the last full day- endTime = dayjs(startDate)- .add(durationDays + 1, "day")- .toDate();- } else {- // Single all-day event ends at the start of the next day- endTime = dayjs(startDate).add(1, "day").toDate();- }- } else {- // Generate times for non-all-day events- startTime = dayjs(- faker.datatype.boolean() ? faker.date.past(1) : faker.date.soon(30),- )- .second(faker.helpers.arrayElement([0, 15, 30, 45])) // Add some variance- .minute(faker.helpers.arrayElement([0, 15, 30, 45]))- .hour(faker.datatype.number({ min: 8, max: 20 })) // Wider range for hours- .toDate();- const durationMinutes = faker.helpers.arrayElement([30, 60, 90, 120, 180]); // Longer durations possible- endTime = dayjs(startTime).add(durationMinutes, "minute").toDate();- }-- // Use only valid statuses from the schema- const status = faker.helpers.arrayElement<ScheduledEventStatus>([- ScheduledEventStatus.confirmed,- ScheduledEventStatus.canceled,- ]);- const timeZone = faker.address.timeZone();-- await prisma.scheduledEvent.create({- data: {- title,- uid: faker.datatype.uuid(),- description,- start: startTime, // Use correct model field name 'start'- end: endTime, // Use correct model field name 'end'- timeZone,- status, // Assign the randomly selected valid status- user: {- connect: { id: userId },- }, // Connect to existing user- space: {- connect: { id: spaceId },- },- allDay: isAllDay,- location: faker.datatype.boolean()- ? faker.address.streetAddress()- : undefined,- // Add invites (optional, example below)- invites: {- create: Array.from({ length: randInt(5, 0) }).map(() => ({- inviteeEmail: faker.internet.email(),- inviteeName: faker.name.fullName(),- inviteeTimeZone: faker.address.timeZone(),- status: faker.helpers.arrayElement<ScheduledEventInviteStatus>([- "accepted",- "declined",- "tentative",- "pending",- ]),- })),- },- },- });-}--async function seedTeamEvents() {- console.info("Seeding team scheduled events...");- const teamSpace = await prisma.space.findUnique({- where: { id: "team-space-1" },- include: {- members: {- include: { user: true },- },- },- });-- if (!teamSpace) {- console.warn("Team space not found, skipping team events");- return;- }-- // Create events from different team members- const teamEventPromises = [- // Owner creates important company events- ...Array.from({ length: 12 }).map(() =>- createScheduledEventForUser({- userId: "team-owner",- spaceId: teamSpace.id,- }),- ),- // Admin creates operational events- ...Array.from({ length: 10 }).map(() =>- createScheduledEventForUser({- userId: "team-admin",- spaceId: teamSpace.id,- }),- ),- // Members create department/project events- ...Array.from({ length: 6 }).map(() =>- createScheduledEventForUser({- userId: "team-member-1",- spaceId: teamSpace.id,- }),- ),- ...Array.from({ length: 5 }).map(() =>- createScheduledEventForUser({- userId: "team-member-2",- spaceId: teamSpace.id,- }),- ),- ...Array.from({ length: 4 }).map(() =>- createScheduledEventForUser({- userId: "team-member-3",- spaceId: teamSpace.id,- }),- ),- ];-- await Promise.all(teamEventPromises);- console.info(`β Seeded ${teamEventPromises.length} team events`);-}--export async function seedScheduledEvents(userId: string) {- console.info(`Seeding scheduled events for user ${userId}...`);-- // Handle team space separately- if (userId === "team-owner") {- await seedTeamEvents();- return;- }-- // Skip other team members as they're handled in team events- const teamMemberIds = [- "team-admin",- "team-member-1",- "team-member-2",- "team-member-3",- ];- if (teamMemberIds.includes(userId)) {- console.info(- `Skipping individual events for team member ${userId} (included in team events)`,- );- return;- }-- const space = await prisma.space.findFirst({- where: {- ownerId: userId,- },- });-- if (!space) {- throw new Error(`No space found for user ${userId}`);- }-- const eventPromises = Array.from({ length: 15 }).map(() =>- createScheduledEventForUser({ userId, spaceId: space.id }),- );-- await Promise.all(eventPromises);-- console.info(`β Seeded scheduled events for ${userId}`);-}diff --git a/packages/database/prisma/seed/users.ts b/packages/database/prisma/seed/users.tsdeleted file mode 100644index 1db6366db..000000000--- a/packages/database/prisma/seed/users.ts+++ /dev/null@@ -1,189 +0,0 @@-import { prisma } from "@rallly/database";--async function createUser({- id,- name,- email,- timeZone,- space,-}: {- id: string;- name: string;- email: string;- timeZone: string;- space: {- id: string;- name: string;- isPro: boolean;- };-}) {- const user = await prisma.user.create({- data: {- id,- name,- email,- timeZone,- spaces: {- create: {- id: space.id,- name: space.name,- tier: space.isPro ? "pro" : "hobby",- },- },- },- });-- await prisma.spaceMember.create({- data: {- spaceId: space.id,- userId: id,- role: "ADMIN",- },- });-- return user;-}--async function createTeamSpace() {- console.info("Creating team space...");-- // Create team owner first- const teamOwner = await prisma.user.create({- data: {- id: "team-owner",- name: "Sarah Johnson",- email: "[email protected]",- timeZone: "America/New_York",- },- });-- // Then create the team space- const teamSpace = await prisma.space.create({- data: {- id: "team-space-1",- name: "Acme Corp Team",- ownerId: teamOwner.id,- tier: "pro",- },- });-- const teamMembers = await Promise.all([- prisma.user.create({- data: {- id: "team-admin",- name: "Michael Chen",- email: "[email protected]",- timeZone: "America/Los_Angeles",- },- }),- prisma.user.create({- data: {- id: "team-member-1",- name: "Emily Rodriguez",- email: "[email protected]",- timeZone: "America/Chicago",- },- }),- prisma.user.create({- data: {- id: "team-member-2",- name: "James Wilson",- email: "[email protected]",- timeZone: "Europe/London",- },- }),- prisma.user.create({- data: {- id: "team-member-3",- name: "Lisa Park",- email: "[email protected]",- timeZone: "Asia/Tokyo",- },- }),- ]);-- // Add team members to space with different roles- await Promise.all([- prisma.spaceMember.create({- data: {- spaceId: teamSpace.id,- userId: teamOwner.id,- role: "ADMIN",- lastSelectedAt: new Date(),- },- }),- prisma.spaceMember.create({- data: {- spaceId: teamSpace.id,- userId: "team-admin",- role: "ADMIN",- lastSelectedAt: new Date(),- },- }),- prisma.spaceMember.create({- data: {- spaceId: teamSpace.id,- userId: "team-member-1",- role: "MEMBER",- lastSelectedAt: new Date(),- },- }),- prisma.spaceMember.create({- data: {- spaceId: teamSpace.id,- userId: "team-member-2",- role: "MEMBER",- lastSelectedAt: new Date(),- },- }),- prisma.spaceMember.create({- data: {- spaceId: teamSpace.id,- userId: "team-member-3",- role: "MEMBER",- lastSelectedAt: new Date(),- },- }),- ]);-- console.info(- `β Seeded team space with ${[teamOwner, ...teamMembers].length} members`,- );-- return [teamOwner, ...teamMembers];-}--export async function seedUsers() {- console.info("Seeding users...");- const freeUser = await createUser({- id: "free-user",- name: "Dev User",- email: "[email protected]",- timeZone: "America/New_York",- space: {- id: "space-1",- name: "Personal",- isPro: false,- },- });-- const proUser = await createUser({- id: "pro-user",- name: "Pro User",- email: "[email protected]",- timeZone: "America/New_York",- space: {- id: "space-2",- name: "Personal",- isPro: true,- },- });-- // Create team space with multiple members- const teamMembers = await createTeamSpace();-- console.info(`β Seeded user ${freeUser.email}`);- console.info(`β Seeded user ${proUser.email}`);-- return [freeUser, proUser, ...teamMembers];-}diff --git a/packages/database/prisma/seed/utils.ts b/packages/database/prisma/seed/utils.tsdeleted file mode 100644index f52845038..000000000--- a/packages/database/prisma/seed/utils.ts+++ /dev/null@@ -1,9 +0,0 @@-/**- * Generates a random integer between floor and max (inclusive).- * @param max The maximum value.- * @param floor The minimum value (default: 0).- * @returns A random integer.- */-export const randInt = (max = 1, floor = 0): number => {- return Math.round(Math.random() * max) + floor;-};