Julia - Upload Functionality for Write Tasks Backend#1868
Merged
one-community merged 5 commits intodevelopmentfrom Nov 23, 2025
Merged
Julia - Upload Functionality for Write Tasks Backend#1868one-community merged 5 commits intodevelopmentfrom
one-community merged 5 commits intodevelopmentfrom
Conversation
Member
|
Thank you all, merging! |
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.









Description
Upon successful upload or link submission:
◦ Update backend to save the file (in S3 or server folder) or store the submitted link.
◦ Change the corresponding task’s status to Submitted.
◦ Record submission timestamp and support versioning for multiple uploads.
Features -
• Support uploading files of specific allowed types (e.g., PDF, DOCX, TXT, images).
• Enforce file size limits (e.g., max 10 MB).
• Validate upload type and size on frontend and backend with user-friendly error messages.
Accepts:task_id (required)
• student_id (from authenticated session or explicitly)
• Either file (multipart/form-data) OR link (string)
Validations:
• File type whitelist (e.g., .pdf, .docx, .txt, .png, .jpg)
• Max file size limit (e.g., 10 MB)
• Proper URL format for links
On success:
• Save uploaded file to secure storage (S3 or server directory).
• Store file URL or submitted link in the submission_link field of the student's task record.
• Update status to "Submitted" and record submission_time.
On failure:
• Return meaningful error messages to users (e.g., “Unsupported file type”, “File exceeds maximum size”, “Invalid URL format”).
Related PRS (if any):
This frontend PR is related to the #XXX backend PR.
To test this backend PR you need to checkout the #XXX frontend PR.
…
Main changes explained:
{
url: url_link_here
}
After submitting, the file will be uploaded to AWS S3. Links will be saved to our MongoDB. Status and completedDate of the task will be updated
How to test:
Requirements
In order to test this branch, you have to get access to an AWS S3
AWS_ACCESS_KEY_ID={Your access key}
AWS_SECRET_ACCESS_KEY={Your secret access key}
AWS_REGION={Your region} (See on the navbar top right side)
S3_BUCKET_NAME={The bucket you created}
Test
npm install, 'npm run build' and...to run this PR locallyGet your user id:
10. Send a GET request to http://localhost:4500/api/userProfile/singleName/{your first name or last name here}
11. Look at the result and note down the user Id of your current login account
Create a task
13. Send POST request to http://localhost:4500/api/education-tasks
example body {
"name": "Test task",
"status":"assigned",
"lessonPlanId": "68ed6e6e746d9b633a6158f2",
"atomIds": ["68def3a5f0844c6916607a9c"],
"type": "write",
"dueAt": "2025-10-24T00:00:00.000+00:00",
"studentId": {Your_user_id_Here}
}
Note down your task ID
**Test my API - upload a file
14. Send a POST request to http://localhost:4500/api/student/tasks/{your_task_id}/upload
In the body, choose form-data.
In key field, choose file
In value, upload a file
Click Send
15. Send a GET request to http://localhost:4500/api/education-tasks/{your_task_id}
16. Confirm that status has changed to completed, completedAt is updated to today, and the link to your file is added to uploadUrls
**Test my API - upload an url
18. Send a POST request to http://localhost:4500/api/student/tasks/{your_task_id}/upload
body {
"url": "A valid URL here"
}
Click Send
19. Send a GET request to http://localhost:4500/api/education-tasks/{your_task_id}
20. Confirm that status has changed to completed, completedAt is updated to today, and the link to your file is added to uploadUrls
Cleanup
Screenshots or videos of changes:
How.to.test.PR.mp4
Note:
Include the information the reviewers need to know.