Renamed id routes for API.
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
import { uuid } from 'lib/crypto';
|
||||
import { useAuth, useCors, useValidate } from 'lib/middleware';
|
||||
import { NextApiRequestQueryBody, SearchFilter } from 'lib/types';
|
||||
import { NextApiRequestQueryBody } from 'lib/types';
|
||||
import { pageInfo } from 'lib/schema';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { methodNotAllowed, ok } from 'next-basics';
|
||||
import { createReport, getReports } from 'queries';
|
||||
import * as yup from 'yup';
|
||||
|
||||
export interface ReportsRequestQuery extends SearchFilter {}
|
||||
|
||||
export interface ReportRequestBody {
|
||||
websiteId: string;
|
||||
name: string;
|
||||
@@ -60,11 +58,18 @@ export default async (
|
||||
const data = await getReports(
|
||||
{
|
||||
where: {
|
||||
userId: !(websiteId && teamId) ? userId : undefined,
|
||||
websiteId,
|
||||
website: {
|
||||
id: websiteId,
|
||||
userId: !websiteId && !teamId ? userId : undefined,
|
||||
teamId,
|
||||
},
|
||||
},
|
||||
include: {
|
||||
website: true,
|
||||
website: {
|
||||
select: {
|
||||
domain: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
filters,
|
||||
|
||||
Reference in New Issue
Block a user