8c41b33313
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>
36 lines
965 B
TypeScript
36 lines
965 B
TypeScript
import { error } from '@sveltejs/kit';
|
|
import type { PageServerLoad } from './$types.js';
|
|
import { withTenant } from '$lib/server/rls.js';
|
|
import { requireBoardView } from '$lib/server/guards.js';
|
|
import { canEditBoard } from '$lib/server/permissions.js';
|
|
|
|
export const load: PageServerLoad = async ({ params, locals }) => {
|
|
const tenant = locals.tenant;
|
|
if (!tenant) throw error(400, 'Unknown tenant');
|
|
|
|
const board = await withTenant(tenant.id, async (tx) => {
|
|
return requireBoardView(tx, locals.user, params.boardId, tenant.id);
|
|
});
|
|
|
|
// Filter to cards with due dates
|
|
const cardsWithDue = board.columns.flatMap((col: any) =>
|
|
col.cards
|
|
.filter((c: any) => c.dueDate)
|
|
.map((c: any) => ({
|
|
...c,
|
|
columnTitle: col.title,
|
|
columnId: col.id
|
|
}))
|
|
);
|
|
|
|
return {
|
|
board: {
|
|
id: board.id,
|
|
title: board.title,
|
|
cardPrefix: (board as any).cardPrefix
|
|
},
|
|
cards: cardsWithDue,
|
|
canEdit: canEditBoard(locals.user, board.members)
|
|
};
|
|
};
|