Different small improvements to search

- Make photos link to its album
- Implement Photo -> Album resolver
- Highlight query in search
- Hide search bar when not logged in
This commit is contained in:
viktorstrate
2020-03-05 20:34:19 +01:00
parent 525edbea07
commit ec7a7adf43
3 changed files with 51 additions and 37 deletions

View File

@@ -152,30 +152,9 @@ func (r *photoResolver) Thumbnail(ctx context.Context, obj *models.Photo) (*mode
return url, nil
}
// func processPhoto(db *sql.DB, photo *models.Photo) error {
// tx, err := db.Begin()
// if err != nil {
// return err
// }
// err = scanner.ProcessPhoto(tx, photo)
// if err != nil {
// tx.Rollback()
// log.Printf("ERROR: Could not process photo: %s\n", err)
// return errors.New(fmt.Sprintf("Could not process photo: %s\n", err))
// }
// err = tx.Commit()
// if err != nil {
// log.Printf("ERROR: Could not commit photo after process to db: %s\n", err)
// return err
// }
// return nil
// }
func (r *photoResolver) Album(ctx context.Context, obj *models.Photo) (*models.Album, error) {
panic("not implemented")
row := r.Database.QueryRow("SELECT album.* from photo JOIN album ON photo.album_id = album.album_id WHERE photo_id = ?", obj.PhotoID)
return models.NewAlbumFromRow(row)
}
func (r *photoResolver) Exif(ctx context.Context, obj *models.Photo) (*models.PhotoEXIF, error) {