Skip to content

Commit

Permalink
Merge pull request #21 from karlomikus/develop
Browse files Browse the repository at this point in the history
Merge 051
  • Loading branch information
karlomikus committed Nov 22, 2022
2 parents 241d187 + a254b21 commit d8c23bf
Show file tree
Hide file tree
Showing 11 changed files with 257 additions and 8 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ Bar assistant is a self hosted application for managing your home bar. It allows

This repository only contains the API server, if you are looking for easy to use web client, take a look at [Salt Rim](https://github.com/karlomikus/vue-salt-rim).

<p align="center">
<a href="https://bar-api.karlomikus.com" target="_blank">Click here to view API demo.</a>
<br>
<a href="https://bar.karlomikus.com" target="_blank">Click here to view frontend demo.</a>
<br>
<strong>Email:</strong> [email protected] &middot; <strong>Password:</strong> password
</p>

## Features
- Includes all current IBA cocktails
- Over 100 ingredients
Expand Down
2 changes: 2 additions & 0 deletions app/Console/Commands/OpenBar.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public function handle()
{
Model::unguard();

$this->info('Opening the bar in ' . App::environment() . ' environment...');

$this->info('Checking connection to your search server [' . config('scout.meilisearch.host') . ']...');

try {
Expand Down
1 change: 1 addition & 0 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@ class Kernel extends HttpKernel
'signed' => \Kami\Cocktail\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'cacheResponse' => \Spatie\ResponseCache\Middlewares\CacheResponse::class,
];
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"laravel/scout": "^9.4",
"laravel/tinker": "^2.7",
"meilisearch/meilisearch-php": "^0.25.0",
"spatie/laravel-responsecache": "^7.4",
"spatie/laravel-sluggable": "^3.4",
"symfony/yaml": "^6.1"
},
Expand Down
145 changes: 144 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/bar-assistant.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
|
*/

'version' => 'v0.5.0',
'version' => 'v0.5.1',

/*
|--------------------------------------------------------------------------
Expand Down
94 changes: 94 additions & 0 deletions config/responsecache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php

return [
/*
* Determine if the response cache middleware should be enabled.
*/
'enabled' => env('RESPONSE_CACHE_ENABLED', true),

/*
* The given class will determinate if a request should be cached. The
* default class will cache all successful GET-requests.
*
* You can provide your own class given that it implements the
* CacheProfile interface.
*/
'cache_profile' => Spatie\ResponseCache\CacheProfiles\CacheAllSuccessfulGetRequests::class,

/*
* Optionally, you can specify a header that will force a cache bypass.
* This can be useful to monitor the performance of your application.
*/
'cache_bypass_header' => [
'name' => env('CACHE_BYPASS_HEADER_NAME', null),
'value' => env('CACHE_BYPASS_HEADER_VALUE', null),
],

/*
* When using the default CacheRequestFilter this setting controls the
* default number of seconds responses must be cached.
*/
'cache_lifetime_in_seconds' => env('RESPONSE_CACHE_LIFETIME', 60 * 60 * 24 * 7),

/*
* This setting determines if a http header named with the cache time
* should be added to a cached response. This can be handy when
* debugging.
*/
'add_cache_time_header' => env('APP_DEBUG', true),

/*
* This setting determines the name of the http header that contains
* the time at which the response was cached
*/
'cache_time_header_name' => env('RESPONSE_CACHE_HEADER_NAME', 'laravel-responsecache'),

/*
* This setting determines if a http header named with the cache age
* should be added to a cached response. This can be handy when
* debugging.
* ONLY works when "add_cache_time_header" is also active!
*/
'add_cache_age_header' => env('RESPONSE_CACHE_AGE_HEADER', false),

/*
* This setting determines the name of the http header that contains
* the age of cache
*/
'cache_age_header_name' => env('RESPONSE_CACHE_AGE_HEADER_NAME', 'laravel-responsecache-age'),

/*
* Here you may define the cache store that should be used to store
* requests. This can be the name of any store that is
* configured in app/config/cache.php
*/
'cache_store' => env('RESPONSE_CACHE_DRIVER', 'file'),

/*
* Here you may define replacers that dynamically replace content from the response.
* Each replacer must implement the Replacer interface.
*/
'replacers' => [
\Spatie\ResponseCache\Replacers\CsrfTokenReplacer::class,
],

/*
* If the cache driver you configured supports tags, you may specify a tag name
* here. All responses will be tagged. When clearing the responsecache only
* items with that tag will be flushed.
*
* You may use a string or an array here.
*/
'cache_tag' => '',

/*
* This class is responsible for generating a hash for a request. This hash
* is used to look up an cached response.
*/
'hasher' => \Spatie\ResponseCache\Hasher\DefaultHasher::class,

/*
* This class is responsible for serializing responses.
*/
'serializer' => \Spatie\ResponseCache\Serializers\DefaultSerializer::class,
];
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function up()

Schema::create('cocktail_favorites', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained();
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->foreignId('cocktail_id')->unique()->constrained()->onDelete('cascade');
$table->timestamps();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function up()

Schema::create('cocktail_tag', function (Blueprint $table) {
$table->id();
$table->foreignId('tag_id')->constrained();
$table->foreignId('tag_id')->constrained()->onDelete('cascade');
$table->foreignId('cocktail_id')->constrained()->onDelete('cascade');
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function up()
{
Schema::create('user_ingredients', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained();
$table->foreignId('ingredient_id')->constrained();
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->foreignId('ingredient_id')->constrained()->onDelete('cascade');

$table->unique(['user_id', 'ingredient_id']);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function up()
{
Schema::create('user_shopping_lists', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained();
$table->foreignId('ingredient_id')->constrained();
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->foreignId('ingredient_id')->constrained()->onDelete('cascade');
$table->timestamps();

$table->unique(['user_id', 'ingredient_id']);
Expand Down

0 comments on commit d8c23bf

Please sign in to comment.