sidequest_common.models.role_resets#

Discord role-reset outbox: a site account was deleted and must be stripped of every manageable Discord role.

Classes#

MemberRoleReset

One Discord user who deleted their site account and still needs their Discord roles stripped.

Module Contents#

class sidequest_common.models.role_resets.MemberRoleReset#

Bases: advanced_alchemy.base.UUIDAuditBase

One Discord user who deleted their site account and still needs their Discord roles stripped.

Written by MembersService.delete_account in the same transaction as the account deletion, so the outbox row survives even though the Member row it’s about is gone. The bot’s link_roles plugin removes every role it can manage from discord_id (keeping @everyone, managed/integration roles, and anything at or above its own top role, which Discord would reject anyway) and immediately re-grants the gate role, since the member is now unlinked; it then acks via POST .../role-resets/{id}/ack, which sets done_at. A member no longer in the guild is acked as done without any role changes. requested_at orders the outbox oldest-first; rows that go unacked past the API’s retention window (e.g. the member left before the bot could act) are dropped by the listing route rather than sitting forever.

discord_id: sqlalchemy.orm.Mapped[int]#
done_at: sqlalchemy.orm.Mapped[datetime.datetime | None]#
requested_at: sqlalchemy.orm.Mapped[datetime.datetime]#