Upload the PDF into the SQLite database#4
Open
oliviayixincai wants to merge 3 commits intoadanomad:mainfrom
Open
Upload the PDF into the SQLite database#4oliviayixincai wants to merge 3 commits intoadanomad:mainfrom
oliviayixincai wants to merge 3 commits intoadanomad:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of PDF Upload Feature Implementation
Overview
In this update, I implemented the feature to upload PDF files into the SQLite database. This enhancement allows the application to store PDF documents directly in the database, facilitating easier management and retrieval of PDF files.
Approach
Code Changes
PdfStorageclass was updated to include methods for saving and retrieving PDFs in base64 format.POST /api/pdfwas added to handle the PDF upload requests. This route processes the incoming PDF data and stores it in the database.GET /api/pdfwas added to handle the PDF retrieval requests. This route retrieves the PDF data from the database and returns it to the client.SQLiteDatabaseclass was updated to include methods for saving and retrieving base64-encoded PDFs.pdfUtils.ts.Challenges
Understanding Frontend PDF Handling
One of the main challenges was understanding how the PDF file was handled on the frontend and finding the right place to upload it to the backend.
Solution: I thoroughly reviewed the existing frontend code to understand the flow of PDF handling. This helped me identify the appropriate place to integrate the upload functionality.
Getting Familiar with SQLite Backend
Another challenge was getting familiar with the SQLite backend, as it was crucial for storing and retrieving the PDF data.
Solution: I spent time learning the SQLite database operations and how to integrate them with the existing codebase. This included understanding the schema, writing queries, and handling database connections.
Future Work
Although the endpoint to retrieve stored PDFs from the database is already implemented, the frontend code to actually fetch and display these PDFs in the UI has not been developed yet. The next step would be to implement the functionality to fetch the stored PDFs from the database and render them in the application's UI. This will complete the end-to-end process of uploading, storing, and displaying PDFs.
Disclaimer: This summary was drafted with the assistance of ChatGPT.