data_models: add engineeringsresumes option

This commit is contained in:
Sina Atalay 2024-03-29 20:04:32 +01:00
parent 7eb672d396
commit 46a2cb7c16
1 changed files with 9 additions and 5 deletions

View File

@ -33,6 +33,7 @@ import ruamel.yaml
from .themes.classic import ClassicThemeOptions from .themes.classic import ClassicThemeOptions
from .themes.moderncv import ModerncvThemeOptions from .themes.moderncv import ModerncvThemeOptions
from .themes.sb2nov import Sb2novThemeOptions from .themes.sb2nov import Sb2novThemeOptions
from .themes.engineeringresumes import EngineeringresumesThemeOptions
# Create a custom type called RenderCVDate that accepts only strings in YYYY-MM-DD or # Create a custom type called RenderCVDate that accepts only strings in YYYY-MM-DD or
# YYYY-MM format: # YYYY-MM format:
@ -317,7 +318,7 @@ class EntryBase(RenderCVBaseModel):
if date_is_provided: if date_is_provided:
if date != "present": if date != "present":
date = get_date_object(date) get_date_object(date)
return date return date
@ -344,8 +345,8 @@ class EntryBase(RenderCVBaseModel):
self.start_date = None self.start_date = None
self.end_date = None self.end_date = None
elif start_date_is_provided: elif start_date_is_provided:
start_date = get_date_object(self.start_date) start_date = self.start_date
end_date = get_date_object(self.end_date) end_date = self.end_date
if not end_date_is_provided: if not end_date_is_provided:
# Then it means only the start_date is provided, so it is an ongoing # Then it means only the start_date is provided, so it is an ongoing
# event: # event:
@ -926,11 +927,14 @@ class CurriculumVitae(RenderCVBaseModel):
# See https://docs.pydantic.dev/2.5/concepts/fields/#discriminator for more information # See https://docs.pydantic.dev/2.5/concepts/fields/#discriminator for more information
# about discriminators. # about discriminators.
RenderCVDesign = Annotated[ RenderCVDesign = Annotated[
ClassicThemeOptions | ModerncvThemeOptions | Sb2novThemeOptions, ClassicThemeOptions
| ModerncvThemeOptions
| Sb2novThemeOptions
| EngineeringresumesThemeOptions,
pydantic.Field(discriminator="theme"), pydantic.Field(discriminator="theme"),
] ]
rendercv_design_validator = pydantic.TypeAdapter(RenderCVDesign) rendercv_design_validator = pydantic.TypeAdapter(RenderCVDesign)
available_themes = ["classic", "moderncv", "sb2nov"] available_themes = ["classic", "moderncv", "sb2nov", "engineeringresumes"]
class RenderCVDataModel(RenderCVBaseModel): class RenderCVDataModel(RenderCVBaseModel):