Board component, security, test updates
This commit is contained in:
1 parent
f525898b79
commit
ab5b1bf354
23 files changed
+1128
-180
No files matched your search
@@ -15,6 +15,10 @@ export async function GET(request: Request, { params }: { params: Promise<{ repo
|
||||
|
||||
const report = await getReport(reportId);
|
||||
|
||||
if (!report) {
|
||||
return notFound();
|
||||
}
|
||||
|
||||
if (!(await canViewReport(auth, report))) {
|
||||
return unauthorized();
|
||||
}
|
||||
|
||||
@@ -4,33 +4,13 @@ import { parseRequest } from '@/lib/request';
|
||||
import { json, unauthorized } from '@/lib/response';
|
||||
import { pagingParams, reportSchema, reportTypeParam } from '@/lib/schema';
|
||||
import {
|
||||
getReportSection,
|
||||
canUpdateWebsite,
|
||||
canViewAuthenticatedWebsite,
|
||||
canViewWebsiteSection,
|
||||
} from '@/permissions';
|
||||
import type { ShareSection } from '@/permissions';
|
||||
import { createReport, getReports } from '@/queries/prisma';
|
||||
|
||||
function getReportSection(type?: z.infer<typeof reportTypeParam>): ShareSection | null {
|
||||
switch (type) {
|
||||
case 'attribution':
|
||||
case 'breakdown':
|
||||
case 'performance':
|
||||
case 'retention':
|
||||
case 'revenue':
|
||||
case 'utm':
|
||||
return type;
|
||||
case 'funnel':
|
||||
return 'funnels';
|
||||
case 'goal':
|
||||
return 'goals';
|
||||
case 'journey':
|
||||
return 'journeys';
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const schema = z.object({
|
||||
websiteId: z.uuid(),
|
||||
|
||||
Reference in new issue
Block a user