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.
close #162
Summary
This pull request introduces several changes to enhance the database schema, improve API schema definitions, and update the backend logic to accommodate new constraints and data structures. The most important changes include adding unique constraints to the
Language
andTestCase
tables, updating the Prisma schema, refining API schema definitions, and modifying backend service logic.Database Schema Changes:
Language
andTestCase
tables to ensure data integrity. (backend/prisma/migrations/20241104023951_set_unique_fields/migration.sql
)Prisma Schema Updates:
Language
model to include a unique constraint on[languageName, languageVersion, problemId]
. (backend/prisma/schema.prisma
)TestCase
model to include a unique constraint on[input, output, problemId]
. (backend/prisma/schema.prisma
)API Schema Definitions:
SupportedLanguage
,LanguageCreate
,LanguageUpdate
,TestCaseCreate
, andTestCaseUpdate
. (backend/src/api/components/schemas.ts
)ProblemCreate
andProblemUpdate
schemas to include arrays ofsupported_languages
andtest_cases
. (backend/src/api/components/schemas.ts
)Backend Logic Updates:
getProblemsRoute
,createProblemRoute
,getProblemRoute
, andupdateProblemRoute
to handle the new schema definitions and include IDs forsupported_languages
andtest_cases
. (backend/src/api/paths/problems.ts
) [1] [2] [3] [4] [5] [6]run.ts
andtest.ts
to use the newSupportedLanguage
type. (backend/src/services/program/run.ts
,backend/src/services/program/test.ts
) [1] [2] [3] [4]