Skip to content

Conversation

@DerekGuijt
Copy link
Contributor

This code is for the user model

@allantito
Copy link
Contributor

Task linked: CU-86b1108nz DB - Create BOOKMARK Model

from datetime import datetime

class User(BaseModel):
id: str = Field(..., description="Unique identifier for the user")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your IDs should either be int or uuid.

Copy link
Contributor

@khodizoda khodizoda Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id here should be a str, because MongoDB's ObjectId is not JSON serializable. @DerekGuijt plz, wrap str as a PyObjectId: PyObjectId = Annotated[str, BeforeValidator(str)]


class User(BaseModel):
id: str = Field(..., description="Unique identifier for the user")
email: EmailStr = Field(..., description="User's email address")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

email-validator is required to use EmailStr. Please add email-validator to the requirements.txt. Double check the correct package needed for email-validator.

Copy link
Contributor

@khodizoda khodizoda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Please, address the comments and we can merge the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants