🚚 create backup folder
create backup folder for archive the old modules
This commit is contained in:
@ -0,0 +1,31 @@
|
||||
import {
|
||||
returnErrorResponse,
|
||||
returnWriteResponse,
|
||||
} from "../../../helpers/callback/httpResponse";
|
||||
import { Context } from "elysia";
|
||||
import { assignRoleToUserSchema } from "../schemas/assignRoleToUser.schema";
|
||||
import { mainErrorHandler } from "../../../helpers/error/handler";
|
||||
import { assignRoleToUserService } from "../services/assignRoleToUser.service";
|
||||
|
||||
export const assignRoleToUserController = async (ctx: Context) => {
|
||||
const validation = assignRoleToUserSchema.safeParse(ctx.body);
|
||||
if (!validation.success)
|
||||
return returnErrorResponse(
|
||||
ctx.set,
|
||||
400,
|
||||
"Invalid Request",
|
||||
validation.error
|
||||
);
|
||||
|
||||
try {
|
||||
const assignRoleToUser = await assignRoleToUserService(validation.data);
|
||||
return returnWriteResponse(
|
||||
ctx.set,
|
||||
201,
|
||||
"User Role Assigned Successfully",
|
||||
assignRoleToUser
|
||||
);
|
||||
} catch (error) {
|
||||
return mainErrorHandler(ctx.set, error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user