diff --git a/server/crud/submission_CRUD.py b/server/crud/submission_CRUD.py index d648354..8dafe97 100644 --- a/server/crud/submission_CRUD.py +++ b/server/crud/submission_CRUD.py @@ -30,7 +30,9 @@ def read_all_by_team_id(db: Session, team_uuid: uuid) -> list[Type[Submission]]: def update(db: Session, id: int, submission: SubmissionWTeam) -> Submission | None: db_submission: Submission | None = (db.query(Submission) - .filter(Submission.submission_id == id).one_or_none()) + .filter(and_(Submission.submission_id == id, + Submission.team_id_uuid == submission.team_id_uuid)) + .one_or_none()) if db_submission is None: return diff --git a/server/models/submission.py b/server/models/submission.py index b2a3b7b..f476d28 100644 --- a/server/models/submission.py +++ b/server/models/submission.py @@ -12,6 +12,7 @@ class Submission(Base): __tablename__: str = 'submission' submission_id: Mapped[int] = mapped_column(Integer(), primary_key=True, autoincrement=True) team_id_uuid: Mapped[int] = mapped_column(Integer(), ForeignKey("team.team_id_uuid")) + error_id: Mapped[int] = mapped_column(Integer(), ForeignKey("errors.error_id")) submission_time: Mapped[str] = mapped_column(DateTime(), nullable=False) file_txt: Mapped[str] = mapped_column(LargeBinary(), nullable=False) diff --git a/server/schemas/submission_schema.py b/server/schemas/submission_schema.py index f2dbffa..13b1486 100644 --- a/server/schemas/submission_schema.py +++ b/server/schemas/submission_schema.py @@ -5,6 +5,7 @@ class SubmissionBase(BaseModel): submission_id: int + error_id: int submission_time: str file_txt: str