mirror of
https://github.com/NovaOSS/nova-api.git
synced 2024-11-25 18:23:57 +01:00
Fixed ObjectId issue
This commit is contained in:
parent
8b325d6b81
commit
e06073fba5
|
@ -50,6 +50,9 @@ async def get_users(discord_id: int, incoming_request: fastapi.Request):
|
||||||
if not user:
|
if not user:
|
||||||
return await errors.error(404, 'Discord user not found in the API database.', 'Check the `discord_id` parameter.')
|
return await errors.error(404, 'Discord user not found in the API database.', 'Check the `discord_id` parameter.')
|
||||||
|
|
||||||
|
# turn the ObjectId into a string
|
||||||
|
user['_id'] = str(user['_id'])
|
||||||
|
|
||||||
return user
|
return user
|
||||||
|
|
||||||
async def new_user_webhook(user: dict) -> None:
|
async def new_user_webhook(user: dict) -> None:
|
||||||
|
@ -90,6 +93,8 @@ async def create_user(incoming_request: fastapi.Request):
|
||||||
user = await manager.create(discord_id)
|
user = await manager.create(discord_id)
|
||||||
await new_user_webhook(user)
|
await new_user_webhook(user)
|
||||||
|
|
||||||
|
user['_id'] = str(user['_id'])
|
||||||
|
|
||||||
return user
|
return user
|
||||||
|
|
||||||
@router.put('/users')
|
@router.put('/users')
|
||||||
|
|
|
@ -5,7 +5,9 @@ import pydantic
|
||||||
|
|
||||||
from rich import print
|
from rich import print
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
from bson.objectid import ObjectId
|
from bson.objectid import ObjectId
|
||||||
|
|
||||||
from slowapi.errors import RateLimitExceeded
|
from slowapi.errors import RateLimitExceeded
|
||||||
from slowapi.middleware import SlowAPIMiddleware
|
from slowapi.middleware import SlowAPIMiddleware
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
Loading…
Reference in a new issue