move queries

This commit is contained in:
Brian Cao 2022-07-12 14:14:36 -07:00
parent 910f165103
commit 8aec6d7406
53 changed files with 920 additions and 485 deletions

View file

@ -1,4 +1,4 @@
import { getAccountById, deleteAccount } from 'lib/queries';
import { getAccountById, deleteAccount } from 'queries';
import { useAuth } from 'lib/middleware';
import { methodNotAllowed, ok, unauthorized } from 'lib/response';

View file

@ -1,4 +1,4 @@
import { getAccountById, getAccountByUsername, updateAccount, createAccount } from 'lib/queries';
import { getAccountById, getAccountByUsername, updateAccount, createAccount } from 'queries';
import { useAuth } from 'lib/middleware';
import { hashPassword } from 'lib/crypto';
import { ok, unauthorized, methodNotAllowed, badRequest } from 'lib/response';

View file

@ -1,4 +1,4 @@
import { getAccountById, updateAccount } from 'lib/queries';
import { getAccountById, updateAccount } from 'queries';
import { useAuth } from 'lib/middleware';
import { badRequest, methodNotAllowed, ok, unauthorized } from 'lib/response';
import { checkPassword, hashPassword } from 'lib/crypto';

View file

@ -1,4 +1,4 @@
import { getAccounts } from 'lib/queries';
import { getAccounts } from 'queries';
import { useAuth } from 'lib/middleware';
import { ok, unauthorized, methodNotAllowed } from 'lib/response';

View file

@ -1,5 +1,5 @@
import { checkPassword, createSecureToken } from 'lib/crypto';
import { getAccountByUsername } from 'lib/queries';
import { getAccountByUsername } from 'queries/admin/account/getAccountByUsername';
import { ok, unauthorized, badRequest } from 'lib/response';
export default async (req, res) => {

View file

@ -1,7 +1,7 @@
const { Resolver } = require('dns').promises;
import isbot from 'isbot';
import ipaddr from 'ipaddr.js';
import { savePageView, saveEvent } from 'lib/queries';
import { savePageView, saveEvent } from 'queries';
import { useCors, useSession } from 'lib/middleware';
import { getJsonBody, getIpAddress } from 'lib/request';
import { ok, send, badRequest, forbidden } from 'lib/response';

View file

@ -1,7 +1,7 @@
import { subMinutes } from 'date-fns';
import { useAuth } from 'lib/middleware';
import { ok, methodNotAllowed } from 'lib/response';
import { getUserWebsites, getRealtimeData } from 'lib/queries';
import { getUserWebsites, getRealtimeData } from 'queries';
import { createToken } from 'lib/crypto';
export default async (req, res) => {

View file

@ -1,6 +1,6 @@
import { useAuth } from 'lib/middleware';
import { ok, methodNotAllowed, badRequest } from 'lib/response';
import { getRealtimeData } from 'lib/queries';
import { getRealtimeData } from 'queries';
import { parseToken } from 'lib/crypto';
import { SHARE_TOKEN_HEADER } from 'lib/constants';

View file

@ -1,4 +1,4 @@
import { getWebsiteByShareId } from 'lib/queries';
import { getWebsiteByShareId } from 'queries';
import { ok, notFound, methodNotAllowed } from 'lib/response';
import { createToken } from 'lib/crypto';

View file

@ -1,7 +1,7 @@
import { getActiveVisitors } from 'lib/queries';
import { methodNotAllowed, ok, unauthorized } from 'lib/response';
import { allowQuery } from 'lib/auth';
import { useCors } from 'lib/middleware';
import { getActiveVisitors } from 'queries';
export default async (req, res) => {
if (req.method === 'GET') {

View file

@ -1,5 +1,5 @@
import moment from 'moment-timezone';
import { getEventMetrics } from 'lib/queries';
import { getEventMetrics } from 'queries/analytics';
import { ok, badRequest, methodNotAllowed, unauthorized } from 'lib/response';
import { allowQuery } from 'lib/auth';
import { useCors } from 'lib/middleware';

View file

@ -1,4 +1,4 @@
import { deleteWebsite, getWebsiteById } from 'lib/queries';
import { deleteWebsite, getWebsiteById } from 'queries';
import { methodNotAllowed, ok, unauthorized } from 'lib/response';
import { allowQuery } from 'lib/auth';
import { useCors } from 'lib/middleware';

View file

@ -1,4 +1,4 @@
import { getPageviewMetrics, getSessionMetrics, getWebsiteById } from 'lib/queries';
import { getPageviewMetrics, getSessionMetrics, getWebsiteById } from 'queries';
import { ok, methodNotAllowed, unauthorized, badRequest } from 'lib/response';
import { allowQuery } from 'lib/auth';
import { useCors } from 'lib/middleware';

View file

@ -1,5 +1,5 @@
import moment from 'moment-timezone';
import { getPageviewStats } from 'lib/queries';
import { getPageviewStats } from 'queries';
import { ok, badRequest, methodNotAllowed, unauthorized } from 'lib/response';
import { allowQuery } from 'lib/auth';
import { useCors } from 'lib/middleware';

View file

@ -1,4 +1,4 @@
import { resetWebsite } from 'lib/queries';
import { resetWebsite } from 'queries';
import { methodNotAllowed, ok, unauthorized } from 'lib/response';
import { allowQuery } from 'lib/auth';

View file

@ -1,4 +1,4 @@
import { getWebsiteStats } from 'lib/queries';
import { getWebsiteStats } from 'queries';
import { methodNotAllowed, ok, unauthorized } from 'lib/response';
import { allowQuery } from 'lib/auth';
import { useCors } from 'lib/middleware';

View file

@ -1,4 +1,4 @@
import { updateWebsite, createWebsite, getWebsiteById } from 'lib/queries';
import { updateWebsite, createWebsite, getWebsiteById } from 'queries';
import { useAuth } from 'lib/middleware';
import { uuid, getRandomChars } from 'lib/crypto';
import { ok, unauthorized, methodNotAllowed } from 'lib/response';

View file

@ -1,4 +1,4 @@
import { getAllWebsites, getUserWebsites } from 'lib/queries';
import { getAllWebsites, getUserWebsites } from 'queries';
import { useAuth } from 'lib/middleware';
import { ok, methodNotAllowed, unauthorized } from 'lib/response';