mirror of
https://github.com/ipnet-mesh/meshcore-hub.git
synced 2026-10-30 19:52:03 +01:00
Add database-backed channels with role-based visibility and web dashboard
Replaces env-var channel keys with a Channel database model and periodic DB refresh in the collector. Adds Channels dashboard page with QR codes, channel visibility filtering on messages/dashboard APIs, and channel card navigation to filtered messages view.
This commit is contained in:
41 files changed
+1990
-134
No files matched your search
@@ -0,0 +1,58 @@
|
||||
"""add channels table
|
||||
|
||||
Revision ID: 82dff87d6576
|
||||
Revises: 20260515_1920
|
||||
Create Date: 2026-05-19 21:25:58.828179+00:00
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "82dff87d6576"
|
||||
down_revision: Union[str, None] = "20260515_1920"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table(
|
||||
"channels",
|
||||
sa.Column("name", sa.String(length=100), nullable=False),
|
||||
sa.Column("key_hex", sa.String(length=64), nullable=False),
|
||||
sa.Column("channel_hash", sa.String(length=2), nullable=False),
|
||||
sa.Column("visibility", sa.String(length=20), nullable=False),
|
||||
sa.Column("enabled", sa.Boolean(), nullable=False),
|
||||
sa.Column("id", sa.String(), nullable=False),
|
||||
sa.Column(
|
||||
"created_at",
|
||||
sa.DateTime(timezone=True),
|
||||
server_default=sa.text("(CURRENT_TIMESTAMP)"),
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column(
|
||||
"updated_at",
|
||||
sa.DateTime(timezone=True),
|
||||
server_default=sa.text("(CURRENT_TIMESTAMP)"),
|
||||
nullable=False,
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint("key_hex"),
|
||||
)
|
||||
with op.batch_alter_table("channels", schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f("ix_channels_name"), ["name"], unique=True)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("channels", schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f("ix_channels_name"))
|
||||
|
||||
op.drop_table("channels")
|
||||
# ### end Alembic commands ###
|
||||
Reference in new issue
Block a user