updated roles, only superAdmin can create an admin
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { FastifyReply, FastifyRequest } from "fastify";
|
||||
import mongoose from "mongoose";
|
||||
import { FastifyReply, FastifyRequest } from 'fastify';
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
export function errorHandler(
|
||||
error: any,
|
||||
@@ -12,7 +12,7 @@ export function errorHandler(
|
||||
|
||||
if (error.validation) {
|
||||
const errMsg = {
|
||||
type: "validation_error",
|
||||
type: 'validation_error',
|
||||
path: error.validation[0].instancePath,
|
||||
context: error.validationContext,
|
||||
msg: error.validation[0].message,
|
||||
@@ -25,9 +25,9 @@ export function errorHandler(
|
||||
if (error instanceof mongoose.mongo.MongoServerError) {
|
||||
if (error.code === 11000) {
|
||||
return res.code(400).send({
|
||||
type: "duplicate_key",
|
||||
context: "body",
|
||||
msg: "value already exists",
|
||||
type: 'duplicate_key',
|
||||
context: 'body',
|
||||
msg: 'value already exists',
|
||||
params: error.keyValue,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user