feat(documents): detail page with signers, watchers, activity, actions
Replaces the PR4 stub at /documents/[id] with the full Phase A detail view: gradient header strip, status-aware action bar (Cancel / Download / Email signatories), per-signer remind + copy-link, watcher list with remove, and activity timeline. Adds the supporting endpoints (cancel, compose-completion-email, watchers GET/POST/DELETE) and listDocumentWatchers / addDocumentWatcher / removeDocumentWatcher service helpers. The document GET now serves the aggregator shape when ?detail=true. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
21
src/app/api/v1/documents/[id]/watchers/[userId]/route.ts
Normal file
21
src/app/api/v1/documents/[id]/watchers/[userId]/route.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
import { withAuth, withPermission } from '@/lib/api/helpers';
|
||||
import { errorResponse } from '@/lib/errors';
|
||||
import { removeDocumentWatcher } from '@/lib/services/documents.service';
|
||||
|
||||
export const DELETE = withAuth(
|
||||
withPermission('documents', 'edit', async (_req, ctx, params) => {
|
||||
try {
|
||||
await removeDocumentWatcher(params.id!, ctx.portId, params.userId!, {
|
||||
userId: ctx.userId,
|
||||
portId: ctx.portId,
|
||||
ipAddress: ctx.ipAddress,
|
||||
userAgent: ctx.userAgent,
|
||||
});
|
||||
return NextResponse.json({ data: { ok: true } });
|
||||
} catch (error) {
|
||||
return errorResponse(error);
|
||||
}
|
||||
}),
|
||||
);
|
||||
Reference in New Issue
Block a user