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