From 89a164f4323dd497561fc235ded5797e65bbef0b Mon Sep 17 00:00:00 2001 From: Laurent LAPORTE Date: Wed, 27 Mar 2024 15:35:48 +0100 Subject: [PATCH] feat(commands): add new details DTO: dictionary with keys 'id', 'name', 'status' and 'msg' --- .../study/storage/variantstudy/model/model.py | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/antarest/study/storage/variantstudy/model/model.py b/antarest/study/storage/variantstudy/model/model.py index 33befadb4a..e602c0d6e1 100644 --- a/antarest/study/storage/variantstudy/model/model.py +++ b/antarest/study/storage/variantstudy/model/model.py @@ -1,10 +1,38 @@ 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): """ @@ -12,12 +40,11 @@ class GenerationResultInfoDTO(BaseModel): 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):