mirror of
https://github.com/fosrl/pangolin.git
synced 2026-01-28 22:00:51 +00:00
refactor contexts, format zod errors, and more refactoring
This commit is contained in:
@@ -8,6 +8,7 @@ import HttpCode from '@server/types/HttpCode';
|
||||
import createHttpError from 'http-errors';
|
||||
import { ActionsEnum, checkUserActionPermission } from '@server/auth/actions';
|
||||
import logger from '@server/logger';
|
||||
import { fromError } from 'zod-validation-error';
|
||||
|
||||
const updateOrgParamsSchema = z.object({
|
||||
orgId: z.string()
|
||||
@@ -27,7 +28,7 @@ export async function updateOrg(req: Request, res: Response, next: NextFunction)
|
||||
return next(
|
||||
createHttpError(
|
||||
HttpCode.BAD_REQUEST,
|
||||
parsedParams.error.errors.map(e => e.message).join(', ')
|
||||
fromError(parsedParams.error).toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -37,7 +38,7 @@ export async function updateOrg(req: Request, res: Response, next: NextFunction)
|
||||
return next(
|
||||
createHttpError(
|
||||
HttpCode.BAD_REQUEST,
|
||||
parsedBody.error.errors.map(e => e.message).join(', ')
|
||||
fromError(parsedBody.error).toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user