- crates/ld-engine : formule inertielle (parité avec la maquette, garde C), coquille / changement de fond, assistant d'édition à règles, composition d'un document sous vote permanent (adoptions, aperçus, rivales). - crates/trustin-access : qui voit, qui ouvre, qui gère les accès. - crates/ld-server : API axum + SQLite, connexion Ğ1 (client OAuth2 de connect.monnaie-libre.fr), invitations, entrée en vigueur automatique, signalements de contradiction, traductions éditoriales, publication git, taille de la toile lue sur la chaîne. - seeds/acte-engagement-certification.json : 33 articles, fr + en + es ; en vigueur : préambule, E1, E2 (seed a minima). - maquette/ : frontend, backend et docker v2 déplacés tels quels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.9 KiB
Python
43 lines
1.9 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import String, Text, Boolean, DateTime, ForeignKey, Uuid, func
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class Organization(Base):
|
|
__tablename__ = "organizations"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, default=uuid.uuid4)
|
|
name: Mapped[str] = mapped_column(String(128), nullable=False)
|
|
slug: Mapped[str] = mapped_column(String(128), unique=True, nullable=False, index=True)
|
|
# commune, enterprise, association, collective, basin, intercommunality, community
|
|
org_type: Mapped[str] = mapped_column(String(64), default="community")
|
|
# True = all authenticated users see & interact with content (Duniter G1, Axiom Team)
|
|
# False = membership required
|
|
is_transparent: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
color: Mapped[str | None] = mapped_column(String(32)) # CSS color or mood token
|
|
icon: Mapped[str | None] = mapped_column(String(64)) # lucide icon name
|
|
description: Mapped[str | None] = mapped_column(Text)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
|
|
|
members: Mapped[list["OrgMember"]] = relationship(
|
|
back_populates="organization", cascade="all, delete-orphan"
|
|
)
|
|
|
|
|
|
class OrgMember(Base):
|
|
__tablename__ = "org_members"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, default=uuid.uuid4)
|
|
org_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("organizations.id"), nullable=False)
|
|
identity_id: Mapped[uuid.UUID] = mapped_column(
|
|
ForeignKey("duniter_identities.id"), nullable=False
|
|
)
|
|
role: Mapped[str] = mapped_column(String(32), default="member") # admin, member, observer
|
|
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
|
|
|
organization: Mapped["Organization"] = relationship(back_populates="members")
|