entity.models#

Module Contents#

Classes#

Base

Base class for all SQLAlchemy models in the FastAPI application.

TimeStampMixin

Mixin class providing timestamp information (created_at, updated_at) for SQLAlchemy models.

Picture

SQLAlchemy model representing the ‘pictures’ table in the database.

Tag

SQLAlchemy model representing the ‘tags’ table in the database.

TransformedPicture

SQLAlchemy model representing the ‘transformed_pictures’ table in the database.

Role

Enumeration class representing user roles in the FastAPI application.

User

SQLAlchemy model representing the ‘users’ table in the database.

Blacklisted

SQLAlchemy model representing the ‘blacklisted’ table in the database.

Comment

SQLAlchemy model representing the ‘comments’ table in the database.

Data#

API#

class entity.models.Base#

Bases: sqlalchemy.orm.DeclarativeBase

Base class for all SQLAlchemy models in the FastAPI application.

class entity.models.TimeStampMixin#

Mixin class providing timestamp information (created_at, updated_at) for SQLAlchemy models.

id: sqlalchemy.orm.Mapped[int] = 'mapped_column(...)'#
created_at: sqlalchemy.orm.Mapped[datetime.date] = 'mapped_column(...)'#
updated_at: sqlalchemy.orm.Mapped[datetime.date] = 'mapped_column(...)'#
entity.models.picture_tag_association = 'Table(...)'#
class entity.models.Picture#

Bases: entity.models.TimeStampMixin, entity.models.Base

SQLAlchemy model representing the ‘pictures’ table in the database.

__tablename__ = 'pictures'#
url: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
description: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
cloudinary_public_id: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
user_id: sqlalchemy.orm.Mapped[int] = 'mapped_column(...)'#
transformed_pictures: sqlalchemy.orm.Mapped[TransformedPicture] = 'relationship(...)'#
user: sqlalchemy.orm.Mapped[User] = 'relationship(...)'#
comment: sqlalchemy.orm.Mapped[List[Comment]] = 'relationship(...)'#
tags: sqlalchemy.orm.Mapped[List[Tag]] = 'relationship(...)'#
class entity.models.Tag#

Bases: entity.models.TimeStampMixin, entity.models.Base

SQLAlchemy model representing the ‘tags’ table in the database.

__tablename__ = 'tags'#
name: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
pictures: sqlalchemy.orm.Mapped[List[entity.models.Picture]] = 'relationship(...)'#
class entity.models.TransformedPicture#

Bases: entity.models.TimeStampMixin, entity.models.Base

SQLAlchemy model representing the ‘transformed_pictures’ table in the database.

__tablename__ = 'transformed_pictures'#
original_picture_id: sqlalchemy.orm.Mapped[int] = 'mapped_column(...)'#
url: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
public_id: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
qr_url: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
qr_public_id: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
user_id: sqlalchemy.orm.Mapped[int] = 'mapped_column(...)'#
original_picture = 'relationship(...)'#
class entity.models.Role(*args, **kwds)#

Bases: enum.Enum

Enumeration class representing user roles in the FastAPI application.

Initialization

admin: str = 'admin'#
moderator: str = 'moderator'#
user: str = 'user'#
class entity.models.User#

Bases: entity.models.TimeStampMixin, entity.models.Base

SQLAlchemy model representing the ‘users’ table in the database.

__tablename__ = 'users'#
full_name: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
email: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
password: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
avatar: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
refresh_token: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
role: sqlalchemy.orm.Mapped[sqlalchemy.Enum] = 'mapped_column(...)'#
ban: sqlalchemy.orm.Mapped[bool] = 'mapped_column(...)'#
picture_count: sqlalchemy.orm.Mapped[Optional[int]] = 'mapped_column(...)'#
pictures: sqlalchemy.orm.Mapped[entity.models.Picture] = 'relationship(...)'#
blacklisted_tokens: sqlalchemy.orm.Mapped[Blacklisted] = 'relationship(...)'#
comment: sqlalchemy.orm.Mapped[Comment] = 'relationship(...)'#
class entity.models.Blacklisted#

Bases: entity.models.TimeStampMixin, entity.models.Base

SQLAlchemy model representing the ‘blacklisted’ table in the database.

__tablename__ = 'blacklisted'#
user_id: sqlalchemy.orm.Mapped[int] = 'mapped_column(...)'#
token: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
user = 'relationship(...)'#
class entity.models.Comment#

Bases: entity.models.TimeStampMixin, entity.models.Base

SQLAlchemy model representing the ‘comments’ table in the database.

__tablename__ = 'comments'#
user_id: sqlalchemy.orm.Mapped[int] = 'mapped_column(...)'#
picture_id: sqlalchemy.orm.Mapped[int] = 'mapped_column(...)'#
text: sqlalchemy.orm.Mapped[str] = 'mapped_column(...)'#
user = 'relationship(...)'#
picture: sqlalchemy.orm.Mapped[List[entity.models.Picture]] = 'relationship(...)'#