Add hashes for each book

Check if the uploaded book is already in the library
This commit is contained in:
Las Zenow 2020-05-03 09:35:17 +00:00
parent 154867c50c
commit a1ee320eba
4 changed files with 41 additions and 5 deletions

View file

@ -17,6 +17,7 @@ type DB interface {
UpdateBook(id string, data map[string]interface{}) error
ActiveBook(id string) error
IsBookActive(id string) bool
ExistsBookHash(hash []byte) bool
AddUser(name string, pass string) error
AddRawUser(name string, hpass []byte, salt []byte, role string) error
SetAdminUser(name string, pass string) error
@ -149,6 +150,7 @@ ALTER TABLE books ALTER COLUMN active SET DEFAULT false ;
CREATE INDEX IF NOT EXISTS books_lang_idx ON books (lang);
CREATE INDEX IF NOT EXISTS books_isbn_idx ON books (isbn);
CREATE INDEX IF NOT EXISTS books_active_idx ON books (active);
CREATE INDEX IF NOT EXISTS books_file_hash_idx ON books (file_hash);