Monorepo: consolidate 7 repos into one
Combines shared, blog, market, cart, events, federation, and account into a single repository. Eliminates submodule sync, sibling model copying at build time, and per-app CI orchestration. Changes: - Remove per-app .git, .gitmodules, .gitea, submodule shared/ dirs - Remove stale sibling model copies from each app - Update all 6 Dockerfiles for monorepo build context (root = .) - Add build directives to docker-compose.yml - Add single .gitea/workflows/ci.yml with change detection - Add .dockerignore for monorepo build context - Create __init__.py for federation and account (cross-app imports)
This commit is contained in:
14
blog/models/__init__.py
Normal file
14
blog/models/__init__.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from .ghost_content import Post, Author, Tag, PostAuthor, PostTag, PostLike
|
||||
from .snippet import Snippet
|
||||
from .tag_group import TagGroup, TagGroupTag
|
||||
|
||||
# Shared models — canonical definitions live in shared/models/
|
||||
from shared.models.ghost_membership_entities import (
|
||||
GhostLabel, UserLabel,
|
||||
GhostNewsletter, UserNewsletter,
|
||||
GhostTier, GhostSubscription,
|
||||
)
|
||||
from shared.models.menu_item import MenuItem
|
||||
from shared.models.kv import KV
|
||||
from shared.models.magic_link import MagicLink
|
||||
from shared.models.user import User
|
||||
3
blog/models/ghost_content.py
Normal file
3
blog/models/ghost_content.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from shared.models.ghost_content import ( # noqa: F401
|
||||
Tag, Post, Author, PostAuthor, PostTag, PostLike,
|
||||
)
|
||||
12
blog/models/ghost_membership_entities.py
Normal file
12
blog/models/ghost_membership_entities.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Re-export from canonical shared location
|
||||
from shared.models.ghost_membership_entities import (
|
||||
GhostLabel, UserLabel,
|
||||
GhostNewsletter, UserNewsletter,
|
||||
GhostTier, GhostSubscription,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"GhostLabel", "UserLabel",
|
||||
"GhostNewsletter", "UserNewsletter",
|
||||
"GhostTier", "GhostSubscription",
|
||||
]
|
||||
4
blog/models/kv.py
Normal file
4
blog/models/kv.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# Re-export from canonical shared location
|
||||
from shared.models.kv import KV
|
||||
|
||||
__all__ = ["KV"]
|
||||
4
blog/models/magic_link.py
Normal file
4
blog/models/magic_link.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# Re-export from canonical shared location
|
||||
from shared.models.magic_link import MagicLink
|
||||
|
||||
__all__ = ["MagicLink"]
|
||||
4
blog/models/menu_item.py
Normal file
4
blog/models/menu_item.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# Re-export from canonical shared location
|
||||
from shared.models.menu_item import MenuItem
|
||||
|
||||
__all__ = ["MenuItem"]
|
||||
32
blog/models/snippet.py
Normal file
32
blog/models/snippet.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import Integer, String, Text, DateTime, ForeignKey, UniqueConstraint, Index, func
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from shared.db.base import Base
|
||||
|
||||
|
||||
class Snippet(Base):
|
||||
__tablename__ = "snippets"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("user_id", "name", name="uq_snippets_user_name"),
|
||||
Index("ix_snippets_visibility", "visibility"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
user_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("users.id", ondelete="CASCADE"), nullable=False,
|
||||
)
|
||||
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
value: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
visibility: Mapped[str] = mapped_column(
|
||||
String(20), nullable=False, default="private", server_default="private",
|
||||
)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False, server_default=func.now(),
|
||||
)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False, server_default=func.now(), onupdate=func.now(),
|
||||
)
|
||||
52
blog/models/tag_group.py
Normal file
52
blog/models/tag_group.py
Normal file
@@ -0,0 +1,52 @@
|
||||
from datetime import datetime
|
||||
from typing import List, Optional
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
from sqlalchemy import (
|
||||
Integer,
|
||||
String,
|
||||
Text,
|
||||
DateTime,
|
||||
ForeignKey,
|
||||
UniqueConstraint,
|
||||
func,
|
||||
)
|
||||
from shared.db.base import Base
|
||||
|
||||
|
||||
class TagGroup(Base):
|
||||
__tablename__ = "tag_groups"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
slug: Mapped[str] = mapped_column(String(191), unique=True, nullable=False)
|
||||
feature_image: Mapped[Optional[str]] = mapped_column(Text())
|
||||
colour: Mapped[Optional[str]] = mapped_column(String(32))
|
||||
sort_order: Mapped[int] = mapped_column(Integer, default=0, nullable=False)
|
||||
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False, server_default=func.now()
|
||||
)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False, server_default=func.now(), onupdate=func.now()
|
||||
)
|
||||
|
||||
tag_links: Mapped[List["TagGroupTag"]] = relationship(
|
||||
"TagGroupTag", back_populates="group", cascade="all, delete-orphan", passive_deletes=True
|
||||
)
|
||||
|
||||
|
||||
class TagGroupTag(Base):
|
||||
__tablename__ = "tag_group_tags"
|
||||
__table_args__ = (
|
||||
UniqueConstraint("tag_group_id", "tag_id", name="uq_tag_group_tag"),
|
||||
)
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
tag_group_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("tag_groups.id", ondelete="CASCADE"), nullable=False
|
||||
)
|
||||
tag_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("tags.id", ondelete="CASCADE"), nullable=False
|
||||
)
|
||||
|
||||
group: Mapped["TagGroup"] = relationship("TagGroup", back_populates="tag_links")
|
||||
4
blog/models/user.py
Normal file
4
blog/models/user.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# Re-export from canonical shared location
|
||||
from shared.models.user import User
|
||||
|
||||
__all__ = ["User"]
|
||||
Reference in New Issue
Block a user