Commit a5fd1909 authored by Nicolas Schmid's avatar Nicolas Schmid
Browse files

feat: add a couple more fields to schemas

parent 3afa378e
Pipeline #2207 passed with stages
in 2 minutes and 58 seconds
......@@ -124,14 +124,31 @@ class ReservoirSeismicityPredictionSchema(BaseModel):
z_max: float
class ModelSchema(BaseModel):
"""
Schema returning a Model
"""
config: dict
enabled: bool
name: str
class SeismicityModelSchema(ModelSchema):
id: int
url: str
sfmwid: str
seismicitymodeltemplate: str
class SeismicityModelRunSchema(BaseModel):
"""
Schema returning a forecast.
Schema returning a Seismicity Model Run.
"""
id: int
config: dict
status: Optional[str]
result: Optional[ReservoirSeismicityPredictionSchema]
model: SeismicityModelSchema
# validators
_get_status: classmethod = create_validator('status', get_status)
......@@ -234,6 +251,7 @@ class ProjectSchema(BaseModel):
class ForecastSchema(BaseModel):
id: int
creationinfo: Optional[CreationInfo]
name: Optional[str]
starttime: Optional[datetime]
endtime: Optional[datetime]
......@@ -244,9 +262,13 @@ class ForecastSchema(BaseModel):
_get_status: classmethod = create_validator('status', get_status)
_get_scenarios: classmethod = create_validator('scenarios', get_ids)
class Config:
getter_dict = ValueGetter
class StageSchema(BaseModel):
id: int
config: Optional[dict]
status: Optional[str]
runs: Optional[List[int]]
type: Optional[str] = Field(alias='_type', exclude=True)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment