DataTable refactor.

This commit is contained in:
Mike Cao 2023-09-22 00:59:00 -07:00
parent 92ccc64e47
commit 6846355c63
17 changed files with 94 additions and 114 deletions

View file

@ -3,7 +3,7 @@ import { ROLES } from 'lib/constants';
import { uuid } from 'lib/crypto';
import { useAuth, useValidate } from 'lib/middleware';
import { NextApiRequestQueryBody, Role, SearchFilter, User, UserSearchFilterType } from 'lib/types';
import { getFilterValidation } from 'lib/yup';
import { pageInfo } from 'lib/schema';
import { NextApiResponse } from 'next';
import { badRequest, hashPassword, methodNotAllowed, ok, unauthorized } from 'next-basics';
import { createUser, getUserByUsername, getUsers } from 'queries';
@ -19,7 +19,7 @@ export interface UsersRequestBody {
import * as yup from 'yup';
const schema = {
GET: yup.object().shape({
...getFilterValidation(/All|Username/i),
...pageInfo,
}),
POST: yup.object().shape({
username: yup.string().max(255).required(),