- Introduced a new RepeatingTable component for structured data collection, allowing users to add, edit, and delete records dynamically. - Enhanced FormBuilderComponents to include the RepeatingTable in the available components list with default properties. - Updated FormBuilderFieldSettingsModal to support configuration options for the RepeatingTable, including button texts, record limits, and display settings. - Implemented data management functions for updating table data and handling dynamic list items in the FormBuilder. - Improved ComponentPreview to render the RepeatingTable component correctly in preview mode. - Enhanced user experience with intuitive UI elements and responsive design for the new table component. - Updated documentation to reflect the addition of the RepeatingTable and its configuration options.
36 lines
749 B
JavaScript
36 lines
749 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' // Using ACTIVE to match database convention
|
|
},
|
|
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'
|
|
};
|
|
}
|
|
});
|