
- 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>
21 lines
995 B
Python
21 lines
995 B
Python
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Float
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy.sql import func
|
|
from app.db.base import Base
|
|
|
|
class Grade(Base):
|
|
__tablename__ = "grades"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
student_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
subject_id = Column(Integer, ForeignKey("subjects.id"), nullable=False)
|
|
score = Column(Float, nullable=False)
|
|
max_score = Column(Float, nullable=False, default=100.0)
|
|
grade_type = Column(String, nullable=False) # quiz, exam, assignment, etc.
|
|
description = Column(String)
|
|
graded_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
|
|
|
student = relationship("User", back_populates="grades")
|
|
subject = relationship("Subject", back_populates="grades") |