forked from JamiCode/CareCompanion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schemas.py
39 lines (28 loc) · 761 Bytes
/
schemas.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import datetime as _dt
import pydantic as _pydantic
from typing import Optional
class _UserBase(_pydantic.BaseModel):
email:str
first_name:str
last_name:str
class UserCreate(_UserBase):
hashed_password:str
class Config:
from_attributes = True
class User(_UserBase):
id: int
class Config:
from_attributes = True
# Pydantic model for creating a conversation
class ConversationCreate(_pydantic.BaseModel):
title: str
class MessagePayload(_pydantic.BaseModel):
text_content: str
class MessageSchema(_pydantic.BaseModel):
id: int
text_content: str
is_bot_message: bool
class Config:
orm_mode = True
def __getitem__(self, item):
return getattr(self, item, None)