diff --git a/app/Http/Controllers/Fo/EggController.php b/app/Http/Controllers/Fo/EggController.php index be21c69..34e86d9 100644 --- a/app/Http/Controllers/Fo/EggController.php +++ b/app/Http/Controllers/Fo/EggController.php @@ -84,8 +84,11 @@ class EggController extends Controller $inuavs = $eleveurs->pluck('inuavs')->flatten(1); - $mep = CafelEggMiseEnPlace::whereIn('inuav_code', $inuavs) - ->where('transfert_date', '<', $datePonte) + $mep = CafelEggMiseEnPlace::query(); + collect($inuavs)->map(function ($inuav) use ($mep) { + $mep->where('inuav_codes', 'LIKE', "%{$inuav}%"); + }); + $mep->where('transfert_date', '<', $datePonte) ->orderBy('transfert_date', 'DESC')->first(); if ($mep) { diff --git a/app/Jobs/CafelEggBreederJob.php b/app/Jobs/CafelEggBreederJob.php index d37318f..86265b3 100644 --- a/app/Jobs/CafelEggBreederJob.php +++ b/app/Jobs/CafelEggBreederJob.php @@ -5,7 +5,9 @@ namespace App\Jobs; use App\Exceptions\CafelApiException; use App\Exceptions\CafelApiImageFetchException; use App\Lib\CafelApi\Models\CafelEggBreeder as ApiCafelEggBreeder; +use App\Lib\ToolboxHelper; use App\Models\CafelEggBreeder; +use Illuminate\Validation\ValidationException; class CafelEggBreederJob extends CafelJobs { @@ -16,6 +18,16 @@ class CafelEggBreederJob extends CafelJobs */ public function handle() { + // ! We have to remove all breeders to reimport them all in order to make sure + // ! to delete breeders that dont exists anymore (Api fetch constrain) + // ! vu avec Sylvain 27/10/2022 + // * Destroy breeder one by one to trigger destroy event + /** @var \Illuminate\Database\Eloquent\Collection<\App\Models\CafelEggBreeder> */ + $eggBreeders = CafelEggBreeder::all(); + $eggBreeders->each(function (CafelEggBreeder $breeder) { + $breeder->deleteOrFail(); + }); + $this->syncWithCafelApi( ApiCafelEggBreeder::class, 'cafel.ldc.eleveursoeufs', @@ -41,8 +53,23 @@ class CafelEggBreederJob extends CafelJobs ) : null; } catch (CafelApiImageFetchException | CafelApiException $e) { report($e); - $row['path_picture_1'] = null; - } + $validationException = ValidationException::withMessages([ + 'path_picture_1' => $e->getMessage() + ]); + + ToolboxHelper::useReflectionToUpdateProperty( + $validationException->validator, + 'data', + ['path_picture_1' => $row['path_picture_1']] + ); + ToolboxHelper::useReflectionToUpdateProperty( + $validationException->validator, + 'failedRules', + ['path_picture_1' => $e->getMessage()] + ); + + throw $validationException; + }//end try try { $row['path_picture_2'] = !empty($row['path_picture_2']) ? ApiCafelEggBreeder::fetchPicture( @@ -51,8 +78,23 @@ class CafelEggBreederJob extends CafelJobs ) : null; } catch (CafelApiImageFetchException | CafelApiException $e) { report($e); - $row['path_picture_2'] = null; - } + $validationException = ValidationException::withMessages([ + 'path_picture_2' => $e->getMessage() + ]); + + ToolboxHelper::useReflectionToUpdateProperty( + $validationException->validator, + 'data', + ['path_picture_2' => $row['path_picture_2']] + ); + ToolboxHelper::useReflectionToUpdateProperty( + $validationException->validator, + 'failedRules', + ['path_picture_2' => $e->getMessage()] + ); + + throw $validationException; + }//end try foreach (['exploitation', 'aboutyou', 'vocation', 'likeinjob', 'loue_means'] as $fieldName) { $row[$fieldName] = !empty($row[$fieldName]) ? $row[$fieldName] : null; diff --git a/app/Jobs/CafelJobs.php b/app/Jobs/CafelJobs.php index 2cc2463..ba269ee 100644 --- a/app/Jobs/CafelJobs.php +++ b/app/Jobs/CafelJobs.php @@ -70,12 +70,24 @@ abstract class CafelJobs implements ShouldQueue try { $saveCallback($row); } catch (ValidationException $e) { + /** @var \Illuminate\Validation\Validator $validator */ + $validator = $e->validator; + /** @var array */ + $failed = $validator->invalid(); $this->invalidRows[] = collect($row)->put('validation_message', collect($e->errors()) - ->mapWithKeys(function (array $messages, string $attribute) { - return [$attribute => collect($messages)->implode(', ')]; + ->mapWithKeys(function (array $messages, string $attribute) use ($failed) { + if (!array_key_exists($attribute, $failed)) { + throw new \RuntimeException( + "ValidationException is missing faling data for '{$attribute}'" + ); + } + return [ + $attribute => collect($messages)->implode(', ') . + ' Valeur vérifiée : ' . \json_encode($failed[$attribute]) + ]; })->implode(' '))->all(); } - } + }//end foreach } while (!empty($result)); } diff --git a/app/Jobs/CafelMepEggJob.php b/app/Jobs/CafelMepEggJob.php index d286e12..7b34e0a 100644 --- a/app/Jobs/CafelMepEggJob.php +++ b/app/Jobs/CafelMepEggJob.php @@ -23,6 +23,11 @@ class CafelMepEggJob extends CafelJobs 'dateFin' => now()->format('Y-m-d') ], function (array $row) { + // * Explode inuav + if (\array_key_exists('inuav_codes', $row)) { + $row['inuav_codes'] = explode(',', $row['inuav_codes']); + } + // * Validate row data CafelMepEgg::validateDataRow($row); diff --git a/app/Jobs/CafelMepPoultryJob.php b/app/Jobs/CafelMepPoultryJob.php index c570fa5..bbf319d 100644 --- a/app/Jobs/CafelMepPoultryJob.php +++ b/app/Jobs/CafelMepPoultryJob.php @@ -23,6 +23,11 @@ class CafelMepPoultryJob extends CafelJobs 'dateFin' => now()->format('Y-m-d') ], function (array $row) { + // * Explode inuav + if (\array_key_exists('inuav_codes', $row)) { + $row['inuav_codes'] = explode(',', $row['inuav_codes']); + } + // * Validate row data CafelMepPoultry::validateDataRow($row); diff --git a/app/Jobs/CafelPoultryBreederJob.php b/app/Jobs/CafelPoultryBreederJob.php index 5950f1e..1d97797 100644 --- a/app/Jobs/CafelPoultryBreederJob.php +++ b/app/Jobs/CafelPoultryBreederJob.php @@ -5,7 +5,9 @@ namespace App\Jobs; use App\Exceptions\CafelApiException; use App\Exceptions\CafelApiImageFetchException; use App\Lib\CafelApi\Models\CafelPoultryBreeder as ApiCafelPoultryBreeder; +use App\Lib\ToolboxHelper; use App\Models\CafelPoultryBreeder; +use Illuminate\Validation\ValidationException; class CafelPoultryBreederJob extends CafelJobs { @@ -16,6 +18,16 @@ class CafelPoultryBreederJob extends CafelJobs */ public function handle() { + // ! We have to remove all breeders to reimport them all in order to make sure + // ! to delete breeders that dont exists anymore (Api fetch constrain) + // ! vu avec Sylvain 27/10/2022 + // * Destroy breeder one by one to trigger destroy event + /** @var \Illuminate\Database\Eloquent\Collection<\App\Models\CafelEggBreeder> */ + $poultryBreeders = CafelPoultryBreeder::all(); + $poultryBreeders->each(function (CafelPoultryBreeder $breeder) { + $breeder->deleteOrFail(); + }); + $this->syncWithCafelApi( ApiCafelPoultryBreeder::class, 'cafel.ldc.eleveursvolailles', @@ -41,8 +53,23 @@ class CafelPoultryBreederJob extends CafelJobs ) : null; } catch (CafelApiImageFetchException | CafelApiException $e) { report($e); - $row['path_picture_1'] = null; - } + $validationException = ValidationException::withMessages([ + 'path_picture_1' => $e->getMessage() + ]); + + ToolboxHelper::useReflectionToUpdateProperty( + $validationException->validator, + 'data', + ['path_picture_1' => $row['path_picture_1']] + ); + ToolboxHelper::useReflectionToUpdateProperty( + $validationException->validator, + 'failedRules', + ['path_picture_1' => $e->getMessage()] + ); + + throw $validationException; + }//end try try { $row['path_picture_2'] = !empty($row['path_picture_2']) ? ApiCafelPoultryBreeder::fetchPicture( @@ -51,8 +78,23 @@ class CafelPoultryBreederJob extends CafelJobs ) : null; } catch (CafelApiImageFetchException | CafelApiException $e) { report($e); - $row['path_picture_2'] = null; - } + $validationException = ValidationException::withMessages([ + 'path_picture_2' => $e->getMessage() + ]); + + ToolboxHelper::useReflectionToUpdateProperty( + $validationException->validator, + 'data', + ['path_picture_2' => $row['path_picture_2']] + ); + ToolboxHelper::useReflectionToUpdateProperty( + $validationException->validator, + 'failedRules', + ['path_picture_2' => $e->getMessage()] + ); + + throw $validationException; + }//end try foreach (['issue_1', 'issue_2'] as $fieldName) { $row[$fieldName] = !empty($row[$fieldName]) ? $row[$fieldName] : null; diff --git a/app/Lib/CafelApi/Models/CafelEggBreeder.php b/app/Lib/CafelApi/Models/CafelEggBreeder.php index cba2bf8..da69eb0 100644 --- a/app/Lib/CafelApi/Models/CafelEggBreeder.php +++ b/app/Lib/CafelApi/Models/CafelEggBreeder.php @@ -17,7 +17,7 @@ abstract class CafelEggBreeder extends CafelClientModel * @var array */ public const UNIQUE_COLUMN_KEYS = [ - 'cafel_code' + 'cafel_code', 'ede_code' ]; /** @@ -43,7 +43,7 @@ abstract class CafelEggBreeder extends CafelClientModel * 2 chiffres qui représentent le numéro d’ordre de chaque atelier dans une même exploitation * eg : 1FRZFC01 */ - 'ede_code' => 'required|regex:/[0-3][A-Z]{5}\d\d/', + 'ede_code' => 'required|regex:/^[0-3][A-Z]{5}\d\d$/', // Valeurs possibles pour civility : 1 M, 2 MME, 3 EUX, 4 ELLES . 'civility' => ['required', [EnumIsValidRule::class, BreederCivilty::class]], 'lastname' => 'required|string|min:1|max:255', diff --git a/app/Lib/CafelApi/Models/CafelMepEgg.php b/app/Lib/CafelApi/Models/CafelMepEgg.php index 95713f0..53ee779 100644 --- a/app/Lib/CafelApi/Models/CafelMepEgg.php +++ b/app/Lib/CafelApi/Models/CafelMepEgg.php @@ -22,8 +22,10 @@ abstract class CafelMepEgg extends CafelClientModel * @var array */ protected static $validationRules = [ + // Eg V072FXT (un seul ou plusieurs separe par une virgule). + 'inuav_codes' => 'required|array', // Eg V072FXT (un seul par ligne). - 'inuav_code' => 'required|string|regex:/^[A-Z]\d{3}[A-Z]{3}$/', + 'inuav_codes.*' => 'required|string|regex:/^[A-Z]\d{3}[A-Z]{3}$/', // Eg 19377/0 . 'batch_code' => [ 'required', @@ -39,7 +41,7 @@ abstract class CafelMepEgg extends CafelClientModel * @var array */ protected static $columnsTranslations = [ - 'Inuav_code' => 'inuav_code', + 'Inuav_code' => 'inuav_codes', 'Batch_code' => 'batch_code', 'Transfert_date' => 'transfert_date' ]; diff --git a/app/Lib/CafelApi/Models/CafelMepPoultry.php b/app/Lib/CafelApi/Models/CafelMepPoultry.php index cdcf79a..c986a07 100644 --- a/app/Lib/CafelApi/Models/CafelMepPoultry.php +++ b/app/Lib/CafelApi/Models/CafelMepPoultry.php @@ -22,8 +22,10 @@ abstract class CafelMepPoultry extends CafelClientModel * @var array */ protected static $validationRules = [ + // Eg V072FXT (un seul ou plusieurs separe par une virgule). + 'inuav_codes' => 'required|array', // Eg V072FXT (un seul par ligne). - 'inuav_code' => 'required|string|regex:/^[A-Z]\d{3}[A-Z]{3}$/', + 'inuav_codes.*' => 'required|string|regex:/^[A-Z]\d{3}[A-Z]{3}$/', // Eg 19377/0 . 'batch_code' => [ 'required', @@ -39,7 +41,7 @@ abstract class CafelMepPoultry extends CafelClientModel * @var array */ protected static $columnsTranslations = [ - 'Inuav_code' => 'inuav_code', + 'Inuav_code' => 'inuav_codes', 'Batch_code' => 'batch_code', 'Transfert_date' => 'transfert_date' ]; diff --git a/app/Lib/CafelApi/Transport/ApiInterface.php b/app/Lib/CafelApi/Transport/ApiInterface.php index 57b9eb4..23fd42e 100644 --- a/app/Lib/CafelApi/Transport/ApiInterface.php +++ b/app/Lib/CafelApi/Transport/ApiInterface.php @@ -105,7 +105,7 @@ class ApiInterface * * @param \App\Lib\CafelApi\Transport\Request $request * @return \App\Lib\CafelApi\Transport\Response - * @throws \App\Exceptions\CafelApiException If reponse status is KO. + * @throws \App\Exceptions\CafelApiException If reponse status is KO or not Json. */ public function call(Request $request): Response { @@ -122,8 +122,9 @@ class ApiInterface /** * Process request * - * @param Request $request - * @return Response + * @param \App\Lib\CafelApi\Transport\Request $request + * @return \App\Lib\CafelApi\Transport\Response + * @throws \App\Exceptions\CafelApiException If HTTP response body in not JSON. */ private function processRequest(Request $request): Response { @@ -136,13 +137,13 @@ class ApiInterface $status = in_array($response->getStatusCode(), [200, 201]) ? ApiStatus::OK() : ApiStatus::KO(); - return new Response($status, $response); + return new Response($status, $response, $request); } /** * Add spécific headers to the request * - * @param Request $request + * @param \App\Lib\CafelApi\Transport\Request $request * @return void */ private function setHeaders(Request &$request): void diff --git a/app/Lib/CafelApi/Transport/Response.php b/app/Lib/CafelApi/Transport/Response.php index a6dcdda..8f6423d 100644 --- a/app/Lib/CafelApi/Transport/Response.php +++ b/app/Lib/CafelApi/Transport/Response.php @@ -56,9 +56,10 @@ class Response * * @param \App\Enums\ApiStatus $status * @param \Psr\Http\Message\ResponseInterface $response + * @param \App\Lib\CafelApi\Transport\Request $request * @throws \App\Exceptions\CafelApiException If HTTP response body in not JSON. */ - public function __construct(ApiStatus $status, ResponseInterface $response) + public function __construct(ApiStatus $status, ResponseInterface $response, Request $request) { $this->response = $response; $this->status = $status; @@ -74,9 +75,18 @@ class Response // * Body should be json data. if (($decodedJson = $this->tryDecodeJson($this->body->getContents())) === false) { if (in_array(config('app.env'), ['testing', 'local'])) { - dump((string)$this->body); + dump( + 'should have been json', + $this->httpCode, + $this->status, + $this->headers, + $request->uri, + (string)$this->body + ); } - throw new CafelApiException('The Api should have returned JSON data'); + throw new CafelApiException( + "The Api should have returned JSON data '{$request->uri}'" + ); } $this->body = $decodedJson; diff --git a/app/Lib/ToolboxHelper.php b/app/Lib/ToolboxHelper.php index 71276b1..4256abb 100644 --- a/app/Lib/ToolboxHelper.php +++ b/app/Lib/ToolboxHelper.php @@ -12,6 +12,23 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; abstract class ToolboxHelper { + /** + * Update any prop using reflexion + * + * @param object $object + * @param string $property + * @param mixed $value + * @return void + * @throws \ReflectionException If the class or property does not exist. + */ + public static function useReflectionToUpdateProperty(object &$object, string $property, $value) + { + $refProperty = new \ReflectionProperty(\get_class($object), $property); + $refProperty->setAccessible(true); + $refProperty->setValue($object, $value); + $refProperty->setAccessible(false); + } + /** * Store an image of different types * diff --git a/app/Models/CafelEggBreeder.php b/app/Models/CafelEggBreeder.php index 1b67bdf..18079d8 100644 --- a/app/Models/CafelEggBreeder.php +++ b/app/Models/CafelEggBreeder.php @@ -5,6 +5,8 @@ namespace App\Models; use App\Enums\BreederCivilty; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Storage; +use Illuminate\Support\Facades\Validator; +use Illuminate\Validation\Rule; use Illuminate\Validation\ValidationException; use Kwaadpepper\Enum\Traits\CastsEnums; @@ -98,6 +100,7 @@ class CafelEggBreeder extends Model // * EVENT CLOSURES. static::creating(function (self $model) { return self::areInuavCodesUniques($model); + return self::isEdeCodeUnique($model); }); static::updating(function (self $model) { if ($model->getRawOriginal('path_picture_1') !== $model->path_picture_1) { @@ -107,6 +110,15 @@ class CafelEggBreeder extends Model Storage::delete(\public_path($model->getRawOriginal('path_picture_2'))); } return self::areInuavCodesUniques($model); + return self::isEdeCodeUnique($model); + }); + static::deleting(function (self $model) { + if ($model->getRawOriginal('path_picture_1')) { + Storage::delete(\public_path($model->getRawOriginal('path_picture_1'))); + } + if ($model->getRawOriginal('path_picture_2')) { + Storage::delete(\public_path($model->getRawOriginal('path_picture_2'))); + } }); } @@ -160,4 +172,21 @@ class CafelEggBreeder extends Model } return true; } + + /** + * Check if ede code is unique + * + * @param self $breeder + * @return boolean + * @throws \Illuminate\Validation\ValidationException If ede code is already used. + */ + protected static function isEdeCodeUnique(self $breeder): bool + { + Validator::make([ + 'ede_code' => $breeder->ede_code + ], ['ede_code' => [ + Rule::unique($breeder->getTable(), 'ede_code')->ignore($breeder->id) + ]])->validate(); + return true; + } } diff --git a/app/Models/CafelEggMiseEnPlace.php b/app/Models/CafelEggMiseEnPlace.php index 96d3f3e..858035f 100644 --- a/app/Models/CafelEggMiseEnPlace.php +++ b/app/Models/CafelEggMiseEnPlace.php @@ -33,7 +33,8 @@ class CafelEggMiseEnPlace extends Model * @var array */ protected $casts = [ - 'transfert_date' => 'date' + 'transfert_date' => 'date', + 'inuav_codes' => 'array' ]; /** @@ -43,7 +44,7 @@ class CafelEggMiseEnPlace extends Model */ protected $fillable = [ 'batch_code', - 'inuav_code', + 'inuav_codes', 'transfert_date' ]; } diff --git a/app/Models/CafelPoultryBreeder.php b/app/Models/CafelPoultryBreeder.php index bf6ec62..6c217ac 100644 --- a/app/Models/CafelPoultryBreeder.php +++ b/app/Models/CafelPoultryBreeder.php @@ -94,6 +94,14 @@ class CafelPoultryBreeder extends Model } return self::areInuavCodesUniques($model); }); + static::deleting(function (self $model) { + if ($model->getRawOriginal('path_picture_1')) { + Storage::delete(\public_path($model->getRawOriginal('path_picture_1'))); + } + if ($model->getRawOriginal('path_picture_2')) { + Storage::delete(\public_path($model->getRawOriginal('path_picture_2'))); + } + }); } // * METHODS diff --git a/app/Models/CafelPoultryMiseEnPlace.php b/app/Models/CafelPoultryMiseEnPlace.php index 37e3ef4..481c077 100644 --- a/app/Models/CafelPoultryMiseEnPlace.php +++ b/app/Models/CafelPoultryMiseEnPlace.php @@ -34,7 +34,8 @@ class CafelPoultryMiseEnPlace extends Model * @var array */ protected $casts = [ - 'transfert_date' => 'date' + 'transfert_date' => 'date', + 'inuav_codes' => 'array' ]; /** @@ -44,7 +45,7 @@ class CafelPoultryMiseEnPlace extends Model */ protected $fillable = [ 'batch_code', - 'inuav_code', + 'inuav_codes', 'transfert_date' ]; diff --git a/config/cafel.php b/config/cafel.php index 5dfade3..7bf04a4 100644 --- a/config/cafel.php +++ b/config/cafel.php @@ -1,8 +1,9 @@ 30, + 'food_retain' => 370, // * How many days should we retain MEP (egg) 'mises_en_places_retain' => 370, 'client_version' => '1.0', diff --git a/database/migrations/2022_10_27_152412_add_unique_on_ede_egg_breeders.php b/database/migrations/2022_10_27_152412_add_unique_on_ede_egg_breeders.php new file mode 100644 index 0000000..2cc7514 --- /dev/null +++ b/database/migrations/2022_10_27_152412_add_unique_on_ede_egg_breeders.php @@ -0,0 +1,42 @@ + */ + $eggBreeders = CafelEggBreeder::all(); + $eggBreeders->each(function (CafelEggBreeder $breeder) { + $breeder->deleteOrFail(); + }); + + Schema::table('cafel_egg_breeders', function (Blueprint $table) { + $table->unique(['ede_code']); + }); + Log::alert('Please reimport all egg breeders'); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('cafel_egg_breeders', function (Blueprint $table) { + $table->dropUnique(['ede_code']); + }); + } +} diff --git a/database/migrations/2022_10_27_171315_make_mises_en_place_handle_multiple_inuav.php b/database/migrations/2022_10_27_171315_make_mises_en_place_handle_multiple_inuav.php new file mode 100644 index 0000000..19b594d --- /dev/null +++ b/database/migrations/2022_10_27_171315_make_mises_en_place_handle_multiple_inuav.php @@ -0,0 +1,81 @@ +renameColumn('inuav_code', 'inuav_codes'); + }); + Schema::table('cafel_poultry_mise_en_places', function (Blueprint $table) { + $table->renameColumn('inuav_code', 'inuav_codes'); + }); + Schema::table('cafel_egg_mise_en_places', function (Blueprint $table) { + $table->string('inuav_codes', 400)->change(); + }); + Schema::table('cafel_poultry_mise_en_places', function (Blueprint $table) { + $table->string('inuav_codes', 400)->change(); + }); + DB::table('cafel_egg_mise_en_places')->get() + ->each(function (object $eggMep) { + DB::table('cafel_egg_mise_en_places') + ->where('batch_code', $eggMep->batch_code) + ->update(['inuav_codes' => collect( + explode(',', $eggMep->inuav_codes) + )->filter()->jsonSerialize()]); + }); + DB::table('cafel_poultry_mise_en_places')->get() + ->each(function (object $poultryMep) { + DB::table('cafel_poultry_mise_en_places') + ->where('batch_code', $poultryMep->batch_code) + ->update(['inuav_codes' => collect( + explode(',', $poultryMep->inuav_codes) + )->filter()->jsonSerialize()]); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + DB::table('cafel_egg_mise_en_places')->get() + ->each(function (object $eggMep) { + DB::table('cafel_egg_mise_en_places') + ->where('batch_code', $eggMep->batch_code) + ->update(['inuav_codes' => collect(json_decode($eggMep->inuav_codes))->filter() + ->first()]); + }); + DB::table('cafel_poultry_mise_en_places')->get() + ->each(function (object $poultryMep) { + DB::table('cafel_poultry_mise_en_places') + ->where('batch_code', $poultryMep->batch_code) + ->update(['inuav_codes' => collect(json_decode($poultryMep->inuav_codes))->filter() + ->first()]); + }); + Schema::table('cafel_egg_mise_en_places', function (Blueprint $table) { + $table->string('inuav_codes', 100)->change(); + }); + Schema::table('cafel_poultry_mise_en_places', function (Blueprint $table) { + $table->string('inuav_codes', 100)->change(); + }); + Schema::table('cafel_egg_mise_en_places', function (Blueprint $table) { + $table->renameColumn('inuav_codes', 'inuav_code'); + }); + Schema::table('cafel_poultry_mise_en_places', function (Blueprint $table) { + $table->renameColumn('inuav_codes', 'inuav_code'); + }); + } +}