Created
March 17, 2020 05:49
-
-
Save cuongld2/f48366ee2a2457951ad8caa482478b32 to your computer and use it in GitHub Desktop.
pydantic base models
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List | |
from pydantic import BaseModel | |
class UserInfoBase(BaseModel): | |
username: str | |
class UserCreate(UserInfoBase): | |
fullname: str | |
password: str | |
class UserAuthenticate(UserInfoBase): | |
password: str | |
class UserInfo(UserInfoBase): | |
id: int | |
class Config: | |
orm_mode = True | |
class Token(BaseModel): | |
access_token: str | |
token_type: str | |
class TokenData(BaseModel): | |
username: str = None | |
class BlogBase(BaseModel): | |
title: str | |
content: str | |
class Blog(BlogBase): | |
id: int | |
class Config: | |
orm_mode = True | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment