👔 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:
Rafi Arrafif
2025-07-20 22:21:48 +07:00
parent 5c6e072622
commit e60bf0fd3e
17 changed files with 120 additions and 4 deletions

View File

@ -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);
}
};