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:
@@ -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 field = await withTenant(tenant.id, async (tx) => {
|
||||
await requireBoardEditor(tx, locals.user, params.boardId, tenant.id);
|
||||
|
||||
const existing = await tx.customFieldDef.findFirst({
|
||||
where: { id: params.fieldId, boardId: params.boardId }
|
||||
});
|
||||
if (!existing) throw error(404, 'Field not found');
|
||||
|
||||
const data: Record<string, any> = {};
|
||||
if (body.name !== undefined) data.name = body.name;
|
||||
if (body.options !== undefined) data.options = body.options;
|
||||
if (body.position !== undefined) data.position = body.position;
|
||||
|
||||
return tx.customFieldDef.update({
|
||||
where: { id: params.fieldId },
|
||||
data
|
||||
});
|
||||
});
|
||||
|
||||
return json({ field });
|
||||
};
|
||||
|
||||
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.customFieldDef.findFirst({
|
||||
where: { id: params.fieldId, boardId: params.boardId }
|
||||
});
|
||||
if (!existing) throw error(404, 'Field not found');
|
||||
|
||||
await tx.customFieldDef.delete({ where: { id: params.fieldId } });
|
||||
});
|
||||
|
||||
return json({ ok: true });
|
||||
};
|
||||
Reference in New Issue
Block a user