示例#1
0
 def get(self, id):
     book = _repository.get_by_id(id)
     if book is not None:
         return send_from_directory(book.file.path,
                                    book.file.file_name,
                                    as_attachment=True)
     else:
         return not_found()
示例#2
0
 def get(self, id):
     try:
         Indexer().index_book(id)
         return ok()
     except:
         return not_found()
示例#3
0
 def get(self, id):
     try:
         Indexer().start(id)
         return ok()
     except:
         return not_found()
示例#4
0
 def delete(self, id):
     result = _service.delete_by_id(id)
     return ok(id) if result else not_found()
示例#5
0
 def get(self, id):
     book = _repository.get_by_id(id)
     return book if book else not_found()