Add basic html/rss support for book lists
This commit is contained in:
parent
c0a70a18e1
commit
46762ea17b
11 changed files with 254 additions and 78 deletions
|
@ -80,7 +80,7 @@ func (db *pgDB) UpdateBookList(listID, title string, description []string) error
|
|||
func (db *pgDB) GetBookList(listID string) (*BookList, error) {
|
||||
var bookList BookList
|
||||
err := db.sql.Model(&bookList).
|
||||
Column("Books").
|
||||
Column("Books", "User").
|
||||
Where("list_id = ?", listID).
|
||||
Select()
|
||||
return &bookList, err
|
||||
|
@ -95,7 +95,7 @@ func (db *pgDB) GetListsByUser(username string) ([]BookList, error) {
|
|||
}
|
||||
|
||||
err = db.sql.Model(&bookLists).
|
||||
Column("Books").
|
||||
Column("Books", "User").
|
||||
Where("user_id = ?", user.ID).
|
||||
Select()
|
||||
return bookLists, err
|
||||
|
@ -108,7 +108,7 @@ func (db *pgDB) GetListsByBook(bookID string) ([]BookList, error) {
|
|||
err := db.sql.Model(&bookListEntries).
|
||||
Where("book_id = ?", bookID).
|
||||
Select()
|
||||
if err != nil {
|
||||
if err != nil || len(bookListEntries) == 0 {
|
||||
return bookLists, err
|
||||
}
|
||||
|
||||
|
@ -118,11 +118,10 @@ func (db *pgDB) GetListsByBook(bookID string) ([]BookList, error) {
|
|||
whereQuery += "?"
|
||||
if i < len(bookListEntries)-1 {
|
||||
whereQuery += ", "
|
||||
} else {
|
||||
whereQuery += ")"
|
||||
}
|
||||
listIDs[i] = entry.ID
|
||||
}
|
||||
whereQuery += ")"
|
||||
|
||||
err = db.sql.Model(&bookLists).
|
||||
Column("Books").
|
||||
|
|
Reference in a new issue