mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
add zod schema to realtime endpoint
Some checks are pending
Node.js CI / build (postgresql, 18.18, 10) (push) Waiting to run
Some checks are pending
Node.js CI / build (postgresql, 18.18, 10) (push) Waiting to run
This commit is contained in:
parent
b7747b33e4
commit
f98e683979
1 changed files with 12 additions and 6 deletions
|
|
@ -1,15 +1,21 @@
|
|||
import { json, unauthorized } from '@/lib/response';
|
||||
import { getRealtimeData } from '@/queries/sql';
|
||||
import { canViewWebsite } from '@/permissions';
|
||||
import { startOfMinute, subMinutes } from 'date-fns';
|
||||
import { REALTIME_RANGE } from '@/lib/constants';
|
||||
import { parseRequest, getQueryFilters } from '@/lib/request';
|
||||
import { getQueryFilters, parseRequest } from '@/lib/request';
|
||||
import { json, unauthorized } from '@/lib/response';
|
||||
import { timezoneParam } from '@/lib/schema';
|
||||
import { canViewWebsite } from '@/permissions';
|
||||
import { getRealtimeData } from '@/queries/sql';
|
||||
import { startOfMinute, subMinutes } from 'date-fns';
|
||||
import z from 'zod';
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
{ params }: { params: Promise<{ websiteId: string }> },
|
||||
) {
|
||||
const { auth, query, error } = await parseRequest(request);
|
||||
const schema = z.object({
|
||||
timezone: timezoneParam,
|
||||
});
|
||||
|
||||
const { auth, query, error } = await parseRequest(request, schema);
|
||||
|
||||
if (error) {
|
||||
return error();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue