Event fixes
This commit is contained in:
parent
707447fc88
commit
19d519b153
5 changed files with 696 additions and 606 deletions
|
|
@ -3,192 +3,548 @@ import Member from '../server/models/member.js'
|
|||
import { connectDB } from '../server/utils/mongoose.js'
|
||||
import dotenv from 'dotenv'
|
||||
|
||||
// Load environment variables
|
||||
dotenv.config()
|
||||
|
||||
const COOPERATIVE_SLUGS = [
|
||||
'governance', 'finance-and-budgeting', 'legal-structures', 'conflict-resolution',
|
||||
'consensus-decision-making', 'revenue-sharing', 'cooperative-bylaws', 'member-onboarding',
|
||||
'democratic-management', 'worker-ownership', 'platform-cooperativism', 'cooperative-marketing',
|
||||
'shared-resources', 'cooperative-funding', 'community-building', 'equity-and-inclusion',
|
||||
'cooperative-tech', 'sustainability', 'collective-bargaining', 'inter-coop-collaboration',
|
||||
]
|
||||
|
||||
const CRAFT_SLUGS = [
|
||||
'game-design', 'programming', 'narrative-design', 'art-and-animation',
|
||||
'audio-and-music', 'production-management', 'qa-and-testing', 'community-management',
|
||||
'marketing-and-comms', 'ux-and-ui-design', 'business-development', 'devops-and-tools',
|
||||
'localization', 'accessibility', 'analytics-and-data', 'education-and-mentoring',
|
||||
]
|
||||
|
||||
const AVATARS = ['disbelieving', 'double-take', 'exasperated', 'mild', 'sweet', 'wtf']
|
||||
const STATES = ['help', 'interested', 'seeking']
|
||||
|
||||
function pick(arr, n) {
|
||||
const shuffled = [...arr].sort(() => Math.random() - 0.5)
|
||||
return shuffled.slice(0, n)
|
||||
}
|
||||
|
||||
function randomState() {
|
||||
return STATES[Math.floor(Math.random() * STATES.length)]
|
||||
}
|
||||
|
||||
const sampleMembers = [
|
||||
{
|
||||
email: 'alex.rivera@pixelcollective.coop',
|
||||
name: 'Alex Rivera',
|
||||
circle: 'founder',
|
||||
contributionTier: '50',
|
||||
status: 'active',
|
||||
avatar: 'sweet',
|
||||
slackInvited: true,
|
||||
craftTags: ['game-design', 'production-management', 'business-development'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'governance', state: 'help' },
|
||||
{ tagSlug: 'revenue-sharing', state: 'help' },
|
||||
{ tagSlug: 'worker-ownership', state: 'interested' },
|
||||
{ tagSlug: 'cooperative-bylaws', state: 'help' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'alex.rivera',
|
||||
},
|
||||
createdAt: new Date('2024-01-15'),
|
||||
lastLogin: new Date('2025-08-20')
|
||||
lastLogin: new Date('2026-04-10'),
|
||||
},
|
||||
{
|
||||
email: 'sam.chen@legalcoop.com',
|
||||
name: 'Sam Chen',
|
||||
circle: 'practitioner',
|
||||
contributionTier: '30',
|
||||
status: 'active',
|
||||
avatar: 'mild',
|
||||
slackInvited: true,
|
||||
craftTags: ['business-development', 'marketing-and-comms'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'legal-structures', state: 'help' },
|
||||
{ tagSlug: 'cooperative-bylaws', state: 'help' },
|
||||
{ tagSlug: 'governance', state: 'interested' },
|
||||
{ tagSlug: 'conflict-resolution', state: 'help' },
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'sam.chen',
|
||||
},
|
||||
createdAt: new Date('2024-02-03'),
|
||||
lastLogin: new Date('2025-08-18')
|
||||
lastLogin: new Date('2026-04-08'),
|
||||
},
|
||||
{
|
||||
email: 'maria.garcia@collectivegames.coop',
|
||||
name: 'Maria Garcia',
|
||||
circle: 'founder',
|
||||
contributionTier: '50',
|
||||
status: 'active',
|
||||
avatar: 'double-take',
|
||||
helcimCustomerId: 'cust_12345',
|
||||
helcimSubscriptionId: 'sub_67890',
|
||||
slackInvited: true,
|
||||
craftTags: ['programming', 'devops-and-tools', 'game-design', 'qa-and-testing'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'cooperative-tech', state: 'help' },
|
||||
{ tagSlug: 'platform-cooperativism', state: 'interested' },
|
||||
{ tagSlug: 'shared-resources', state: 'help' },
|
||||
{ tagSlug: 'democratic-management', state: 'seeking' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'maria.g',
|
||||
},
|
||||
createdAt: new Date('2024-03-10'),
|
||||
lastLogin: new Date('2025-08-25')
|
||||
lastLogin: new Date('2026-04-12'),
|
||||
},
|
||||
{
|
||||
email: 'david.park@impactinvest.org',
|
||||
name: 'David Park',
|
||||
circle: 'practitioner',
|
||||
contributionTier: '30',
|
||||
status: 'active',
|
||||
avatar: 'exasperated',
|
||||
slackInvited: true,
|
||||
craftTags: ['business-development', 'analytics-and-data'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'cooperative-funding', state: 'help' },
|
||||
{ tagSlug: 'finance-and-budgeting', state: 'help' },
|
||||
{ tagSlug: 'sustainability', state: 'interested' },
|
||||
{ tagSlug: 'revenue-sharing', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'david.park',
|
||||
},
|
||||
createdAt: new Date('2024-04-12'),
|
||||
lastLogin: new Date('2025-08-22')
|
||||
lastLogin: new Date('2026-04-09'),
|
||||
},
|
||||
{
|
||||
email: 'jennifer.wu@grantspecialist.org',
|
||||
name: 'Jennifer Wu',
|
||||
circle: 'practitioner',
|
||||
contributionTier: '15',
|
||||
status: 'active',
|
||||
avatar: 'disbelieving',
|
||||
slackInvited: true,
|
||||
craftTags: ['education-and-mentoring', 'community-management'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'cooperative-funding', state: 'help' },
|
||||
{ tagSlug: 'community-building', state: 'help' },
|
||||
{ tagSlug: 'member-onboarding', state: 'interested' },
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'help' },
|
||||
],
|
||||
offerPeerSupport: false,
|
||||
},
|
||||
createdAt: new Date('2024-05-08'),
|
||||
lastLogin: new Date('2025-08-19')
|
||||
lastLogin: new Date('2026-04-05'),
|
||||
},
|
||||
{
|
||||
email: 'jordan.lee@indiedev.com',
|
||||
name: 'Jordan Lee',
|
||||
circle: 'community',
|
||||
contributionTier: '15',
|
||||
slackInvited: false,
|
||||
status: 'active',
|
||||
avatar: 'wtf',
|
||||
slackInvited: true,
|
||||
craftTags: ['programming', 'game-design', 'audio-and-music'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'worker-ownership', state: 'seeking' },
|
||||
{ tagSlug: 'governance', state: 'seeking' },
|
||||
{ tagSlug: 'cooperative-tech', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'jordan.lee',
|
||||
},
|
||||
createdAt: new Date('2024-06-20'),
|
||||
lastLogin: new Date('2025-08-15')
|
||||
lastLogin: new Date('2026-04-07'),
|
||||
},
|
||||
{
|
||||
email: 'taylor.smith@gamemaker.studio',
|
||||
name: 'Taylor Smith',
|
||||
circle: 'community',
|
||||
contributionTier: '5',
|
||||
status: 'active',
|
||||
avatar: 'sweet',
|
||||
slackInvited: true,
|
||||
craftTags: ['art-and-animation', 'ux-and-ui-design', 'accessibility'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'interested' },
|
||||
{ tagSlug: 'community-building', state: 'seeking' },
|
||||
{ tagSlug: 'consensus-decision-making', state: 'seeking' },
|
||||
],
|
||||
offerPeerSupport: false,
|
||||
},
|
||||
createdAt: new Date('2024-07-15'),
|
||||
lastLogin: new Date('2025-08-10')
|
||||
lastLogin: new Date('2026-04-01'),
|
||||
},
|
||||
{
|
||||
email: 'casey.wong@studiocoop.dev',
|
||||
name: 'Casey Wong',
|
||||
circle: 'founder',
|
||||
contributionTier: '30',
|
||||
status: 'active',
|
||||
avatar: 'mild',
|
||||
helcimCustomerId: 'cust_54321',
|
||||
slackInvited: true,
|
||||
craftTags: ['programming', 'devops-and-tools', 'production-management'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'cooperative-tech', state: 'help' },
|
||||
{ tagSlug: 'shared-resources', state: 'help' },
|
||||
{ tagSlug: 'platform-cooperativism', state: 'help' },
|
||||
{ tagSlug: 'democratic-management', state: 'interested' },
|
||||
{ tagSlug: 'inter-coop-collaboration', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'casey.w',
|
||||
},
|
||||
createdAt: new Date('2024-08-01'),
|
||||
lastLogin: new Date('2025-08-24')
|
||||
lastLogin: new Date('2026-04-11'),
|
||||
},
|
||||
{
|
||||
email: 'riley.johnson@cooperativedev.org',
|
||||
name: 'Riley Johnson',
|
||||
circle: 'community',
|
||||
contributionTier: '0',
|
||||
status: 'active',
|
||||
avatar: 'double-take',
|
||||
slackInvited: false,
|
||||
craftTags: ['narrative-design', 'localization'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'community-building', state: 'interested' },
|
||||
{ tagSlug: 'consensus-decision-making', state: 'seeking' },
|
||||
{ tagSlug: 'member-onboarding', state: 'seeking' },
|
||||
],
|
||||
offerPeerSupport: false,
|
||||
},
|
||||
createdAt: new Date('2024-08-15'),
|
||||
lastLogin: new Date('2025-08-12')
|
||||
lastLogin: new Date('2026-03-28'),
|
||||
},
|
||||
{
|
||||
email: 'morgan.davis@gamecollective.coop',
|
||||
name: 'Morgan Davis',
|
||||
circle: 'founder',
|
||||
contributionTier: '50',
|
||||
status: 'active',
|
||||
avatar: 'exasperated',
|
||||
helcimCustomerId: 'cust_98765',
|
||||
helcimSubscriptionId: 'sub_13579',
|
||||
slackInvited: true,
|
||||
craftTags: ['game-design', 'production-management', 'marketing-and-comms', 'business-development'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'governance', state: 'help' },
|
||||
{ tagSlug: 'cooperative-bylaws', state: 'help' },
|
||||
{ tagSlug: 'revenue-sharing', state: 'help' },
|
||||
{ tagSlug: 'worker-ownership', state: 'help' },
|
||||
{ tagSlug: 'collective-bargaining', state: 'interested' },
|
||||
{ tagSlug: 'inter-coop-collaboration', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'morgan.d',
|
||||
},
|
||||
createdAt: new Date('2024-09-01'),
|
||||
lastLogin: new Date('2025-08-26')
|
||||
lastLogin: new Date('2026-04-13'),
|
||||
},
|
||||
{
|
||||
email: 'avery.brown@newdevstudio.com',
|
||||
name: 'Avery Brown',
|
||||
circle: 'community',
|
||||
contributionTier: '5',
|
||||
status: 'active',
|
||||
avatar: 'disbelieving',
|
||||
slackInvited: false,
|
||||
craftTags: ['programming', 'qa-and-testing'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'cooperative-tech', state: 'seeking' },
|
||||
{ tagSlug: 'worker-ownership', state: 'seeking' },
|
||||
{ tagSlug: 'sustainability', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: false,
|
||||
},
|
||||
createdAt: new Date('2024-10-10'),
|
||||
lastLogin: new Date('2025-08-14')
|
||||
lastLogin: new Date('2026-03-20'),
|
||||
},
|
||||
{
|
||||
email: 'phoenix.martinez@coopgames.dev',
|
||||
name: 'Phoenix Martinez',
|
||||
circle: 'practitioner',
|
||||
contributionTier: '15',
|
||||
status: 'active',
|
||||
avatar: 'wtf',
|
||||
slackInvited: true,
|
||||
craftTags: ['community-management', 'education-and-mentoring', 'marketing-and-comms'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'cooperative-marketing', state: 'help' },
|
||||
{ tagSlug: 'community-building', state: 'help' },
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'help' },
|
||||
{ tagSlug: 'member-onboarding', state: 'help' },
|
||||
{ tagSlug: 'conflict-resolution', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'phoenix.m',
|
||||
},
|
||||
createdAt: new Date('2024-11-05'),
|
||||
lastLogin: new Date('2025-08-21')
|
||||
lastLogin: new Date('2026-04-06'),
|
||||
},
|
||||
{
|
||||
email: 'sage.anderson@collaborativestudio.org',
|
||||
name: 'Sage Anderson',
|
||||
circle: 'community',
|
||||
contributionTier: '15',
|
||||
status: 'active',
|
||||
avatar: 'sweet',
|
||||
slackInvited: true,
|
||||
craftTags: ['narrative-design', 'accessibility', 'education-and-mentoring'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'interested' },
|
||||
{ tagSlug: 'sustainability', state: 'seeking' },
|
||||
{ tagSlug: 'community-building', state: 'interested' },
|
||||
{ tagSlug: 'consensus-decision-making', state: 'seeking' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'sage.a',
|
||||
},
|
||||
createdAt: new Date('2024-12-01'),
|
||||
lastLogin: new Date('2025-08-16')
|
||||
lastLogin: new Date('2026-04-02'),
|
||||
},
|
||||
{
|
||||
email: 'dakota.wilson@indieguildstudio.com',
|
||||
name: 'Dakota Wilson',
|
||||
circle: 'founder',
|
||||
contributionTier: '30',
|
||||
status: 'active',
|
||||
avatar: 'mild',
|
||||
slackInvited: true,
|
||||
craftTags: ['game-design', 'art-and-animation', 'audio-and-music'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'governance', state: 'interested' },
|
||||
{ tagSlug: 'finance-and-budgeting', state: 'seeking' },
|
||||
{ tagSlug: 'cooperative-bylaws', state: 'seeking' },
|
||||
{ tagSlug: 'revenue-sharing', state: 'interested' },
|
||||
{ tagSlug: 'democratic-management', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'dakota.w',
|
||||
},
|
||||
createdAt: new Date('2025-01-10'),
|
||||
lastLogin: new Date('2025-08-23')
|
||||
lastLogin: new Date('2026-04-10'),
|
||||
},
|
||||
{
|
||||
email: 'charlie.thompson@gamecooperative.net',
|
||||
name: 'Charlie Thompson',
|
||||
circle: 'practitioner',
|
||||
contributionTier: '50',
|
||||
status: 'active',
|
||||
avatar: 'double-take',
|
||||
helcimCustomerId: 'cust_11111',
|
||||
helcimSubscriptionId: 'sub_22222',
|
||||
slackInvited: true,
|
||||
craftTags: ['business-development', 'analytics-and-data', 'production-management'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'finance-and-budgeting', state: 'help' },
|
||||
{ tagSlug: 'cooperative-funding', state: 'help' },
|
||||
{ tagSlug: 'collective-bargaining', state: 'help' },
|
||||
{ tagSlug: 'sustainability', state: 'help' },
|
||||
{ tagSlug: 'governance', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'charlie.t',
|
||||
},
|
||||
createdAt: new Date('2025-02-14'),
|
||||
lastLogin: new Date('2025-08-25')
|
||||
}
|
||||
lastLogin: new Date('2026-04-12'),
|
||||
},
|
||||
// Additional members for more Board density
|
||||
{
|
||||
email: 'robin.nakamura@workerowned.games',
|
||||
name: 'Robin Nakamura',
|
||||
circle: 'founder',
|
||||
contributionTier: '50',
|
||||
status: 'active',
|
||||
avatar: 'exasperated',
|
||||
slackInvited: true,
|
||||
craftTags: ['programming', 'game-design', 'devops-and-tools'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'worker-ownership', state: 'help' },
|
||||
{ tagSlug: 'cooperative-tech', state: 'help' },
|
||||
{ tagSlug: 'platform-cooperativism', state: 'help' },
|
||||
{ tagSlug: 'shared-resources', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'robin.n',
|
||||
},
|
||||
createdAt: new Date('2025-03-01'),
|
||||
lastLogin: new Date('2026-04-13'),
|
||||
},
|
||||
{
|
||||
email: 'emery.okafor@solidaritygames.org',
|
||||
name: 'Emery Okafor',
|
||||
circle: 'community',
|
||||
contributionTier: '15',
|
||||
status: 'active',
|
||||
avatar: 'wtf',
|
||||
slackInvited: true,
|
||||
craftTags: ['art-and-animation', 'community-management'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'help' },
|
||||
{ tagSlug: 'conflict-resolution', state: 'interested' },
|
||||
{ tagSlug: 'community-building', state: 'help' },
|
||||
{ tagSlug: 'consensus-decision-making', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'emery.o',
|
||||
},
|
||||
createdAt: new Date('2025-03-15'),
|
||||
lastLogin: new Date('2026-04-11'),
|
||||
},
|
||||
{
|
||||
email: 'quinn.fairweather@mutualgames.dev',
|
||||
name: 'Quinn Fairweather',
|
||||
circle: 'practitioner',
|
||||
contributionTier: '30',
|
||||
status: 'active',
|
||||
avatar: 'disbelieving',
|
||||
slackInvited: true,
|
||||
craftTags: ['production-management', 'business-development', 'education-and-mentoring'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'governance', state: 'help' },
|
||||
{ tagSlug: 'democratic-management', state: 'help' },
|
||||
{ tagSlug: 'cooperative-bylaws', state: 'interested' },
|
||||
{ tagSlug: 'member-onboarding', state: 'help' },
|
||||
{ tagSlug: 'inter-coop-collaboration', state: 'help' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'quinn.f',
|
||||
},
|
||||
createdAt: new Date('2025-04-01'),
|
||||
lastLogin: new Date('2026-04-14'),
|
||||
},
|
||||
{
|
||||
email: 'wren.castellano@commonsdev.coop',
|
||||
name: 'Wren Castellano',
|
||||
circle: 'founder',
|
||||
contributionTier: '30',
|
||||
status: 'active',
|
||||
avatar: 'sweet',
|
||||
slackInvited: true,
|
||||
craftTags: ['ux-and-ui-design', 'accessibility', 'narrative-design'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'platform-cooperativism', state: 'interested' },
|
||||
{ tagSlug: 'cooperative-marketing', state: 'seeking' },
|
||||
{ tagSlug: 'shared-resources', state: 'interested' },
|
||||
{ tagSlug: 'sustainability', state: 'seeking' },
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: false,
|
||||
},
|
||||
createdAt: new Date('2025-05-10'),
|
||||
lastLogin: new Date('2026-04-09'),
|
||||
},
|
||||
{
|
||||
email: 'indigo.ramirez@collectivecraft.studio',
|
||||
name: 'Indigo Ramirez',
|
||||
circle: 'community',
|
||||
contributionTier: '5',
|
||||
status: 'active',
|
||||
avatar: 'mild',
|
||||
slackInvited: true,
|
||||
craftTags: ['audio-and-music', 'localization'],
|
||||
board: {
|
||||
topics: [
|
||||
{ tagSlug: 'collective-bargaining', state: 'seeking' },
|
||||
{ tagSlug: 'revenue-sharing', state: 'seeking' },
|
||||
{ tagSlug: 'worker-ownership', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'indigo.r',
|
||||
},
|
||||
createdAt: new Date('2025-06-01'),
|
||||
lastLogin: new Date('2026-04-04'),
|
||||
},
|
||||
]
|
||||
|
||||
// Board topics for the test admin so the logged-in user sees matches
|
||||
const TEST_ADMIN_BOARD = {
|
||||
topics: [
|
||||
{ tagSlug: 'governance', state: 'interested' },
|
||||
{ tagSlug: 'worker-ownership', state: 'seeking' },
|
||||
{ tagSlug: 'cooperative-tech', state: 'interested' },
|
||||
{ tagSlug: 'community-building', state: 'seeking' },
|
||||
{ tagSlug: 'equity-and-inclusion', state: 'interested' },
|
||||
{ tagSlug: 'revenue-sharing', state: 'seeking' },
|
||||
{ tagSlug: 'cooperative-funding', state: 'interested' },
|
||||
{ tagSlug: 'sustainability', state: 'interested' },
|
||||
{ tagSlug: 'consensus-decision-making', state: 'seeking' },
|
||||
{ tagSlug: 'platform-cooperativism', state: 'interested' },
|
||||
],
|
||||
offerPeerSupport: true,
|
||||
slackHandle: 'test-admin',
|
||||
}
|
||||
|
||||
async function seedMembers() {
|
||||
try {
|
||||
await connectDB()
|
||||
|
||||
// Clear existing members
|
||||
await Member.deleteMany({})
|
||||
console.log('Cleared existing members')
|
||||
|
||||
|
||||
// Clear existing members (except test admin)
|
||||
await Member.deleteMany({ email: { $ne: 'test-admin@ghostguild.dev' } })
|
||||
console.log('Cleared existing members (kept test admin)')
|
||||
|
||||
// Update test admin with board topics so the Board page shows matches
|
||||
const adminUpdate = await Member.findOneAndUpdate(
|
||||
{ email: 'test-admin@ghostguild.dev' },
|
||||
{
|
||||
$set: {
|
||||
board: TEST_ADMIN_BOARD,
|
||||
craftTags: ['game-design', 'programming', 'production-management'],
|
||||
},
|
||||
},
|
||||
)
|
||||
if (adminUpdate) {
|
||||
console.log('Updated test admin with board topics')
|
||||
} else {
|
||||
console.log('Test admin not found — run /api/dev/test-login first to create it')
|
||||
}
|
||||
|
||||
// Insert sample members
|
||||
await Member.insertMany(sampleMembers)
|
||||
console.log(`Added ${sampleMembers.length} sample members`)
|
||||
|
||||
// Verify insertion and show summary
|
||||
|
||||
// Verify
|
||||
const count = await Member.countDocuments()
|
||||
console.log(`Total members in database: ${count}`)
|
||||
|
||||
// Show breakdown by circle
|
||||
console.log(`\nTotal members in database: ${count}`)
|
||||
|
||||
const circleBreakdown = await Member.aggregate([
|
||||
{ $group: { _id: '$circle', count: { $sum: 1 } } },
|
||||
{ $sort: { _id: 1 } }
|
||||
{ $sort: { _id: 1 } },
|
||||
])
|
||||
|
||||
console.log('\nBreakdown by circle:')
|
||||
circleBreakdown.forEach(circle => {
|
||||
console.log(` ${circle._id}: ${circle.count} members`)
|
||||
})
|
||||
|
||||
// Show breakdown by contribution tier
|
||||
const tierBreakdown = await Member.aggregate([
|
||||
{ $group: { _id: '$contributionTier', count: { $sum: 1 } } },
|
||||
{ $sort: { _id: 1 } }
|
||||
])
|
||||
|
||||
console.log('\nBreakdown by contribution tier:')
|
||||
tierBreakdown.forEach(tier => {
|
||||
console.log(` $${tier._id}: ${tier.count} members`)
|
||||
})
|
||||
|
||||
circleBreakdown.forEach((c) => console.log(` ${c._id}: ${c.count}`))
|
||||
|
||||
const withTopics = await Member.countDocuments({ 'board.topics.0': { $exists: true } })
|
||||
console.log(`\nMembers with board topics: ${withTopics}`)
|
||||
|
||||
const withSlack = await Member.countDocuments({ 'board.slackHandle': { $exists: true, $ne: null } })
|
||||
console.log(`Members with slack handles: ${withSlack}`)
|
||||
|
||||
process.exit(0)
|
||||
} catch (error) {
|
||||
console.error('Error seeding members:', error)
|
||||
|
|
@ -196,4 +552,4 @@ async function seedMembers() {
|
|||
}
|
||||
}
|
||||
|
||||
seedMembers()
|
||||
seedMembers()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue