chain model
This commit is contained in:
parent
1770b43c2f
commit
76ef312267
29
chain_service/database/models/chain.py
Normal file
29
chain_service/database/models/chain.py
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
from .base import BaseMongoModel
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
|
from pydantic import BaseModel, Field
|
||||||
|
from typing import Literal, Union, Annotated, Optional, List
|
||||||
|
|
||||||
|
|
||||||
|
class WaitAction(BaseModel):
|
||||||
|
action_type: Literal["wait"]
|
||||||
|
wait_for: int
|
||||||
|
|
||||||
|
|
||||||
|
class TextCommentAction(BaseModel):
|
||||||
|
action_type: Literal["text_comment"]
|
||||||
|
text: str
|
||||||
|
|
||||||
|
|
||||||
|
Action = Annotated[
|
||||||
|
Union[WaitAction, TextCommentAction], Field(description="action_type")
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class Chain(BaseMongoModel):
|
||||||
|
name: Annotated[Optional[str], Field(default=None)]
|
||||||
|
actions: Annotated[Optional[List[Action]], Field(default=[])]
|
||||||
|
created_at: Annotated[datetime, Field(default_factory=datetime.utcnow)]
|
||||||
|
|
||||||
|
class Config(BaseMongoModel.Config):
|
||||||
|
pass
|
||||||
Loading…
Reference in New Issue
Block a user