Multi-tenancy : espaces de travail + fix auth reload (rate limiter OPTIONS)
- Modèles Organization + OrgMember, migration Alembic (SQLite compatible) - organization_id nullable sur Document, Decision, Mandate, VotingProtocol - Service, schéma, router /organizations + dependency get_active_org_id - Seed : Duniter G1 + Axiom Team ; tout le contenu seed attaché à Duniter G1 - Backend : list/create filtrés par header X-Organization - Frontend : store organizations, WorkspaceSelector réel, useApi injecte l'org - Fix critique : rate_limiter exclut les requêtes OPTIONS (CORS preflight) → résout le bug "Failed to fetch /auth/me" au reload (429 sur preflight) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
42
backend/app/schemas/organization.py
Normal file
42
backend/app/schemas/organization.py
Normal file
@@ -0,0 +1,42 @@
|
||||
"""Pydantic v2 schemas for organizations."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
class OrganizationOut(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: uuid.UUID
|
||||
name: str
|
||||
slug: str
|
||||
org_type: str
|
||||
is_transparent: bool
|
||||
color: str | None
|
||||
icon: str | None
|
||||
description: str | None
|
||||
created_at: datetime
|
||||
|
||||
|
||||
class OrganizationCreate(BaseModel):
|
||||
name: str
|
||||
slug: str
|
||||
org_type: str = "community"
|
||||
is_transparent: bool = False
|
||||
color: str | None = None
|
||||
icon: str | None = None
|
||||
description: str | None = None
|
||||
|
||||
|
||||
class OrgMemberOut(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: uuid.UUID
|
||||
org_id: uuid.UUID
|
||||
identity_id: uuid.UUID
|
||||
role: str
|
||||
created_at: datetime
|
||||
Reference in New Issue
Block a user