from sqlalchemy import Column, Integer, String, DateTime, ForeignKey from sqlalchemy.orm import relationship from .database import Base class Criteria(Base): __tablename__ = "criteria" id = Column(Integer, primary_key=True, index=True) name = Column(String(255)) class Role(Base): __tablename__ = "roles" id = Column(Integer, primary_key=True, index=True) name = Column(String(255)) class Student(Base): __tablename__ = "students" id = Column(Integer, primary_key=True, index=True) first_name = Column(String(50)) last_name = Column(String(50)) grade = Column(String(50), default="Brak ocen") points = Column(Integer, nullable=True) status = Column(Integer) class ClassInfo(Base): __tablename__ = "class_info" id = Column(Integer, primary_key=True, index=True) school = Column(String(255)) city = Column(String(255)) year = Column(String(50)) semester = Column(String(50)) subject = Column(String(255)) level = Column(String(50)) publisher = Column(String(255)) class_name = Column(String(50)) group = Column(String(50)) profile = Column(String(255)) max_points = Column(Integer) teacher = Column(String(255)) file_path = Column(String(255)) student_count = Column(Integer) class Event(Base): __tablename__ = "events" id = Column(Integer, primary_key=True, index=True) role_id = Column(Integer, ForeignKey("roles.id"), nullable=False) student_id = Column(Integer, ForeignKey("students.id"), nullable=False) criteria_id = Column(Integer, ForeignKey("criteria.id"), nullable=False) description = Column(String(255)) event_date = Column(DateTime) role = relationship("Role") student = relationship("Student") criteria = relationship("Criteria")