|
|
@ -24,6 +24,10 @@ class User(db.Model): |
|
|
|
sessions: Mapped[List["Session"]] = relationship(back_populates="user", cascade="all, delete-orphan") |
|
|
|
sessions: Mapped[List["Session"]] = relationship(back_populates="user", cascade="all, delete-orphan") |
|
|
|
enrollments: Mapped[List["Enrollment"]] = relationship(back_populates="user", cascade="all, delete-orphan") |
|
|
|
enrollments: Mapped[List["Enrollment"]] = relationship(back_populates="user", cascade="all, delete-orphan") |
|
|
|
quizzes: Mapped[List["Quiz"]] = relationship(back_populates="creatorUser", cascade="all, delete-orphan") |
|
|
|
quizzes: Mapped[List["Quiz"]] = relationship(back_populates="creatorUser", cascade="all, delete-orphan") |
|
|
|
|
|
|
|
quiz_attempts: Mapped[List["QuizAttempt"]] = relationship(back_populates="user", cascade="all, delete-orphan") |
|
|
|
|
|
|
|
chats: Mapped[List["Chat"]] = relationship(back_populates="user", cascade="all, delete-orphan") |
|
|
|
|
|
|
|
notifications: Mapped[List["Notification"]] = relationship(back_populates="user", cascade="all, delete-orphan") |
|
|
|
|
|
|
|
user_badges: Mapped[List["UserBadge"]] = relationship(back_populates="user", cascade="all, delete-orphan") |
|
|
|
pfpFilename: Mapped[str] = mapped_column(String(256), nullable=False, default=DEFAULT_PROFILE_FILE) |
|
|
|
pfpFilename: Mapped[str] = mapped_column(String(256), nullable=False, default=DEFAULT_PROFILE_FILE) |
|
|
|
joinedDate: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=func.now()) |
|
|
|
joinedDate: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=func.now()) |
|
|
|
lastOnline: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=func.now(), onupdate=func.now()) |
|
|
|
lastOnline: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=func.now(), onupdate=func.now()) |
|
|
@ -62,6 +66,7 @@ class Course(db.Model): |
|
|
|
category: Mapped["Category"] = relationship(back_populates="courses") |
|
|
|
category: Mapped["Category"] = relationship(back_populates="courses") |
|
|
|
enrollments: Mapped[List["Enrollment"]] = relationship(back_populates="course", cascade="all, delete-orphan") |
|
|
|
enrollments: Mapped[List["Enrollment"]] = relationship(back_populates="course", cascade="all, delete-orphan") |
|
|
|
quizzes: Mapped[List['Quiz']] = relationship(back_populates="course", cascade="all, delete-orphan") |
|
|
|
quizzes: Mapped[List['Quiz']] = relationship(back_populates="course", cascade="all, delete-orphan") |
|
|
|
|
|
|
|
chats: Mapped[List["Chat"]] = relationship(back_populates="course", cascade="all, delete-orphan") |
|
|
|
description: Mapped[str] = mapped_column(String(1024), nullable=False, default='') |
|
|
|
description: Mapped[str] = mapped_column(String(1024), nullable=False, default='') |
|
|
|
isActive: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True) |
|
|
|
isActive: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True) |
|
|
|
publishedStatus: Mapped[int] = mapped_column(SmallInteger, nullable=False, default=PublishedStatus.DRAFT) |
|
|
|
publishedStatus: Mapped[int] = mapped_column(SmallInteger, nullable=False, default=PublishedStatus.DRAFT) |
|
|
@ -69,6 +74,7 @@ class Course(db.Model): |
|
|
|
coverImage: Mapped[str] = mapped_column(String(256), nullable=False, default=DEFAULT_COURSE_COVER) |
|
|
|
coverImage: Mapped[str] = mapped_column(String(256), nullable=False, default=DEFAULT_COURSE_COVER) |
|
|
|
serverFilename: Mapped[str] = mapped_column(String(256), nullable=False, default='') |
|
|
|
serverFilename: Mapped[str] = mapped_column(String(256), nullable=False, default='') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Enrollment(db.Model): |
|
|
|
class Enrollment(db.Model): |
|
|
|
__tablename__ = 'enrollment' |
|
|
|
__tablename__ = 'enrollment' |
|
|
|
|
|
|
|
|
|
|
@ -88,6 +94,7 @@ class Quiz(db.Model): |
|
|
|
id: Mapped[uuid.UUID] = mapped_column(types.Uuid, primary_key=True, init=False, server_default=text("gen_random_uuid()")) |
|
|
|
id: Mapped[uuid.UUID] = mapped_column(types.Uuid, primary_key=True, init=False, server_default=text("gen_random_uuid()")) |
|
|
|
creatorUserID: Mapped[uuid.UUID] = mapped_column(ForeignKey("user.id")) |
|
|
|
creatorUserID: Mapped[uuid.UUID] = mapped_column(ForeignKey("user.id")) |
|
|
|
creatorUser: Mapped["User"] = relationship(back_populates="quizzes") |
|
|
|
creatorUser: Mapped["User"] = relationship(back_populates="quizzes") |
|
|
|
|
|
|
|
quiz_attempts: Mapped[List["QuizAttempt"]] = relationship(back_populates="quiz", cascade="all, delete-orphan") |
|
|
|
courseID: Mapped[uuid.UUID] = mapped_column(ForeignKey("course.id")) |
|
|
|
courseID: Mapped[uuid.UUID] = mapped_column(ForeignKey("course.id")) |
|
|
|
course: Mapped["Course"] = relationship(back_populates="quizzes") |
|
|
|
course: Mapped["Course"] = relationship(back_populates="quizzes") |
|
|
|
quizJson: Mapped[str] = mapped_column(String, nullable=False) |
|
|
|
quizJson: Mapped[str] = mapped_column(String, nullable=False) |
|
|
@ -133,6 +140,7 @@ class Badge(db.Model): |
|
|
|
|
|
|
|
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(types.Uuid, primary_key=True, init=False, server_default=text("gen_random_uuid()")) |
|
|
|
id: Mapped[uuid.UUID] = mapped_column(types.Uuid, primary_key=True, init=False, server_default=text("gen_random_uuid()")) |
|
|
|
name: Mapped[str] = mapped_column(String(16), nullable=False) |
|
|
|
name: Mapped[str] = mapped_column(String(16), nullable=False) |
|
|
|
|
|
|
|
user_badges: Mapped[List["UserBadge"]] = relationship(back_populates="badge", cascade="all, delete-orphan") |
|
|
|
description: Mapped[str] = mapped_column(String(256), nullable=False, default='') |
|
|
|
description: Mapped[str] = mapped_column(String(256), nullable=False, default='') |
|
|
|
createDate: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=func.now()) |
|
|
|
createDate: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=func.now()) |
|
|
|
icon: Mapped[str] = mapped_column(String(256), nullable=False, default='') |
|
|
|
icon: Mapped[str] = mapped_column(String(256), nullable=False, default='') |
|
|
|