
- 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
1019 B
Python
21 lines
1019 B
Python
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Date, Boolean
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy.sql import func
|
|
from app.db.base import Base
|
|
|
|
class Attendance(Base):
|
|
__tablename__ = "attendance"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
student_id = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
class_id = Column(Integer, ForeignKey("classes.id"), nullable=False)
|
|
date = Column(Date, nullable=False)
|
|
is_present = Column(Boolean, default=False)
|
|
remarks = Column(String)
|
|
marked_by = Column(Integer, ForeignKey("users.id"), nullable=False)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
|
|
|
student = relationship("User", foreign_keys=[student_id], back_populates="attendance_records")
|
|
class_ref = relationship("Class", back_populates="attendance_records")
|
|
teacher = relationship("User", foreign_keys=[marked_by]) |