mirror of
https://github.com/fastapi-users/fastapi-users.git
synced 2025-11-02 04:05:19 +08:00
Update Beanie docs
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import motor.motor_asyncio
|
||||
from beanie import PydanticObjectId
|
||||
from beanie import Document
|
||||
from fastapi_users.db import BeanieBaseUser, BeanieUserDatabase
|
||||
|
||||
DATABASE_URL = "mongodb://localhost:27017"
|
||||
@ -9,7 +9,7 @@ client = motor.motor_asyncio.AsyncIOMotorClient(
|
||||
db = client["database_name"]
|
||||
|
||||
|
||||
class User(BeanieBaseUser[PydanticObjectId]):
|
||||
class User(BeanieBaseUser, Document):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import motor.motor_asyncio
|
||||
from beanie import PydanticObjectId
|
||||
from beanie import Document
|
||||
from fastapi_users.db import BeanieBaseUser, BeanieUserDatabase
|
||||
from fastapi_users_db_beanie.access_token import (
|
||||
BeanieAccessTokenDatabase,
|
||||
@ -13,11 +13,11 @@ client = motor.motor_asyncio.AsyncIOMotorClient(
|
||||
db = client["database_name"]
|
||||
|
||||
|
||||
class User(BeanieBaseUser):
|
||||
class User(BeanieBaseUser, Document):
|
||||
pass
|
||||
|
||||
|
||||
class AccessToken(BeanieBaseAccessToken[PydanticObjectId]): # (1)!
|
||||
class AccessToken(BeanieBaseAccessToken, Document): # (1)!
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
from typing import List
|
||||
|
||||
import motor.motor_asyncio
|
||||
from beanie import PydanticObjectId
|
||||
from beanie import Document
|
||||
from fastapi_users.db import BaseOAuthAccount, BeanieBaseUser, BeanieUserDatabase
|
||||
from pydantic import Field
|
||||
|
||||
@ -16,7 +16,7 @@ class OAuthAccount(BaseOAuthAccount):
|
||||
pass
|
||||
|
||||
|
||||
class User(BeanieBaseUser[PydanticObjectId]):
|
||||
class User(BeanieBaseUser, Document):
|
||||
oauth_accounts: List[OAuthAccount] = Field(default_factory=list)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user