mirror of
https://github.com/cyberbread-ru/notepad-server.git
synced 2026-07-14 12:51:04 +03:00
initial vibecoded... thing
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
from typing import Optional
|
||||
|
||||
from app.models import Note
|
||||
from app.store import NoteStore
|
||||
|
||||
|
||||
class NoteService:
|
||||
def __init__(self):
|
||||
self._store = NoteStore()
|
||||
|
||||
def list(self) -> list[Note]:
|
||||
return self._store.find_all()
|
||||
|
||||
def get(self, note_id: str) -> Optional[Note]:
|
||||
return self._store.find_by_id(note_id)
|
||||
|
||||
def create(self, title: str, content: str) -> Note:
|
||||
return self._store.insert(title, content)
|
||||
|
||||
def update(self, note_id: str, title: str, content: str) -> Optional[Note]:
|
||||
return self._store.update(note_id, title, content)
|
||||
|
||||
def remove(self, note_id: str) -> bool:
|
||||
return self._store.delete(note_id)
|
||||
Reference in New Issue
Block a user