refactor: align backend layout and supabase infra
Consolidate backend modules/tests under the backend package while syncing Supabase compose/env config and related plans.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from models.profile import Profile
|
||||
|
||||
__all__ = ["Profile"]
|
||||
@@ -0,0 +1,43 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import String, Text
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from core.db.base import Base, SoftDeleteMixin, TimestampMixin
|
||||
|
||||
|
||||
class Profile(TimestampMixin, SoftDeleteMixin, Base):
|
||||
"""User profile model.
|
||||
|
||||
Note: The `id` column references auth.users(id) in Supabase.
|
||||
This is a business table managed by SQLAlchemy, with the foreign key
|
||||
relationship to Supabase's auth schema handled at the database level.
|
||||
"""
|
||||
|
||||
__tablename__: str = "profiles"
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(
|
||||
UUID(as_uuid=True),
|
||||
primary_key=True,
|
||||
)
|
||||
username: Mapped[str] = mapped_column(
|
||||
String(30),
|
||||
unique=True,
|
||||
nullable=False,
|
||||
index=True,
|
||||
)
|
||||
display_name: Mapped[str | None] = mapped_column(
|
||||
String(50),
|
||||
nullable=True,
|
||||
)
|
||||
avatar_url: Mapped[str | None] = mapped_column(
|
||||
Text,
|
||||
nullable=True,
|
||||
)
|
||||
bio: Mapped[str | None] = mapped_column(
|
||||
String(200),
|
||||
nullable=True,
|
||||
)
|
||||
Reference in New Issue
Block a user