mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 18:00:17 +01:00
Add back pageSize.
This commit is contained in:
parent
d5c4202ee4
commit
9732d0e6ef
@ -50,10 +50,11 @@ export default async (
|
||||
} = req.auth;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
const { page, query } = req.query;
|
||||
const { page, query, pageSize } = req.query;
|
||||
|
||||
const data = await getReportsByUserId(userId, {
|
||||
page,
|
||||
pageSize: +pageSize || undefined,
|
||||
query,
|
||||
includeTeams: true,
|
||||
});
|
||||
|
@ -5,6 +5,7 @@ import { NextApiRequestQueryBody, SearchFilter } from 'lib/types';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { getUsersByTeamId } from 'queries';
|
||||
import { pageInfo } from 'lib/schema';
|
||||
|
||||
export interface TeamUserRequestQuery extends SearchFilter {
|
||||
id: string;
|
||||
@ -13,6 +14,7 @@ export interface TeamUserRequestQuery extends SearchFilter {
|
||||
const schema = {
|
||||
GET: yup.object().shape({
|
||||
id: yup.string().uuid().required(),
|
||||
...pageInfo,
|
||||
}),
|
||||
};
|
||||
|
||||
@ -30,11 +32,12 @@ export default async (
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const { query, page } = req.query;
|
||||
const { query, page, pageSize } = req.query;
|
||||
|
||||
const users = await getUsersByTeamId(teamId, {
|
||||
query,
|
||||
page,
|
||||
pageSize: +pageSize || undefined,
|
||||
});
|
||||
|
||||
return ok(res, users);
|
||||
|
@ -41,7 +41,13 @@ export default async (
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const websites = await getWebsitesByTeamId(teamId, { ...req.query });
|
||||
const { page, query, pageSize } = req.query;
|
||||
|
||||
const websites = await getWebsitesByTeamId(teamId, {
|
||||
page,
|
||||
query,
|
||||
pageSize: +pageSize || undefined,
|
||||
});
|
||||
|
||||
return ok(res, websites);
|
||||
}
|
||||
|
@ -35,11 +35,12 @@ export default async (
|
||||
} = req.auth;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
const { page, query } = req.query;
|
||||
const { page, query, pageSize } = req.query;
|
||||
|
||||
const results = await getTeamsByUserId(userId, {
|
||||
page,
|
||||
query,
|
||||
pageSize: +pageSize || undefined,
|
||||
});
|
||||
|
||||
return ok(res, results);
|
||||
|
@ -44,7 +44,7 @@ export default async (
|
||||
const teams = await getTeamsByUserId(userId, {
|
||||
query,
|
||||
page,
|
||||
pageSize,
|
||||
pageSize: +pageSize || undefined,
|
||||
});
|
||||
|
||||
return ok(res, teams);
|
||||
|
@ -47,7 +47,7 @@ export default async (
|
||||
|
||||
const websites = await getWebsitesByUserId(userId, {
|
||||
page,
|
||||
pageSize,
|
||||
pageSize: +pageSize || undefined,
|
||||
query,
|
||||
orderBy,
|
||||
includeTeams,
|
||||
|
@ -44,9 +44,9 @@ export default async (
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const { page, query } = req.query;
|
||||
const { page, query, pageSize } = req.query;
|
||||
|
||||
const users = await getUsers({ page, query });
|
||||
const users = await getUsers({ page, query, pageSize: +pageSize || undefined });
|
||||
|
||||
return ok(res, users);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import { NextApiRequestQueryBody, SearchFilter } from 'lib/types';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { methodNotAllowed, ok, unauthorized } from 'next-basics';
|
||||
import { getReportsByWebsiteId } from 'queries';
|
||||
import { pageInfo } from 'lib/schema';
|
||||
|
||||
export interface ReportsRequestQuery extends SearchFilter {
|
||||
id: string;
|
||||
@ -13,6 +14,7 @@ export interface ReportsRequestQuery extends SearchFilter {
|
||||
const schema = {
|
||||
GET: yup.object().shape({
|
||||
id: yup.string().uuid().required(),
|
||||
...pageInfo,
|
||||
}),
|
||||
};
|
||||
|
||||
@ -27,14 +29,15 @@ export default async (
|
||||
const { id: websiteId } = req.query;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
if (!(websiteId && (await canViewWebsite(req.auth, websiteId)))) {
|
||||
if (!(await canViewWebsite(req.auth, websiteId))) {
|
||||
return unauthorized(res);
|
||||
}
|
||||
|
||||
const { page, query } = req.query;
|
||||
const { page, query, pageSize } = req.query;
|
||||
|
||||
const data = await getReportsByWebsiteId(websiteId, {
|
||||
page,
|
||||
pageSize: +pageSize || undefined,
|
||||
query,
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user