Open Library search API
If nothing is found on the server, returns results from open library API. Clicking on a book imports it.
This commit is contained in:
@@ -59,7 +59,7 @@ func saveBookToDb(ac appcontext.AppContext, b bookPostCreate, user *model.User)
|
||||
|
||||
func fetchOrCreateAuthor(ac appcontext.AppContext, name string) (*model.Author, error) {
|
||||
var author model.Author
|
||||
res := ac.Db.Where("name = ?", name)
|
||||
res := ac.Db.Where("name = ?", name).First(&author)
|
||||
err := res.Error
|
||||
if err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
|
||||
Reference in New Issue
Block a user