- Introduced new components for form selection and gateway condition management within the process builder. - Implemented a `FormSelector` component for selecting and managing forms, including search functionality and loading states. - Developed a `GatewayConditionManager` component to manage conditions for gateways, allowing users to define and edit conditions visually. - Created a `ProcessBuilderComponents` component to facilitate the addition of core components in the process builder. - Enhanced the `ProcessFlowCanvas` to support new features, including edge selection and improved node management. - Updated the backend API to handle CRUD operations for forms and processes, including error handling for associated tasks. - Integrated new database models for forms and processes in Prisma, ensuring proper relationships and data integrity. - Improved state management in the form builder store to accommodate new features and enhance user experience.
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
import { PrismaClient } from '@prisma/client';
|
|
|
|
// Initialize Prisma client
|
|
const prisma = new PrismaClient();
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
try {
|
|
// Get all active forms
|
|
const forms = await prisma.form.findMany({
|
|
where: {
|
|
formStatus: 'active'
|
|
},
|
|
orderBy: {
|
|
formCreatedDate: 'desc'
|
|
},
|
|
select: {
|
|
formID: true,
|
|
formUUID: true,
|
|
formName: true,
|
|
formDescription: true,
|
|
formStatus: true,
|
|
formCreatedDate: true,
|
|
formModifiedDate: true,
|
|
// Don't include the full components data to keep response size small
|
|
creator: {
|
|
select: {
|
|
userID: true,
|
|
userFullName: true
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
return {
|
|
success: true,
|
|
forms
|
|
};
|
|
} catch (error) {
|
|
console.error('Error fetching forms:', error);
|
|
|
|
return {
|
|
success: false,
|
|
error: 'Failed to fetch forms',
|
|
details: process.env.NODE_ENV === 'development' ? error.message : undefined
|
|
};
|
|
}
|
|
});
|