feat(documents): admin-configurable Expired tab visibility
New documents_show_expired_tab system setting (default true). Public read via GET /api/v1/documents/feature-flags (gated on documents.view so reps can read it without holding manage_settings). When off, the Expired tab is hidden from the documents hub — useful when expired EOIs are noise that distracts reps from active deals. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
20
src/app/api/v1/documents/feature-flags/route.ts
Normal file
20
src/app/api/v1/documents/feature-flags/route.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
import { withAuth, withPermission } from '@/lib/api/helpers';
|
||||
import { errorResponse } from '@/lib/errors';
|
||||
import { getSetting } from '@/lib/services/settings.service';
|
||||
|
||||
export const GET = withAuth(
|
||||
withPermission('documents', 'view', async (_req, ctx) => {
|
||||
try {
|
||||
const showExpired = await getSetting('documents_show_expired_tab', ctx.portId);
|
||||
return NextResponse.json({
|
||||
data: {
|
||||
showExpiredTab: showExpired?.value !== false, // default true
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
return errorResponse(error);
|
||||
}
|
||||
}),
|
||||
);
|
||||
Reference in New Issue
Block a user