mirror of
https://github.com/umami-software/umami.git
synced 2026-02-16 02:25:35 +01:00
More yup validations.
This commit is contained in:
parent
2ccb8d0a3c
commit
ce2a83a09f
12 changed files with 99 additions and 50 deletions
|
|
@ -6,6 +6,8 @@ import { NextApiResponse } from 'next';
|
|||
import { badRequest, methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { getEventMetrics } from 'queries';
|
||||
import { parseDateRangeQuery } from 'lib/query';
|
||||
import * as yup from 'yup';
|
||||
import { TimezoneTest } from 'lib/yup';
|
||||
|
||||
const unitTypes = ['year', 'month', 'hour', 'day'];
|
||||
|
||||
|
|
@ -18,15 +20,13 @@ export interface WebsiteEventsRequestQuery {
|
|||
url: string;
|
||||
}
|
||||
|
||||
import * as yup from 'yup';
|
||||
|
||||
const schema = {
|
||||
GET: yup.object().shape({
|
||||
id: yup.string().uuid().required(),
|
||||
startAt: yup.number().integer().required(),
|
||||
endAt: yup.number().integer().moreThan(yup.ref('startAt')).required(),
|
||||
unit: yup.string().required(),
|
||||
timezone: yup.string().required(),
|
||||
timezone: TimezoneTest.required(),
|
||||
url: yup.string(),
|
||||
}),
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue