Spaces:
Build error
Build error
File size: 902 Bytes
b7a7f32 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
from cruds.base import CRUDBase
from schemas.assignment_upload import AssignmentUploadCreate, AssignmentUploadUpdate
from models.assignment_upload import AssignmentUpload
from sqlalchemy.orm import Session
from cruds import crud_user, crud_group
from models import User
from typing import Any
class CRUDAssignmentUpload(
CRUDBase[AssignmentUpload, AssignmentUploadCreate, AssignmentUploadUpdate]
):
def get_by_assignment_id(self, db: Session, *, assignmentId: int, studentId: int):
return (
db.query(self.model)
.filter_by(assignment_id=assignmentId)
.filter_by(student_id=studentId)
.first()
)
def get_all_by_assignment_id_as_teacher(self, db: Session, *, assignmentId: int):
return db.query(self.model).filter_by(assignment_id=assignmentId).all()
crud_assignment_upload = CRUDAssignmentUpload(AssignmentUpload)
|