from datetime import datetime from .models import ChatMessage, Favorite, Follow, Prompt, Rating, User class InMemoryStore: def __init__(self) -> None: now = datetime.utcnow() self.users = { 1: User( id=1, email="jane@example.com", password_hash="demo-password", full_name="Jane Doe", username="janedoe", bio="AI creator focused on writing and coding prompts.", location="Zurich", avatar_url="/images/content/creator1.png", role="creator", is_verified=True, created_at=now, ), 2: User( id=2, email="max@example.com", password_hash="demo-password", full_name="Max Muster", username="maxm", bio="Prompt buyer and tester.", location="Chur", avatar_url="/images/content/creator2.png", role="user", is_verified=False, created_at=now, ), } self.prompts = { 1: Prompt( id=1, title="Python Code Assistant", description="Efficiently debug and write Python code with AI assistance.", content="You are an expert Python assistant...", image_url="/images/content/prompt2.png", category="Coding", price=19.99, creator_id=1, created_at=now, ) } self.ratings = { 1: Rating( id=1, prompt_id=1, user_id=2, score=5, comment="Very useful starter prompt.", created_at=now, ) } self.favorites = { 1: Favorite( id=1, user_id=2, prompt_id=1, created_at=now, ) } self.follows = { 1: Follow( id=1, follower_id=2, creator_id=1, created_at=now, ) } self.chat_messages = { 1: ChatMessage( id=1, sender_id=2, receiver_id=1, content="Hi, I have a question about your prompt.", created_at=now, ) } self.current_user_id = 2 self.next_ids = { "user": 3, "prompt": 2, "rating": 2, "favorite": 2, "follow": 2, "chat_message": 2, } def next_id(self, key: str) -> int: value = self.next_ids[key] self.next_ids[key] += 1 return value store = InMemoryStore()