mirror of
https://github.com/vee1e/bulk-questionnaire-upload.git
synced 2026-09-01 09:50:06 +00:00
3.4 KiB
3.4 KiB
mForm Bulk Upload
About the Frontend
This frontend is a modern Angular application for bulk uploading, validating, and managing questionnaire forms (in Excel format). It provides a user-friendly interface for users to drag-and-drop or browse files, validate them, upload them to the backend, and view/manage parsed forms and their details.
Main Features
- Bulk Upload: Drag-and-drop or select multiple Excel files for upload.
- Validation: Validate all selected files before uploading to ensure correct format and content.
- Form Management: View a list of all uploaded forms, search by title, and delete individual or all forms.
- Form Details: Click on a form to view its questions, options, and metadata in a modal dialog.
- Responsive UI: Built with Angular Material for a clean, modern, and responsive user experience.
Key Components
- Navbar: Displays the application title and navigation bar.
- Search: Allows searching forms by title.
- Upload: Handles file selection, validation, upload, and displays the list of forms and their details.
Project Structure
src/app/components/navbar/- Navigation bar componentsrc/app/components/search/- Search bar componentsrc/app/components/upload/- Main upload and form management componentsrc/app/services/- Services for form parsing and backend API communicationsrc/app/models/- TypeScript interfaces for form and question data
Backend Integration Points
This document outlines where and how the frontend communicates with the backend API for easy maintenance and future updates.
Main Integration Service
FormService (src/app/services/form.service.ts)
This Angular service encapsulates all HTTP communication with the backend API. It is the single source of truth for API endpoints used by the frontend.
Endpoints Used:
POST /api/validate— Validate a form file before uploadPOST /api/upload— Upload a form file (single or multiple)GET /api/forms— Fetch all uploaded formsGET /api/forms/:formId— Fetch details for a specific formDELETE /api/forms/:formId— Delete a specific formDELETE /api/forms— Delete all forms
Service Methods:
validateFile(file: File)uploadFile(file: File)uploadFiles(files: File[])getAllForms()getFormById(formId: string)deleteForm(formId: string)deleteAllForms()
Components Using Backend Integration
UploadComponent (src/app/components/upload/upload.component.ts)
- Uses
FormServiceto:- Validate files before upload
- Upload files
- Fetch the list of forms
- Delete individual forms
- Delete all forms
- Fetch form details for preview
NavbarComponent (src/app/components/navbar/navbar.component.ts)
- Indirectly uses backend data via
FormPreviewService, which is populated byUploadComponentusingFormService.
How to Update Backend Endpoints
- All backend API URLs are defined in
FormServiceasapiUrl. - To change the backend base URL or endpoints, update
FormServiceaccordingly. - If new endpoints are added to the backend, add corresponding methods to
FormServiceand use them in components as needed.
Maintenance Tips
- Keep all backend API calls centralized in
FormServicefor consistency and easy updates. - Avoid direct HTTP calls in components; always use the service.
- Update this documentation whenever new integration points are added.