New standalone Journey page.
This commit is contained in:
@@ -1,19 +1,11 @@
|
||||
import { z } from 'zod';
|
||||
import { canViewWebsite } from '@/lib/auth';
|
||||
import { unauthorized, json } from '@/lib/response';
|
||||
import { parseRequest } from '@/lib/request';
|
||||
import { getJourney } from '@/queries';
|
||||
import { reportParms } from '@/lib/schema';
|
||||
import { reportResultSchema } from '@/lib/schema';
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const schema = z.object({
|
||||
...reportParms,
|
||||
steps: z.coerce.number().min(3).max(7),
|
||||
startStep: z.string().optional(),
|
||||
endStep: z.string().optional(),
|
||||
});
|
||||
|
||||
const { auth, body, error } = await parseRequest(request, schema);
|
||||
const { auth, body, error } = await parseRequest(request, reportResultSchema);
|
||||
|
||||
if (error) {
|
||||
return error();
|
||||
@@ -22,9 +14,7 @@ export async function POST(request: Request) {
|
||||
const {
|
||||
websiteId,
|
||||
dateRange: { startDate, endDate },
|
||||
steps,
|
||||
startStep,
|
||||
endStep,
|
||||
parameters: { steps, startStep, endStep },
|
||||
} = body;
|
||||
|
||||
if (!(await canViewWebsite(auth, websiteId))) {
|
||||
|
||||
Reference in New Issue
Block a user