Skip to content

Commit

Permalink
feat: add ChatState enum
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesponti committed Aug 9, 2024
1 parent d1edb98 commit a45d774
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/data/models/chat.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
from datetime import datetime
from sqlalchemy import Column, DateTime, ForeignKey, String, UUID, func
from sqlalchemy import Column, DateTime, Enum, ForeignKey, String, UUID, func
from sqlalchemy.orm import relationship

from src.data.db import Base


class ChatState(Enum):
ACTIVE = "active"
INACTIVE = "inactive"

class Chat(Base):
__tablename__ = "chats"
id = Column(
UUID(as_uuid=True), primary_key=True, server_default=func.uuid_generate_v4()
)
title = Column(String, nullable=False)
profile_id = Column(UUID(as_uuid=True), ForeignKey("profiles.id"))
state = Column(ChatState, nullable=False, default="active")
created_at = Column(DateTime, default=datetime.utcnow)

def __repr__(self):
Expand Down
2 changes: 2 additions & 0 deletions src/resolvers/focus.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class FocusItemTaskSize(Enum):

@strawberry.type
class FocusOutputItem:
id: str
text: str
type: str
task_size: str
Expand All @@ -82,6 +83,7 @@ class FocusOutput:
def convert_to_sherpa_items(items: List[Focus]) -> List[FocusOutputItem]:
return [
FocusOutputItem(
id=data.id,
type=data.type,
task_size=data.task_size,
text=data.text,
Expand Down

0 comments on commit a45d774

Please sign in to comment.