Update API
This commit is contained in:
@@ -6,8 +6,8 @@ from . import jsonrpc, login_required
|
||||
from .. import app, lib, models
|
||||
|
||||
|
||||
@jsonrpc.method('note(id=int)')
|
||||
def note_id(id):
|
||||
@jsonrpc.method('note')
|
||||
def note_id(id: int)->dict:
|
||||
"""Заметка
|
||||
"""
|
||||
note = models.db_session.query(
|
||||
@@ -26,9 +26,9 @@ def note_id(id):
|
||||
return result
|
||||
|
||||
|
||||
@jsonrpc.method('note.update(title=str, body=str)')
|
||||
@jsonrpc.method('note.update')
|
||||
@login_required
|
||||
def note_update(title, body):
|
||||
def note_update(title: str, body: str)->dict:
|
||||
"""Обновить заметку
|
||||
"""
|
||||
note = models.db_session.query(
|
||||
@@ -50,9 +50,9 @@ def note_update(title, body):
|
||||
return result
|
||||
|
||||
|
||||
@jsonrpc.method('note.add(title=str, body=str)')
|
||||
@jsonrpc.method('note.add')
|
||||
@login_required
|
||||
def note_add(title, body):
|
||||
def note_add(title: str, body: str)->dict:
|
||||
"""Добавление новой заметки
|
||||
"""
|
||||
newNote = models.Note(
|
||||
@@ -69,9 +69,9 @@ def note_add(title, body):
|
||||
return result
|
||||
|
||||
|
||||
@jsonrpc.method('note.destroy(id=int)')
|
||||
@jsonrpc.method('note.destroy')
|
||||
@login_required
|
||||
def note_destroy(id):
|
||||
def note_destroy(id: int)->bool:
|
||||
"""Полное уничтожение заметки
|
||||
|
||||
Аргументы:
|
||||
@@ -88,11 +88,11 @@ def note_destroy(id):
|
||||
models.db_session.delete(note)
|
||||
models.db_session.commit()
|
||||
|
||||
return 'ok'
|
||||
return True
|
||||
|
||||
|
||||
@jsonrpc.method('notes(page=int)')
|
||||
def notes_list(page):
|
||||
@jsonrpc.method('notes')
|
||||
def notes_list(page: int)->list:
|
||||
"""Список заметок
|
||||
"""
|
||||
notes = models.db_session.query(
|
||||
@@ -118,7 +118,7 @@ def notes_list(page):
|
||||
|
||||
|
||||
@jsonrpc.method('notes.count')
|
||||
def notes_count():
|
||||
def notes_count()->int:
|
||||
"""Количество заметок
|
||||
"""
|
||||
result = models.db_session.query(
|
||||
|
||||
Reference in New Issue
Block a user