Skip to content

Commit 65193d2

Browse files
committed
remove over_a_year pydantic validation
1 parent 13a6db4 commit 65193d2

1 file changed

Lines changed: 0 additions & 14 deletions

File tree

src/schemas.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
Participante,
2525
Users,
2626
)
27-
from util import over_a_year
2827

2928
STR_FIELD_MAX_SIZE = 300
3029
NON_NEGATIVE_INT4 = Annotated[NonNegativeInt, Field(le=(2**31) - 1)]
@@ -380,15 +379,6 @@ def validate_unidade(self):
380379
)
381380
return self
382381

383-
@model_validator(mode="after")
384-
def year_interval(self) -> "PlanoTrabalhoSchema":
385-
"""Garante que o plano não abrange um período maior que 1 ano."""
386-
if over_a_year(self.data_inicio, self.data_termino) == 1:
387-
raise ValueError(
388-
"Plano de trabalho não pode abranger período maior que 1 ano"
389-
)
390-
return self
391-
392382
@model_validator(mode="after")
393383
def must_be_sequential_dates(self) -> "PlanoTrabalhoSchema":
394384
"Verifica se a data de início e a data de término estão na ordem esperada."
@@ -573,10 +563,6 @@ def validate_entregas_uniqueness(self) -> "PlanoEntregasSchema":
573563
@model_validator(mode="after")
574564
def validate_period(self) -> "PlanoEntregasSchema":
575565
"""Valida o período do plano de entregas."""
576-
if over_a_year(self.data_inicio, self.data_termino) == 1:
577-
raise ValueError(
578-
"Plano de entregas não pode abranger período maior que 1 ano"
579-
)
580566
if self.data_termino < self.data_inicio:
581567
raise ValueError("data_termino deve ser maior ou igual que data_inicio.")
582568
if self.data_avaliacao is not None and self.data_avaliacao < self.data_inicio:

0 commit comments

Comments
 (0)