corrad-bp/server/api/users/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

37 lines
792 B
JavaScript

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