Store datetimes as strings
This commit is contained in:
parent
6f03d37ee9
commit
6f80ea686e
|
@ -19,3 +19,4 @@ class Category(Document):
|
|||
@final
|
||||
class Settings:
|
||||
name: ClassVar = "category"
|
||||
bson_encoders: ClassVar = {datetime: str}
|
||||
|
|
|
@ -27,3 +27,4 @@ class Event(Document):
|
|||
@final
|
||||
class Settings:
|
||||
name: ClassVar = "events"
|
||||
bson_encoders: ClassVar = {datetime: str, time: str, date: str}
|
||||
|
|
|
@ -21,3 +21,4 @@ class Invitation(Document):
|
|||
@final
|
||||
class Settings:
|
||||
name: ClassVar = "invitations"
|
||||
bson_encoders: ClassVar = {datetime: str}
|
||||
|
|
|
@ -22,3 +22,4 @@ class Notification(Document):
|
|||
@final
|
||||
class Settings:
|
||||
name: ClassVar = "notifications"
|
||||
bson_encoders: ClassVar = {datetime: str}
|
||||
|
|
|
@ -22,6 +22,7 @@ class Token(Document):
|
|||
@final
|
||||
class Settings:
|
||||
name = "tokens"
|
||||
bson_encoders: ClassVar = {datetime: str}
|
||||
indexes: ClassVar = [
|
||||
# Compound index for finding all tokens of given type from a specific user
|
||||
[
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from datetime import UTC, datetime
|
||||
from typing import Annotated, final
|
||||
from typing import Annotated, ClassVar, final
|
||||
|
||||
from beanie import Document, Indexed
|
||||
from pydantic import EmailStr, Field
|
||||
|
@ -16,4 +16,5 @@ class User(Document):
|
|||
|
||||
@final
|
||||
class Settings:
|
||||
name = "users"
|
||||
name: ClassVar = "users"
|
||||
bson_encoders: ClassVar = {datetime: str}
|
||||
|
|
Loading…
Reference in a new issue