|
|
@ -4,8 +4,8 @@ from sqlalchemy import types, text, String, DateTime, func, Boolean, ForeignKey, |
|
|
|
from datetime import datetime |
|
|
|
from datetime import datetime |
|
|
|
import uuid |
|
|
|
import uuid |
|
|
|
from typing import List |
|
|
|
from typing import List |
|
|
|
from ..config import * |
|
|
|
from config import * |
|
|
|
from ..constants import UserRole, PublishedStatus |
|
|
|
from constants import UserRole, PublishedStatus |
|
|
|
|
|
|
|
|
|
|
|
class Base(MappedAsDataclass, DeclarativeBase): |
|
|
|
class Base(MappedAsDataclass, DeclarativeBase): |
|
|
|
pass |
|
|
|
pass |
|
|
@ -28,8 +28,8 @@ class User(db.Model): |
|
|
|
quiz_attempts: Mapped[List["QuizAttempt"]] = relationship(back_populates="user", 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") |
|
|
|
chats: Mapped[List["Chat"]] = relationship(back_populates="user", cascade="all, delete-orphan") |
|
|
|
notifications: Mapped[List["Notification"]] = relationship(back_populates="user", cascade="all, delete-orphan") |
|
|
|
notifications: Mapped[List["Notification"]] = relationship(back_populates="user", cascade="all, delete-orphan") |
|
|
|
dob: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=datetime.fromisocalendar(2002, 1, 1)) |
|
|
|
|
|
|
|
user_badges: Mapped[List["UserBadge"]] = relationship(back_populates="user", cascade="all, delete-orphan") |
|
|
|
user_badges: Mapped[List["UserBadge"]] = relationship(back_populates="user", cascade="all, delete-orphan") |
|
|
|
|
|
|
|
dob: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=datetime.fromisocalendar(2002, 1, 1)) |
|
|
|
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()) |
|
|
|