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

Patch for a few things missing #103

Merged
merged 5 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion server/crud/submission_CRUD.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions server/models/submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions server/schemas/submission_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

class SubmissionBase(BaseModel):
submission_id: int
error_id: int
submission_time: str
file_txt: str

Expand Down