mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-26 12:29:05 +01:00
Update useValidate calls.
This commit is contained in:
parent
5e3c135388
commit
0d9b6e8355
@ -28,9 +28,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
const { websiteId, startAt, endAt, event } = req.query;
|
const { websiteId, startAt, endAt, event } = req.query;
|
||||||
|
@ -28,9 +28,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
const { websiteId, startAt, endAt, field } = req.query;
|
const { websiteId, startAt, endAt, field } = req.query;
|
||||||
|
@ -26,9 +26,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
const { websiteId, startAt, endAt } = req.query;
|
const { websiteId, startAt, endAt } = req.query;
|
||||||
|
@ -37,9 +37,7 @@ export default async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { currentPassword, newPassword } = req.body;
|
const { currentPassword, newPassword } = req.body;
|
||||||
const { id } = req.auth.user;
|
const { id } = req.auth.user;
|
||||||
|
@ -21,9 +21,7 @@ export default async (
|
|||||||
res: NextApiResponse,
|
res: NextApiResponse,
|
||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
req.query.id = req.auth.user.id;
|
req.query.id = req.auth.user.id;
|
||||||
|
@ -22,9 +22,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
req.query.id = req.auth.user.id;
|
req.query.id = req.auth.user.id;
|
||||||
|
@ -23,9 +23,7 @@ export default async (
|
|||||||
res: NextApiResponse<RealtimeInit>,
|
res: NextApiResponse<RealtimeInit>,
|
||||||
) => {
|
) => {
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
const { id: websiteId, startAt } = req.query;
|
const { id: websiteId, startAt } = req.query;
|
||||||
|
@ -46,9 +46,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { id: reportId } = req.query;
|
const { id: reportId } = req.query;
|
||||||
const {
|
const {
|
||||||
|
@ -44,9 +44,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
if (req.method === 'POST') {
|
if (req.method === 'POST') {
|
||||||
const {
|
const {
|
||||||
|
@ -43,9 +43,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
user: { id: userId },
|
user: { id: userId },
|
||||||
|
@ -69,9 +69,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
if (req.method === 'POST') {
|
if (req.method === 'POST') {
|
||||||
const {
|
const {
|
||||||
|
@ -32,9 +32,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
if (req.method === 'POST') {
|
if (req.method === 'POST') {
|
||||||
const {
|
const {
|
||||||
|
@ -80,8 +80,7 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
|||||||
|
|
||||||
const { type, payload } = req.body;
|
const { type, payload } = req.body;
|
||||||
|
|
||||||
req.yup = schema;
|
await useValidate(schema, req, res);
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
if (await hasBlockedIp(req)) {
|
if (await hasBlockedIp(req)) {
|
||||||
return forbidden(res);
|
return forbidden(res);
|
||||||
|
@ -25,8 +25,7 @@ export default async (
|
|||||||
req: NextApiRequestQueryBody<ShareRequestQuery>,
|
req: NextApiRequestQueryBody<ShareRequestQuery>,
|
||||||
res: NextApiResponse<ShareResponse>,
|
res: NextApiResponse<ShareResponse>,
|
||||||
) => {
|
) => {
|
||||||
req.yup = schema;
|
await useValidate(schema, req, res);
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { id: shareId } = req.query;
|
const { id: shareId } = req.query;
|
||||||
|
|
||||||
|
@ -35,9 +35,7 @@ export default async (
|
|||||||
res: NextApiResponse<Team>,
|
res: NextApiResponse<Team>,
|
||||||
) => {
|
) => {
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { id: teamId } = req.query;
|
const { id: teamId } = req.query;
|
||||||
|
|
||||||
|
@ -20,9 +20,7 @@ const schema = {
|
|||||||
|
|
||||||
export default async (req: NextApiRequestQueryBody<TeamUserRequestQuery>, res: NextApiResponse) => {
|
export default async (req: NextApiRequestQueryBody<TeamUserRequestQuery>, res: NextApiResponse) => {
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
if (req.method === 'DELETE') {
|
if (req.method === 'DELETE') {
|
||||||
const { id: teamId, userId } = req.query;
|
const { id: teamId, userId } = req.query;
|
||||||
|
@ -21,8 +21,7 @@ export default async (
|
|||||||
res: NextApiResponse,
|
res: NextApiResponse,
|
||||||
) => {
|
) => {
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
req.yup = schema;
|
await useValidate(schema, req, res);
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { id: teamId } = req.query;
|
const { id: teamId } = req.query;
|
||||||
|
|
||||||
|
@ -23,9 +23,7 @@ export default async (
|
|||||||
res: NextApiResponse,
|
res: NextApiResponse,
|
||||||
) => {
|
) => {
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { id: teamId, websiteId } = req.query;
|
const { id: teamId, websiteId } = req.query;
|
||||||
|
|
||||||
|
@ -32,9 +32,7 @@ export default async (
|
|||||||
res: NextApiResponse,
|
res: NextApiResponse,
|
||||||
) => {
|
) => {
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { id: teamId } = req.query;
|
const { id: teamId } = req.query;
|
||||||
|
|
||||||
|
@ -30,9 +30,7 @@ export default async (
|
|||||||
res: NextApiResponse<Team[] | Team>,
|
res: NextApiResponse<Team[] | Team>,
|
||||||
) => {
|
) => {
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
user: { id: userId },
|
user: { id: userId },
|
||||||
|
@ -21,9 +21,7 @@ export default async (
|
|||||||
res: NextApiResponse<Team>,
|
res: NextApiResponse<Team>,
|
||||||
) => {
|
) => {
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
if (req.method === 'POST') {
|
if (req.method === 'POST') {
|
||||||
const { accessCode } = req.body;
|
const { accessCode } = req.body;
|
||||||
|
@ -33,9 +33,7 @@ export default async (
|
|||||||
res: NextApiResponse<User>,
|
res: NextApiResponse<User>,
|
||||||
) => {
|
) => {
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
user: { id: userId, isAdmin },
|
user: { id: userId, isAdmin },
|
||||||
|
@ -29,9 +29,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { user } = req.auth;
|
const { user } = req.auth;
|
||||||
const { id: userId } = req.query;
|
const { id: userId } = req.query;
|
||||||
|
@ -36,9 +36,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { user } = req.auth;
|
const { user } = req.auth;
|
||||||
|
|
||||||
|
@ -27,9 +27,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { user } = req.auth;
|
const { user } = req.auth;
|
||||||
const { id: userId, page, query, includeTeams, onlyTeams } = req.query;
|
const { id: userId, page, query, includeTeams, onlyTeams } = req.query;
|
||||||
|
@ -37,9 +37,7 @@ export default async (
|
|||||||
res: NextApiResponse<User[] | User>,
|
res: NextApiResponse<User[] | User>,
|
||||||
) => {
|
) => {
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
if (!(await canViewUsers(req.auth))) {
|
if (!(await canViewUsers(req.auth))) {
|
||||||
|
@ -22,9 +22,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { id: websiteId } = req.query;
|
const { id: websiteId } = req.query;
|
||||||
|
|
||||||
|
@ -22,9 +22,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { id: websiteId } = req.query;
|
const { id: websiteId } = req.query;
|
||||||
|
|
||||||
|
@ -34,9 +34,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { id: websiteId, timezone, url } = req.query;
|
const { id: websiteId, timezone, url } = req.query;
|
||||||
const { startDate, endDate, unit } = await parseDateRangeQuery(req);
|
const { startDate, endDate, unit } = await parseDateRangeQuery(req);
|
||||||
|
@ -36,9 +36,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { id: websiteId } = req.query;
|
const { id: websiteId } = req.query;
|
||||||
|
|
||||||
|
@ -54,9 +54,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
id: websiteId,
|
id: websiteId,
|
||||||
|
@ -50,9 +50,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
id: websiteId,
|
id: websiteId,
|
||||||
|
@ -22,9 +22,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { id: websiteId } = req.query;
|
const { id: websiteId } = req.query;
|
||||||
|
|
||||||
|
@ -22,8 +22,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
req.yup = schema;
|
await useValidate(schema, req, res);
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { id: websiteId } = req.query;
|
const { id: websiteId } = req.query;
|
||||||
|
|
||||||
|
@ -50,9 +50,7 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
id: websiteId,
|
id: websiteId,
|
||||||
|
@ -20,9 +20,7 @@ const schema = {
|
|||||||
export default async (req: NextApiRequestQueryBody<ValuesRequestQuery>, res: NextApiResponse) => {
|
export default async (req: NextApiRequestQueryBody<ValuesRequestQuery>, res: NextApiResponse) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
|
await useValidate(schema, req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
|
||||||
|
|
||||||
const { id: websiteId, type } = req.query;
|
const { id: websiteId, type } = req.query;
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ export default async (
|
|||||||
) => {
|
) => {
|
||||||
await useCors(req, res);
|
await useCors(req, res);
|
||||||
await useAuth(req, res);
|
await useAuth(req, res);
|
||||||
req.yup = schema;
|
|
||||||
await useValidate(req, res);
|
await useValidate(schema, req, res);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
user: { id: userId },
|
user: { id: userId },
|
||||||
|
Loading…
Reference in New Issue
Block a user