Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS-82 Add file upload api #16

Merged
merged 2 commits into from
Nov 11, 2024
Merged

FS-82 Add file upload api #16

merged 2 commits into from
Nov 11, 2024

Conversation

mic-smith
Copy link
Collaborator

Description

Add /uploadfile endpoint for uploading files (txt or pdf). PDF files have the text extracted using pypdf.
Text from the files is stored in redis.

Changelog

  • Add /uploadfile POST endpoint for uploading files
  • GET endpoint added for testing
  • Added default redis.conf and docker file to bundle. Disabled persistence in redis

@mic-smith mic-smith force-pushed the FS-82/upload-file-api branch from 02e99c9 to 38289a4 Compare November 6, 2024 16:34

def handle_file_upload(file:UploadFile) -> str:

if (file.size or 0) > MAX_FILE_SIZE:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is to protect from file.size being None, did you see this happen during testing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it was always set in test. I've updated the local FileUpload type to match with the None to simplify copying values below.

backend/src/file_upload_service.py Outdated Show resolved Hide resolved
backend/src/file_upload_service.py Outdated Show resolved Hide resolved
backend/src/file_upload_service.py Show resolved Hide resolved
backend/src/session/file_uploads.py Outdated Show resolved Hide resolved
redis/redis.conf Outdated Show resolved Hide resolved
Copy link
Collaborator

@gaganahluwalia gaganahluwalia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

Copy link
Collaborator

@IMladjenovic IMladjenovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. If you can add a link to where you found the default redis config file online that would be helpful if we need to make changes in the future. Minor detail though

@mic-smith mic-smith force-pushed the FS-82/upload-file-api branch from 7cd86cb to 6fc0607 Compare November 11, 2024 08:54
@mic-smith mic-smith merged commit 2cfe2d1 into main Nov 11, 2024
4 checks passed
@mic-smith mic-smith deleted the FS-82/upload-file-api branch November 11, 2024 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants