From 080228f211f49dc8ded99cfe0010701b37b6b749 Mon Sep 17 00:00:00 2001 From: Xander Bil Date: Thu, 18 Apr 2024 21:35:43 +0200 Subject: [PATCH] last fixes --- backend/src/project/schemas.py | 14 +++++++------- frontend/src/views/SubjectRegisterView.vue | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backend/src/project/schemas.py b/backend/src/project/schemas.py index 2ae5af33..144111cb 100644 --- a/backend/src/project/schemas.py +++ b/backend/src/project/schemas.py @@ -21,13 +21,6 @@ class ProjectBase(BaseModel): capacity: int = Field(gt=0) requirements: List[Requirement] = [] - # Check if deadline is not in the past - @field_validator("deadline") - def validate_deadline(cls, value: datetime) -> datetime: - if value < datetime.now(value.tzinfo): - raise ValueError("The deadline cannot be in the past") - return value - @field_validator("description") def validate_description(cls, value: str) -> str: return escape(value, quote=False) @@ -36,6 +29,13 @@ def validate_description(cls, value: str) -> str: class ProjectCreate(ProjectBase): pass + # Check if deadline is not in the past + @field_validator("deadline") + def validate_deadline(cls, value: datetime) -> datetime: + if value < datetime.now(value.tzinfo): + raise ValueError("The deadline cannot be in the past") + return value + class Project(ProjectBase): model_config = ConfigDict(from_attributes=True) diff --git a/frontend/src/views/SubjectRegisterView.vue b/frontend/src/views/SubjectRegisterView.vue index 62e2dba8..f667621c 100644 --- a/frontend/src/views/SubjectRegisterView.vue +++ b/frontend/src/views/SubjectRegisterView.vue @@ -30,7 +30,7 @@ const { data: subject, error, isLoading, isError } = useSubjectUuidQuery(ref(pro const register = () => { refetch(); - router.push({ name: "subject", params: { subjectId: subject.id } }); + router.push({ name: "subject", params: { subjectId: subject.value?.id } }); }; const cancel = () => router.push({ name: "home" });