refactored for camelCase
This commit is contained in:
parent
c6e2dd3641
commit
0fcd355644
|
|
@ -1,10 +1,16 @@
|
|||
from uuid import UUID, uuid4
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic.alias_generators import to_camel
|
||||
|
||||
|
||||
class BaseConfig:
|
||||
alias_generator = to_camel
|
||||
json_encoders = {UUID: str}
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
|
||||
class BaseMongoModel(BaseModel):
|
||||
id: UUID = Field(default_factory=uuid4, alias="_id")
|
||||
|
||||
class Config:
|
||||
json_encoders = {UUID: str}
|
||||
arbitrary_types_allowed = True
|
||||
class Config(BaseConfig):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from .base import BaseMongoModel
|
||||
from .base import BaseConfig, BaseMongoModel
|
||||
|
||||
from datetime import datetime
|
||||
from pydantic import BaseModel, Field
|
||||
|
|
@ -9,11 +9,17 @@ class WaitAction(BaseModel):
|
|||
action_type: Literal["wait"]
|
||||
wait_for: int
|
||||
|
||||
class Config(BaseConfig):
|
||||
pass
|
||||
|
||||
|
||||
class TextCommentAction(BaseModel):
|
||||
action_type: Literal["text_comment"]
|
||||
text: str
|
||||
|
||||
class Config(BaseConfig):
|
||||
pass
|
||||
|
||||
|
||||
Action = Annotated[
|
||||
Union[WaitAction, TextCommentAction], Field(description="action_type")
|
||||
|
|
@ -25,5 +31,5 @@ class Chain(BaseMongoModel):
|
|||
actions: Annotated[Optional[List[Action]], Field(default=[])]
|
||||
last_modified: Annotated[datetime, Field(default_factory=datetime.utcnow)]
|
||||
|
||||
class Config(BaseMongoModel.Config):
|
||||
class Config(BaseConfig):
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user