OpenBookr/openbookr/db.py

64 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
from typing import Iterable
##################
# DataBase logic #
##################
from openbookr.ABC import IDataBase
from openbookr.models import Book
class SQLiteEngine(object):
...
class SQlite(IDataBase, SQLiteEngine):
async def authors(self) -> Iterable:
...
async def genres(self) -> Iterable:
...
async def tags(self) -> Iterable:
...
async def add_book(self, book: Book) -> None:
...
async def get_book(self, book_id: int) -> Book:
...
async def del_book(self, book_id: int) -> None:
...
async def update_book(self, book_id: int, updated_book: Book) -> None:
...
async def book_list(
self,
author: str | None = None,
tags: Iterable | None = None,
genres: Iterable | None = None,
) -> Iterable:
...
async def add_genre(self, genre: str) -> None:
...
async def add_tag(self, tag: str) -> None:
...
async def del_genre(self, genre_id: int) -> None:
...
async def del_tag(self, tag_id: int) -> None:
...
async def add_author(self, author: str) -> None:
...
async def del_author(self, author_id: int) -> None:
...