Jotzy/backend/app/models.py
2025-11-19 21:16:32 +00:00

16 lines
381 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# backend/app/models.py
from typing import Dict, List
# Inmemory “database”
_notes: List[Dict] = [] # each note is a dict with id, title, body
def add_note(title: str, body: str) -> Dict:
note_id = len(_notes) + 1
note = {"id": note_id, "title": title, "body": body}
_notes.append(note)
return note
def get_all_notes() -> List[Dict]:
return _notes