mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-17 04:58:19 -04:00
moved device registry to postgresql
This commit is contained in:
@@ -11,6 +11,7 @@ from python.orm.richie.contact import (
|
||||
Need,
|
||||
RelationshipType,
|
||||
)
|
||||
from python.orm.richie.signal_device import SignalDevice
|
||||
|
||||
__all__ = [
|
||||
"Bill",
|
||||
@@ -21,6 +22,7 @@ __all__ = [
|
||||
"Need",
|
||||
"RelationshipType",
|
||||
"RichieBase",
|
||||
"SignalDevice",
|
||||
"TableBase",
|
||||
"Vote",
|
||||
"VoteRecord",
|
||||
|
||||
26
python/orm/richie/signal_device.py
Normal file
26
python/orm/richie/signal_device.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""Signal bot device registry models."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import DateTime, String
|
||||
from sqlalchemy.dialects.postgresql import ENUM
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from python.orm.richie.base import TableBase
|
||||
from python.signal_bot.models import TrustLevel
|
||||
|
||||
|
||||
class SignalDevice(TableBase):
|
||||
"""A Signal device tracked by phone number and safety number."""
|
||||
|
||||
__tablename__ = "signal_device"
|
||||
|
||||
phone_number: Mapped[str] = mapped_column(String(50), unique=True)
|
||||
safety_number: Mapped[str]
|
||||
trust_level: Mapped[TrustLevel] = mapped_column(
|
||||
ENUM(TrustLevel, name="trust_level", create_type=True, schema="main"),
|
||||
default=TrustLevel.UNVERIFIED,
|
||||
)
|
||||
last_seen: Mapped[datetime] = mapped_column(DateTime(timezone=True))
|
||||
Reference in New Issue
Block a user