👔 create boilerplate for user role module
add a few boilerplate including get by id and name for user role module
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
import { Context } from "elysia";
|
||||
import { mainErrorHandler } from "../../../helpers/error/handler";
|
||||
import { getUserRoleByNameSchema } from "../schemas/getUserRoleByName.schema";
|
||||
import { findUserRoleByNameService } from "../services/http/findUserRoleByName.service";
|
||||
|
||||
export const getUserRoleByNameController = async (ctx: Context) => {
|
||||
try {
|
||||
const params = getUserRoleByNameSchema.parse(ctx.params);
|
||||
return await findUserRoleByNameService(params.name);
|
||||
} catch (error) {
|
||||
return mainErrorHandler(ctx.set, error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user