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)!: 問題の更新処理を修正 #182

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

r4ai
Copy link
Member

@r4ai r4ai commented Nov 4, 2024

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 and TestCase tables, updating the Prisma schema, refining API schema definitions, and modifying backend service logic.

Database Schema Changes:

  • Added unique constraints to the Language and TestCase tables to ensure data integrity. (backend/prisma/migrations/20241104023951_set_unique_fields/migration.sql)

Prisma Schema Updates:

  • Updated the Language model to include a unique constraint on [languageName, languageVersion, problemId]. (backend/prisma/schema.prisma)
  • Updated the TestCase model to include a unique constraint on [input, output, problemId]. (backend/prisma/schema.prisma)

API Schema Definitions:

  • Defined new schemas for SupportedLanguage, LanguageCreate, LanguageUpdate, TestCaseCreate, and TestCaseUpdate. (backend/src/api/components/schemas.ts)
  • Enhanced ProblemCreate and ProblemUpdate schemas to include arrays of supported_languages and test_cases. (backend/src/api/components/schemas.ts)

Backend Logic Updates:

  • Adjusted the getProblemsRoute, createProblemRoute, getProblemRoute, and updateProblemRoute to handle the new schema definitions and include IDs for supported_languages and test_cases. (backend/src/api/paths/problems.ts) [1] [2] [3] [4] [5] [6]
  • Updated service logic in run.ts and test.ts to use the new SupportedLanguage type. (backend/src/services/program/run.ts, backend/src/services/program/test.ts) [1] [2] [3] [4]

@r4ai r4ai self-assigned this Nov 4, 2024
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.

問題の更新時に、配列の削除と更新ができていない
1 participant