Refactored queries.

This commit is contained in:
Mike Cao 2023-07-29 22:03:34 -07:00
parent f36a689817
commit 8904b7b4ed
27 changed files with 137 additions and 144 deletions

View file

@ -3,7 +3,7 @@ import { methodNotAllowed, ok, serverError, unauthorized } from 'next-basics';
import { Website, NextApiRequestQueryBody } from 'lib/types';
import { canViewWebsite, canUpdateWebsite, canDeleteWebsite } from 'lib/auth';
import { useAuth, useCors } from 'lib/middleware';
import { deleteWebsite, getWebsite, updateWebsite } from 'queries';
import { deleteWebsite, getWebsiteById, updateWebsite } from 'queries';
import { SHARE_ID_REGEX } from 'lib/constants';
export interface WebsiteRequestQuery {
@ -30,7 +30,7 @@ export default async (
return unauthorized(res);
}
const website = await getWebsite({ id: websiteId });
const website = await getWebsiteById(websiteId);
return ok(res, website);
}