From e56ce5a9bae04e8334c53453339585e09be09760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karlo=20Miku=C5=A1?= Date: Sun, 11 Dec 2022 15:46:01 +0100 Subject: [PATCH] Fix cocktail index sync #33OC --- CHANGELOG.md | 6 ++++++ README.md | 19 +++++++++++++++++-- app/Console/Commands/BarSearchRefresh.php | 6 +++--- docs/open-api-spec.yml | 4 ++-- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ad7b915..edd564c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# v1.0.3 +## Fixes +- Sync cocktails and ingredients with meilisearch after docker restart +- Bump version in openapi spec + # v1.0.2 ## New - Add `php artisan bar:scrap` command to scrape recipes from the supported websites @@ -9,6 +14,7 @@ ## Fixes - Sort ingredient categories by name - Sort related cocktails in ingredient resource by name +- Escape ingredient description ## Changes - Use `docker-php-extension-installer` for docker image diff --git a/README.md b/README.md index 19bf78f6..2feedf5d 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ This repository only contains the API server, if you are looking for easy to use - Automatic indexing of data in Meilisearch - Cocktail ingredient substitutes - Assign glass types to cocktails +- Cocktail recipe scraping ## Planned features - Cocktail recipe sharing @@ -41,8 +42,6 @@ This repository only contains the API server, if you are looking for easy to use - Cocktail ratings - Add user notes to cocktail - Add cocktail flavor profiles -- Cocktail recipe scraping -- Importing and exporting cocktails ## Installation @@ -158,6 +157,22 @@ Default login information is: - email: `admin@example.com` - password: `password` +## FAQ + +### I'm missing images of cocktails and ingredients. + +Check that you have correctly configured your docker volumes. + +It can also mean that there are missing attributes in your indexes. You can run the following command to sync cocktails and ingredients to their indexes: + +``` bash +# Docker compose commands: +# Sync cocktails +$ docker compose exec -it bar-assistant php artisan scout:import "Kami\\Cocktail\\Models\\Cocktail" +# Sync ingredients +$ docker compose exec -it bar-assistant php artisan scout:import "Kami\\Cocktail\\Models\\Ingredient" +``` + ## Contributing TODO, Fork and create a pull request... diff --git a/app/Console/Commands/BarSearchRefresh.php b/app/Console/Commands/BarSearchRefresh.php index 50d94b65..44601218 100644 --- a/app/Console/Commands/BarSearchRefresh.php +++ b/app/Console/Commands/BarSearchRefresh.php @@ -39,9 +39,9 @@ public function handle() $this->info('Updating search index settings...'); SearchActions::updateIndexSettings(); - // $this->info('Importing cocktails and ingredients...'); - // Artisan::call('scout:import', ['model' => "Kami\Cocktail\Models\Cocktail"]); - // Artisan::call('scout:import', ['model' => "Kami\Cocktail\Models\Ingredient"]); + $this->info('Syncing cocktails and ingredients to meilisearch...'); + Artisan::call('scout:import', ['model' => "Kami\Cocktail\Models\Cocktail"]); + Artisan::call('scout:import', ['model' => "Kami\Cocktail\Models\Ingredient"]); return Command::SUCCESS; } diff --git a/docs/open-api-spec.yml b/docs/open-api-spec.yml index 34482816..e45b68bb 100644 --- a/docs/open-api-spec.yml +++ b/docs/open-api-spec.yml @@ -1,7 +1,7 @@ openapi: '3.0.2' info: title: 'Bar Assistant API' - version: '1.0.0' + version: '1.0.2' description: |- Bar assistant is a self hosted application for managing your home bar. It allows you to add ingredients and create custom cocktail recipes. servers: @@ -625,7 +625,7 @@ paths: get: tags: - Images - summary: Get a thumbnail of a response + summary: Get a thumbnail of an image responses: '200': description: Successful response