Automated Action 5a02fb8b1f Implement comprehensive school portal API with FastAPI
- Complete authentication system with JWT and role-based access control
- User management for Admin, Teacher, Student, and Parent roles
- Student management with CRUD operations
- Class management and assignment system
- Subject and grade tracking functionality
- Daily attendance marking and viewing
- Notification system for announcements
- SQLite database with Alembic migrations
- Comprehensive API documentation with Swagger/ReDoc
- Proper project structure with services, models, and schemas
- Environment variable configuration
- CORS support and security features

🤖 Generated with BackendIM

Co-Authored-By: BackendIM <noreply@anthropic.com>
2025-06-25 13:31:56 +00:00

20 lines
841 B
Python

from typing import List
from sqlalchemy.orm import Session
from app.models.grade import Grade
from app.schemas.grade import GradeCreate, GradeUpdate
from app.services.base import CRUDBase
class CRUDGrade(CRUDBase[Grade, GradeCreate, GradeUpdate]):
def get_by_student(self, db: Session, *, student_id: int) -> List[Grade]:
return db.query(Grade).filter(Grade.student_id == student_id).all()
def get_by_subject(self, db: Session, *, subject_id: int) -> List[Grade]:
return db.query(Grade).filter(Grade.subject_id == subject_id).all()
def get_by_student_and_subject(self, db: Session, *, student_id: int, subject_id: int) -> List[Grade]:
return db.query(Grade).filter(
Grade.student_id == student_id,
Grade.subject_id == subject_id
).all()
grade_service = CRUDGrade(Grade)