style changes
This commit is contained in:
parent
664fe2a50a
commit
1ec139d6cd
0
pre-commit
Normal file → Executable file
0
pre-commit
Normal file → Executable file
@ -1,11 +1,9 @@
|
||||
from fiber_package.base import FiberBaseModel
|
||||
from fiber_package.refs import EntityRefList, CommitteeRefList, GuildRefList
|
||||
from enum import StrEnum
|
||||
|
||||
|
||||
class AssociationModel(FiberBaseModel):
|
||||
full_name: str
|
||||
# short name used for visibility strings (think: DLF, Kaiser, CNB, etc...)
|
||||
tag: str
|
||||
|
||||
tag: str
|
||||
|
||||
|
||||
|
||||
@ -12,4 +12,4 @@ class LanguageOption(StrEnum):
|
||||
class Gender(StrEnum):
|
||||
male = "m"
|
||||
female = "f"
|
||||
nonbinary = "n"
|
||||
nonbinary = "n"
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
|
||||
from .person import PersonModel
|
||||
from .enums import HonoraryStatus, Gender
|
||||
|
||||
class AlumnModel(PersonModel):
|
||||
graduated: bool = False
|
||||
@ -8,4 +7,3 @@ class AlumnModel(PersonModel):
|
||||
|
||||
class ExternalModel(PersonModel):
|
||||
pass
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from pydantic import model_validator, EmailStr, Field, computed_field, field_serializer
|
||||
from pydantic import model_validator, EmailStr, computed_field, field_serializer
|
||||
from typing import Self, Literal
|
||||
from datetime import date
|
||||
|
||||
@ -31,10 +31,10 @@ class PersonModel(FiberBaseModel):
|
||||
return False
|
||||
today = date.today()
|
||||
age = ( today.year - self.date_of_birth.year
|
||||
- ( (today.month, today.day)
|
||||
< (self.date_of_birth.month, self.date_of_birth.day) )
|
||||
- ( (today.month, today.day)
|
||||
< (self.date_of_birth.month, self.date_of_birth.day) )
|
||||
)
|
||||
return age < 18
|
||||
return age < 18
|
||||
|
||||
@model_validator(mode="after")
|
||||
def generate_full_name(self) -> Self:
|
||||
@ -48,4 +48,4 @@ class PersonModel(FiberBaseModel):
|
||||
# Needed for dates, as pymongo cannot handle them
|
||||
@field_serializer("date_of_birth", when_used="always")
|
||||
def serialize_date(self, value: date | None):
|
||||
return value.isoformat() if value else None
|
||||
return value.isoformat() if value else None
|
||||
|
||||
@ -16,4 +16,4 @@ def validate_visibility_tag(v: str) -> str:
|
||||
VisibilityTag = Annotated[str, AfterValidator(validate_visibility_tag)]
|
||||
|
||||
def generate_tag(association_tag: str, membership_tag: MembershipTag):
|
||||
return association_tag + ":" + membership_tag
|
||||
return association_tag + ":" + membership_tag
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user