Private
Public Access
1
0

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>
This commit is contained in:
Catherine Renelle
2026-02-27 08:50:15 -05:00
parent 3a11ed01e9
commit 8c41b33313
54 changed files with 3656 additions and 82 deletions
@@ -0,0 +1,58 @@
import { json, error } from '@sveltejs/kit';
import type { RequestHandler } from './$types.js';
import { withTenant } from '$lib/server/rls.js';
import { requireBoardEditor, requireBoardView } from '$lib/server/guards.js';
import { canViewBoard } from '$lib/server/permissions.js';
const VALID_TRIGGERS = ['CARD_MOVED', 'DUE_PASSED', 'LABEL_ADDED', 'CARD_CREATED'];
const VALID_ACTIONS = ['ADD_LABEL', 'REMOVE_LABEL', 'ASSIGN', 'SET_DUE', 'MOVE_TO_COLUMN'];
export const GET: RequestHandler = async ({ params, locals }) => {
const tenant = locals.tenant;
if (!tenant) throw error(400, 'Unknown tenant');
const rules = await withTenant(tenant.id, async (tx) => {
const board = await tx.board.findFirst({
where: { id: params.boardId, tenantId: tenant.id },
include: { members: true }
});
if (!board) throw error(404, 'Board not found');
if (!canViewBoard(locals.user, board.visibility, board.members)) {
throw error(403, 'Access denied');
}
return tx.automationRule.findMany({
where: { boardId: params.boardId },
orderBy: { trigger: 'asc' }
});
});
return json({ rules });
};
export const POST: RequestHandler = async ({ params, request, locals }) => {
const tenant = locals.tenant;
if (!tenant) throw error(400, 'Unknown tenant');
const body = await request.json();
const { trigger, triggerConfig, action, actionConfig } = body;
if (!trigger || !VALID_TRIGGERS.includes(trigger)) throw error(400, 'Invalid trigger');
if (!action || !VALID_ACTIONS.includes(action)) throw error(400, 'Invalid action');
const rule = await withTenant(tenant.id, async (tx) => {
await requireBoardEditor(tx, locals.user, params.boardId, tenant.id);
return tx.automationRule.create({
data: {
boardId: params.boardId,
trigger,
triggerConfig: triggerConfig || null,
action,
actionConfig: actionConfig || null
}
});
});
return json({ rule }, { status: 201 });
};
@@ -0,0 +1,50 @@
import { json, error } from '@sveltejs/kit';
import type { RequestHandler } from './$types.js';
import { withTenant } from '$lib/server/rls.js';
import { requireBoardEditor } from '$lib/server/guards.js';
export const PATCH: RequestHandler = async ({ params, request, locals }) => {
const tenant = locals.tenant;
if (!tenant) throw error(400, 'Unknown tenant');
const body = await request.json();
const rule = await withTenant(tenant.id, async (tx) => {
await requireBoardEditor(tx, locals.user, params.boardId, tenant.id);
const existing = await tx.automationRule.findFirst({
where: { id: params.ruleId, boardId: params.boardId }
});
if (!existing) throw error(404, 'Rule not found');
const data: Record<string, any> = {};
if (body.active !== undefined) data.active = body.active;
if (body.triggerConfig !== undefined) data.triggerConfig = body.triggerConfig;
if (body.actionConfig !== undefined) data.actionConfig = body.actionConfig;
return tx.automationRule.update({
where: { id: params.ruleId },
data
});
});
return json({ rule });
};
export const DELETE: RequestHandler = async ({ params, locals }) => {
const tenant = locals.tenant;
if (!tenant) throw error(400, 'Unknown tenant');
await withTenant(tenant.id, async (tx) => {
await requireBoardEditor(tx, locals.user, params.boardId, tenant.id);
const existing = await tx.automationRule.findFirst({
where: { id: params.ruleId, boardId: params.boardId }
});
if (!existing) throw error(404, 'Rule not found');
await tx.automationRule.delete({ where: { id: params.ruleId } });
});
return json({ ok: true });
};