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

feat(backend): implement getSubmissionById #181

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

r4ai
Copy link
Member

@r4ai r4ai commented Nov 3, 2024

close #133

Summary

This pull request includes significant updates to the backend/src/api/paths/submissions.ts file, focusing on improving type validation and enhancing database query handling for submission data retrieval.

Type Validation Improvements:

  • Updated the SubmissionIdParam schema to validate submissionId as a string that is coerced into a nonnegative integer. This change ensures better type handling and consistency.

Database Query Enhancements:

  • Modified the getSubmissionByIdRoute to perform an actual database query using Prisma. The new implementation includes fetching related result and testResults data, ensuring comprehensive data retrieval.
  • Added error handling for invalid submission and test statuses, throwing errors if the statuses are not valid. This ensures data integrity and prevents unexpected states.
  • Included a detailed response structure for the submission data, ensuring all necessary fields are returned in the JSON response. This includes code, id, language, problem_id, result, student_id, submitted_at, and test_results.

@r4ai r4ai requested a review from sou1118 November 3, 2024 18:00
@r4ai r4ai self-assigned this Nov 3, 2024
@r4ai r4ai enabled auto-merge (squash) November 3, 2024 18:00
Copy link
Member

@sou1118 sou1118 left a comment

Choose a reason for hiding this comment

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

LGTM!

@r4ai r4ai merged commit 42a01d7 into main Nov 4, 2024
19 checks passed
@r4ai r4ai deleted the feature/issue-133-get-submission-by-id branch November 4, 2024 03:41
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.

提出の詳細を取得するAPIを実装する
2 participants