Skip to content

Commit

Permalink
feat(commands): add new details DTO: dictionary with keys 'id', 'name…
Browse files Browse the repository at this point in the history
…', 'status' and 'msg'
  • Loading branch information
laurent-laporte-pro committed Mar 27, 2024
1 parent 3ce27f6 commit 89a164f
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions antarest/study/storage/variantstudy/model/model.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,50 @@
import typing as t
import uuid

import typing_extensions as te

from pydantic import BaseModel

from antarest.core.model import JSON
from antarest.study.model import StudyMetadataDTO

LegacyDetailsDTO = t.Tuple[str, bool, str]
"""
Legacy details DTO: triplet of name, output status and output message.
"""


class NewDetailsDTO(te.TypedDict):
"""
New details DTO: dictionary with keys 'id', 'name', 'status' and 'msg'.
Attributes:
id: identifiant de la commande (UUID),
name: nom de la commande,
status: statut de la commande (true ou false),
msg: message de la génération de la commande ou message d'erreur (si le statut est false).
"""

id: uuid.UUID
name: str
status: bool
msg: str


DetailsDTO = t.Union[LegacyDetailsDTO, NewDetailsDTO]


class GenerationResultInfoDTO(BaseModel):
"""
Result information of a snapshot generation process.
Attributes:
success: A boolean indicating whether the generation process was successful.
details: A list of tuples containing detailed information about the generation process:
(``name``, ``output_status``, ``output_message``).
details: Objects containing detailed information about the generation process.
"""

success: bool
details: t.MutableSequence[t.Tuple[str, bool, str]]
details: t.MutableSequence[DetailsDTO]


class CommandDTO(BaseModel):
Expand Down

0 comments on commit 89a164f

Please sign in to comment.