models

Model definition for the domain.

API Reference

Shared models.

class server.domain.db.models.GitHubConfig(**kwargs)[source]

Bases: UUIDAuditBase

GitHub configuration.

A guild will be able to configure which organization or user they want as a default base, which repository they want as a default, and whether they would like to sync discussions with forum posts.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at: Mapped[datetime]

Date/time of instance creation.

id: Mapped[UUID]

UUID Primary key column.

updated_at: Mapped[datetime]

Date/time of instance last update.

class server.domain.db.models.Guild(**kwargs)[source]

Bases: UUIDAuditBase

Guild configuration.

A single guild will contain base defaults (e.g., prefix, boolean flags for linking, etc.) with configurable options that can be set by the guild owner or allowed_users.

Part of the feature set of Byte is that you have interactivity with your git repositories, StackOverflow, Discord forums, and other external services.

Here, a guild should be able to configure their own GitHub organization, StackOverflow tags, etc.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at: Mapped[datetime]

Date/time of instance creation.

id: Mapped[UUID]

UUID Primary key column.

updated_at: Mapped[datetime]

Date/time of instance last update.

class server.domain.db.models.SOTagsConfig(**kwargs)[source]

Bases: UUIDAuditBase

SQLAlchemy association model for a guild’s Stack Overflow tags config.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at: Mapped[datetime]

Date/time of instance creation.

id: Mapped[UUID]

UUID Primary key column.

updated_at: Mapped[datetime]

Date/time of instance last update.

class server.domain.db.models.User(**kwargs)[source]

Bases: UUIDAuditBase

SQLAlchemy model representing a user.

Todo

This may not really be needed?

Currently, a user in the Byte context is an individual user assigned to the guild’s allowed users config.

In the future we may want to expand this to allow for more granular permissions.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at: Mapped[datetime]

Date/time of instance creation.

id: Mapped[UUID]

UUID Primary key column.

updated_at: Mapped[datetime]

Date/time of instance last update.

Model Reference

server.domain.db.models.GitHubConfig (github_config)

GitHub configuration.

A guild will be able to configure which organization or user they want as a default base, which repository they want as a default, and whether they would like to sync discussions with forum posts.

Columns:

→ guild_id

BINARY(16)

discussion_sync

BOOLEAN

github_organization

VARCHAR?

github_repository

VARCHAR?

id*

BINARY(16)

sa_orm_sentinel

INTEGER?

created_at

DATETIME

updated_at

DATETIME

Constraints:

  • FOREIGN KEY (guild.id → guild_id)

  • PRIMARY KEY (id)

server.domain.db.models.SOTagsConfig (so_tags)

SQLAlchemy association model for a guild’s Stack Overflow tags config.

Columns:

→ guild_id

BINARY(16)

tag_name

VARCHAR(50)

id*

BINARY(16)

sa_orm_sentinel

INTEGER?

created_at

DATETIME

updated_at

DATETIME

Constraints:

  • FOREIGN KEY (guild.id → guild_id)

  • PRIMARY KEY (id)

  • UNIQUE (guild_id, tag_name)

server.domain.db.models.AllowedUsersConfig (allowed_users)

SQLAlchemy association model for a guild’s allowed users’ config.

A guild normally has a set of users to perform administrative actions, but sometimes we don’t want to give full administrative access to a user.

This model allows us to configure which users are allowed to perform administrative actions on Byte specifically without giving them full administrative access to the Discord guild.

Columns:

→ guild_id

BIGINT

→ user_id

BINARY(16)

id*

BINARY(16)

sa_orm_sentinel

INTEGER?

created_at

DATETIME

updated_at

DATETIME

Constraints:

  • FOREIGN KEY (guild.guild_id → guild_id)

  • FOREIGN KEY (user.id → user_id)

  • PRIMARY KEY (id)

  • UNIQUE (guild_id, user_id)

server.domain.db.models.User (user)

SQLAlchemy model representing a user.

Todo

This may not really be needed?

Currently, a user in the Byte context is an individual user assigned to the guild’s allowed users config.

In the future we may want to expand this to allow for more granular permissions.

Columns:

name

VARCHAR(100)

avatar_url

VARCHAR?

discriminator

VARCHAR(4)

id*

BINARY(16)

sa_orm_sentinel

INTEGER?

created_at

DATETIME

updated_at

DATETIME

Constraints:

  • PRIMARY KEY (id)

Mermaid Diagram

classDiagram AuditColumns <|-- UUIDAuditBase ColumnCollectionConstraint <|-- UniqueConstraint CommonTableAttributes <|-- UUIDAuditBase Concatenable <|-- String DDLConstraintColumnRole <|-- Mapped DeclarativeBase <|-- UUIDAuditBase DialectKWArgs <|-- ForeignKey InspectionAttrInfo <|-- AssociationProxy Integer <|-- BigInteger ORMDescriptor <|-- AssociationProxy ORMDescriptor <|-- Mapped SQLORMExpression <|-- Mapped SchemaItem <|-- ForeignKey TypeEngine <|-- String UUIDAuditBase <|-- AllowedUsersConfig UUIDAuditBase <|-- GitHubConfig UUIDAuditBase <|-- Guild UUIDAuditBase <|-- SOTagsConfig UUIDAuditBase <|-- User UUIDPrimaryKey <|-- UUIDAuditBase _AssociationProxyProtocol <|-- AssociationProxy _DCAttributeOptions <|-- AssociationProxy _MappedAnnotationBase <|-- Mapped