Add download counter on each book

* Closes: #40
This commit is contained in:
Las Zenow 2018-11-19 03:14:26 +00:00
parent fb399ac973
commit 8b996803c8
5 changed files with 30 additions and 5 deletions

View file

@ -29,6 +29,7 @@ type DB interface {
GetNews(num int, days int) (news []New, err error)
IncViews(ID string) error
IncDownloads(ID string) error
GetDownloadCounter(ID string) (int, error)
GetFrontPage() FrontPage
AddSubmission(submission Submission) (id int, err error)
UpdateSubmission(id int, status string, book *Book) error
@ -222,6 +223,7 @@ $$ LANGUAGE sql IMMUTABLE;
-- Visits indexes
CREATE INDEX IF NOT EXISTS visits_downloads_idx on visits(downloads DESC NULLS LAST);
CREATE INDEX IF NOT EXISTS visits_views_idx on visits(views DESC NULLS LAST);
CREATE INDEX IF NOT EXISTS visits_book_id_idx on visits(book_id);
-- Submissions indexes
CREATE INDEX IF NOT EXISTS submissions_id_idx on submissions(submission_id);