fapi/app/models.py

55 lines
1.8 KiB
Python
Raw Permalink Normal View History

2024-10-24 11:24:33 +00:00
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from .database import Base
2024-10-23 12:20:21 +00:00
2024-10-24 11:24:33 +00:00
class Criteria(Base):
__tablename__ = "criteria"
id = Column(Integer, primary_key=True, index=True)
name = Column(String(255))
2024-10-23 12:20:21 +00:00
2024-10-24 11:24:33 +00:00
class Role(Base):
__tablename__ = "roles"
id = Column(Integer, primary_key=True, index=True)
name = Column(String(255))
2024-10-23 12:20:21 +00:00
2024-10-24 11:24:33 +00:00
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)
2024-10-23 12:20:21 +00:00
2024-10-24 11:24:33 +00:00
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")
2024-10-23 12:20:21 +00:00