corrad-bp/server/api/roles/index.get.js
Afiq c35073f7fe Add Form and Task Node Configuration Components
- Introduced new components, FormNodeConfiguration and TaskNodeConfiguration, for configuring form and task nodes within the process builder.
- Enhanced the ProcessBuilder to support form and task node types, allowing users to define input/output mappings and assignment settings.
- Implemented backend API endpoints for fetching active users and roles, improving user assignment functionality in task nodes.
- Updated the ProcessFlowCanvas to handle updates for form and task nodes, ensuring consistent data management across node types.
- Improved overall user experience by refining the UI for node configuration and enhancing variable handling in the process builder.
2025-05-19 17:03:00 +08:00

36 lines
762 B
JavaScript

import { PrismaClient } from '@prisma/client';
export default defineEventHandler(async (event) => {
try {
const prisma = new PrismaClient();
// Get all active roles
const roles = await prisma.role.findMany({
where: {
roleStatus: 'active' // Assuming there's a status field to filter active roles
},
select: {
roleID: true,
roleName: true,
roleDescription: true
},
orderBy: {
roleName: 'asc'
}
});
await prisma.$disconnect();
return {
success: true,
roles: roles
};
} catch (error) {
console.error('Error fetching roles:', error);
return {
success: false,
error: 'Failed to fetch roles'
};
}
});