forked from yvv/decision
Mandats : origin→FK identité + nomination auto + boutons + tests intégration
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
- origin TEXT → origin_id UUID FK duniter_identities (migration e3f4a5b6c7d8) - GET /auth/identities?q= : recherche d'identités par nom/adresse - MandateCreate.nomination_mode : auto (auto-assign auteur), collective, postpone - Wizard new.vue : champ origine = picker identité, checkbox "Démarrer maintenant" - [id].vue : modal "Assigner" = search-picker (résout UUID vs adresse SS58), affiche origin_display_name + mandatee_display_name, inputs natifs (<input>/<textarea>) - Erreurs API visibles dans l'UI (plus de catch silencieux) - test_mandate_flows.py : 17 tests intégration SQLite réels (origin, nomination, assign, lifecycle, revocation, interactions croisées) — 241 tests total OK Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,21 +10,13 @@ from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
|
||||
class MandateStepCreate(BaseModel):
|
||||
"""Payload for creating a step within a mandate process."""
|
||||
|
||||
step_order: int = Field(..., ge=0)
|
||||
step_type: str = Field(
|
||||
...,
|
||||
max_length=32,
|
||||
description="formulation, candidacy, vote, assignment, reporting, completion, revocation",
|
||||
)
|
||||
step_type: str = Field(..., max_length=32)
|
||||
title: str | None = Field(default=None, max_length=256)
|
||||
description: str | None = None
|
||||
|
||||
|
||||
class MandateStepOut(BaseModel):
|
||||
"""Full mandate step representation."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: UUID
|
||||
@@ -43,44 +35,45 @@ class MandateStepOut(BaseModel):
|
||||
|
||||
|
||||
class MandateCreate(BaseModel):
|
||||
"""Payload for creating a new mandate."""
|
||||
|
||||
title: str = Field(..., min_length=1, max_length=256)
|
||||
origin: str | None = None
|
||||
origin_id: UUID | None = None
|
||||
description: str | None = None
|
||||
mandate_type: str = Field(..., max_length=64, description="techcomm, smith, custom")
|
||||
mandate_type: str = Field(..., max_length=64)
|
||||
nomination_mode: str = Field(
|
||||
default="postpone",
|
||||
description="auto (auto-assign author), collective, postpone",
|
||||
)
|
||||
decision_id: UUID | None = None
|
||||
starts_at: datetime | None = None
|
||||
ends_at: datetime | None = None
|
||||
|
||||
|
||||
class MandateUpdate(BaseModel):
|
||||
"""Partial update for a mandate."""
|
||||
|
||||
title: str | None = Field(default=None, max_length=256)
|
||||
origin_id: UUID | None = None
|
||||
description: str | None = None
|
||||
mandate_type: str | None = Field(default=None, max_length=64)
|
||||
decision_id: UUID | None = None
|
||||
starts_at: datetime | None = None
|
||||
ends_at: datetime | None = None
|
||||
|
||||
|
||||
class MandateAssignRequest(BaseModel):
|
||||
"""Request body for assigning a mandatee to a mandate."""
|
||||
|
||||
mandatee_id: UUID = Field(..., description="ID de l'identite Duniter du mandataire")
|
||||
mandatee_id: UUID = Field(..., description="UUID de l'identite Duniter du mandataire")
|
||||
|
||||
|
||||
class MandateOut(BaseModel):
|
||||
"""Full mandate representation returned by the API."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: UUID
|
||||
title: str
|
||||
origin: str | None = None
|
||||
origin_id: UUID | None = None
|
||||
origin_display_name: str | None = None
|
||||
description: str | None = None
|
||||
mandate_type: str
|
||||
status: str
|
||||
mandatee_id: UUID | None = None
|
||||
mandatee_display_name: str | None = None
|
||||
decision_id: UUID | None = None
|
||||
starts_at: datetime | None = None
|
||||
ends_at: datetime | None = None
|
||||
@@ -89,22 +82,5 @@ class MandateOut(BaseModel):
|
||||
steps: list[MandateStepOut] = Field(default_factory=list)
|
||||
|
||||
|
||||
class MandateAdvanceOut(BaseModel):
|
||||
"""Output after advancing a mandate through its workflow."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: UUID
|
||||
title: str
|
||||
origin: str | None = None
|
||||
description: str | None = None
|
||||
mandate_type: str
|
||||
status: str
|
||||
mandatee_id: UUID | None = None
|
||||
decision_id: UUID | None = None
|
||||
starts_at: datetime | None = None
|
||||
ends_at: datetime | None = None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
steps: list[MandateStepOut] = Field(default_factory=list)
|
||||
class MandateAdvanceOut(MandateOut):
|
||||
message: str = Field(..., description="Message decrivant l'avancement effectue")
|
||||
|
||||
Reference in New Issue
Block a user