fixing user role module to extend repositoies and schemas
This commit is contained in:
@ -4,10 +4,10 @@ import {
|
|||||||
returnErrorResponse,
|
returnErrorResponse,
|
||||||
returnWriteResponse,
|
returnWriteResponse,
|
||||||
} from "../../../helpers/callback/httpResponse";
|
} from "../../../helpers/callback/httpResponse";
|
||||||
import { createUserRoleSchema } from "../userRole.schema";
|
|
||||||
import { createUserRoleService } from "../services/createUserRole.service";
|
import { createUserRoleService } from "../services/createUserRole.service";
|
||||||
import { handlePrismaError } from "../../../helpers/error/instances/prisma";
|
|
||||||
import { JWTDecodeToken } from "../../../helpers/cookies/jwt/decodeToken";
|
import { JWTDecodeToken } from "../../../helpers/cookies/jwt/decodeToken";
|
||||||
|
import { mainErrorHandler } from "../../../helpers/error/handler";
|
||||||
|
import { createUserRoleSchema } from "../schemas/createUserRole.schema";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function createUserRole
|
* @function createUserRole
|
||||||
@ -63,7 +63,6 @@ export const createUserRole = async (
|
|||||||
newUserRole
|
newUserRole
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const { status, message, details } = handlePrismaError(error);
|
return mainErrorHandler(ctx.set, error);
|
||||||
return returnErrorResponse(ctx.set, status, message, details);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Prisma } from "@prisma/client";
|
import { Prisma } from "@prisma/client";
|
||||||
import { userRoleModel } from "./userRole.model";
|
import { userRoleModel } from "../userRole.model";
|
||||||
|
|
||||||
export const createUserRoleRepo = async (
|
export const createUserRoleRepo = async (
|
||||||
data: Prisma.UserRoleUncheckedCreateInput
|
data: Prisma.UserRoleUncheckedCreateInput
|
||||||
@ -1,5 +1,5 @@
|
|||||||
import { Prisma } from "@prisma/client";
|
import { Prisma } from "@prisma/client";
|
||||||
import { createUserRoleRepo } from "../userRole.repository";
|
import { createUserRoleRepo } from "../repositories/createUserRole.repository";
|
||||||
|
|
||||||
export const createUserRoleService = async (
|
export const createUserRoleService = async (
|
||||||
userRoleData: Prisma.UserRoleUncheckedCreateInput
|
userRoleData: Prisma.UserRoleUncheckedCreateInput
|
||||||
|
|||||||
Reference in New Issue
Block a user