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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy