from typing import Optional

from sqlmodel import Field, SQLModel

from fastapi_server.models.user import User


class ChatMessage(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    timestamp: int
    message: str
    user_id: int = Field(foreign_key='user.id')
    user: User

sqlmodel.Field
[((178, 215), 'sqlmodel.Field', 'Field', ([], {'default': 'None', 'primary_key': '(True)'}), '(default=None, primary_key=True)\n', (183, 215), False, 'from sqlmodel import Field, SQLModel\n'), ((271, 299), 'sqlmodel.Field', 'Field', ([], {'foreign_key': '"""user.id"""'}), "(foreign_key='user.id')\n", (276, 299), False, 'from sqlmodel import Field, SQLModel\n')]