Private
Public Access
1
0
Files
Kanban/src/routes/invite/[code]/+page.server.ts
T
Catherine Renelle 8c41b33313 Add 17 features: My Work view, card copy/numbering, calendar, bulk ops, custom fields, automations, webhooks, invites, import/export, and more
Features implemented across 6 batches:
- Batch A: Fix ColorPicker gradient sync, tenant custom logo, unarchive cards, board backgrounds
- Batch B: My Work view, card copy/duplicate, card numbering (BOARD-123)
- Batch C: Due date reminders (cron), card watching with notifications
- Batch D: Bulk card operations, column sorting, calendar view
- Batch E: Invite by link, board import/export (Pounce + Trello JSON)
- Batch F: Webhooks with HMAC signing, custom fields, automation rules engine

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 08:50:15 -05:00

33 lines
819 B
TypeScript

import { error } from '@sveltejs/kit';
import type { PageServerLoad } from './$types.js';
import { prisma } from '$lib/server/db.js';
export const load: PageServerLoad = async ({ params, locals }) => {
const invite = await prisma.tenantInvite.findUnique({
where: { code: params.code },
include: {
tenant: { select: { name: true } }
}
});
if (!invite) throw error(404, 'Invite not found');
if (invite.expiresAt < new Date()) {
throw error(410, 'This invite has expired');
}
if (invite.maxUses !== null && invite.usedCount >= invite.maxUses) {
throw error(410, 'This invite has reached its maximum number of uses');
}
return {
invite: {
code: invite.code,
role: invite.role,
tenantName: invite.tenant.name,
expiresAt: invite.expiresAt.toISOString()
},
user: locals.user
};
};