8000 How to put updated_at in UserUpdate · fastapi-users fastapi-users · Discussion #1498 · GitHub
[go: up one dir, main page]

Skip to content

How to put updated_at in UserUpdate #1498

Discussion options

You must be logged in to vote

After using ChatGpt i found the solution straight with Beanie, I added this to my model:

class User(BeanieBaseUser, Document):
    id: UUID = Field(alias="_id", default_factory=uuid4)
    first_name: str = Field(title="First Name", description="The first name of the user", max_length=50)
    last_name: str = Field(title="Last Name", description="The last name of the user", max_length=50)
    is_recruiter: bool = Field(title="Is Recruiter", description="If the user is recruiter", default=False)
    created_at: datetime = Field(title="Created At", description="The date when the user was created", default_factory=lambda: datetime.now(timezone.utc))
    updated_at: datetime = Field(title="Upd…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by alfonsodipace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant
0