Notes Repository
Challenge on lesson: Checkpoint: Database-Backed Application
CHALLENGE
Difficulty: intermediate+25 XP
Implement init_notes(conn) creating notes(id INTEGER PRIMARY KEY, title TEXT NOT NULL UNIQUE, body TEXT NOT NULL) and class NotesRepository(conn) with add(title, body) -> int (translate UNIQUE violation to ValueError 'duplicate title'), search(term) -> list[dict] of notes whose title CONTAINS term (LIKE with parameter-bound pattern; survives the injection test), and delete(note_id) -> bool.
Press Submit to check your solution.
Back to lesson: Checkpoint: Database-Backed Application