Merge branch 'main' into new-big-calendar-feature
This commit is contained in:
commit
82b4ada49e
2
.github/workflows/test-and-lint-php.yml
vendored
2
.github/workflows/test-and-lint-php.yml
vendored
@ -45,7 +45,7 @@ jobs:
|
|||||||
run: composer install --prefer-dist --no-interaction --no-suggest
|
run: composer install --prefer-dist --no-interaction --no-suggest
|
||||||
|
|
||||||
- name: Run PHP linter
|
- name: Run PHP linter
|
||||||
run: composer ecs
|
run: composer cs
|
||||||
|
|
||||||
- name: Execute tests
|
- name: Execute tests
|
||||||
run: php artisan test --env=ci
|
run: php artisan test --env=ci
|
||||||
|
2
Procfile
2
Procfile
@ -1,3 +1,3 @@
|
|||||||
web: vendor/bin/heroku-php-nginx -C environment/prod/nginx.conf public/
|
web: vendor/bin/heroku-php-nginx -C environment/prod/nginx.conf public/
|
||||||
release: php artisan migrate --force && php artisan cache:clear && php artisan config:cache
|
release: php artisan config:cache && php artisan route:cache && php artisan migrate --force
|
||||||
worker: php artisan queue:work
|
worker: php artisan queue:work
|
||||||
|
@ -6,12 +6,15 @@ namespace Toby\Architecture\Providers;
|
|||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Toby\Eloquent\Models\User;
|
use Toby\Eloquent\Models\User;
|
||||||
|
use Toby\Eloquent\Models\VacationRequest;
|
||||||
use Toby\Eloquent\Observers\UserObserver;
|
use Toby\Eloquent\Observers\UserObserver;
|
||||||
|
use Toby\Eloquent\Observers\VacationRequestObserver;
|
||||||
|
|
||||||
class ObserverServiceProvider extends ServiceProvider
|
class ObserverServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
public function boot(): void
|
public function boot(): void
|
||||||
{
|
{
|
||||||
User::observe(UserObserver::class);
|
User::observe(UserObserver::class);
|
||||||
|
VacationRequest::observe(VacationRequestObserver::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,11 +91,6 @@ class VacationRequest extends Model
|
|||||||
->where("to", ">=", $vacationRequest->from);
|
->where("to", ">=", $vacationRequest->from);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getNameAttribute(): string
|
|
||||||
{
|
|
||||||
return "{$this->id}/{$this->yearPeriod->year}";
|
|
||||||
}
|
|
||||||
|
|
||||||
public function hasFlowSkipped(): bool
|
public function hasFlowSkipped(): bool
|
||||||
{
|
{
|
||||||
return $this->flow_skipped;
|
return $this->flow_skipped;
|
||||||
|
@ -15,6 +15,7 @@ use Illuminate\Support\Collection;
|
|||||||
* @property int $id
|
* @property int $id
|
||||||
* @property int $year
|
* @property int $year
|
||||||
* @property Collection $vacationLimits
|
* @property Collection $vacationLimits
|
||||||
|
* @property Collection $vacationRequests
|
||||||
* @property Collection $holidays
|
* @property Collection $holidays
|
||||||
*/
|
*/
|
||||||
class YearPeriod extends Model
|
class YearPeriod extends Model
|
||||||
@ -41,6 +42,11 @@ class YearPeriod extends Model
|
|||||||
return $this->hasMany(VacationLimit::class);
|
return $this->hasMany(VacationLimit::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function vacationRequests(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(VacationRequest::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function holidays(): HasMany
|
public function holidays(): HasMany
|
||||||
{
|
{
|
||||||
return $this->hasMany(Holiday::class);
|
return $this->hasMany(Holiday::class);
|
||||||
|
18
app/Eloquent/Observers/VacationRequestObserver.php
Normal file
18
app/Eloquent/Observers/VacationRequestObserver.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Toby\Eloquent\Observers;
|
||||||
|
|
||||||
|
use Toby\Eloquent\Models\VacationRequest;
|
||||||
|
|
||||||
|
class VacationRequestObserver
|
||||||
|
{
|
||||||
|
public function creating(VacationRequest $vacationRequest): void
|
||||||
|
{
|
||||||
|
$count = $vacationRequest->yearPeriod->vacationRequests()->count();
|
||||||
|
$number = $count + 1;
|
||||||
|
|
||||||
|
$vacationRequest->name = "{$number}/{$vacationRequest->yearPeriod->year}";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Toby\Infrastructure\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Toby\Eloquent\Models\YearPeriod;
|
||||||
|
|
||||||
|
class RebuildDocumentNumberingSystem extends Command
|
||||||
|
{
|
||||||
|
protected $signature = "toby:rebuild-document-numbering-system";
|
||||||
|
protected $description = "Rebuilds the document numbering system to {number}/{year}";
|
||||||
|
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
$yearPeriods = YearPeriod::all();
|
||||||
|
|
||||||
|
foreach ($yearPeriods as $yearPeriod) {
|
||||||
|
$number = 1;
|
||||||
|
|
||||||
|
$vacationRequests = $yearPeriod
|
||||||
|
->vacationRequests()
|
||||||
|
->oldest()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
foreach ($vacationRequests as $vacationRequest) {
|
||||||
|
$vacationRequest->update(["name" => "{$number}/{$yearPeriod->year}"]);
|
||||||
|
|
||||||
|
$number++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2
artisan
2
artisan
@ -1,6 +1,8 @@
|
|||||||
#!/usr/bin/env php
|
#!/usr/bin/env php
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Contracts\Console\Kernel;
|
use Illuminate\Contracts\Console\Kernel;
|
||||||
use Symfony\Component\Console\Input\ArgvInput;
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||||
|
@ -7,7 +7,7 @@ use Blumilk\Codestyle\Configuration\Defaults\LaravelPaths;
|
|||||||
|
|
||||||
$paths = new LaravelPaths();
|
$paths = new LaravelPaths();
|
||||||
$config = new Config(
|
$config = new Config(
|
||||||
paths: $paths->add("public", "bootstrap/app.php", "ecs.php", "server.php"),
|
paths: $paths->add("codestyle.php"),
|
||||||
);
|
);
|
||||||
|
|
||||||
return $config->config();
|
return $config->config();
|
@ -13,7 +13,7 @@
|
|||||||
"fruitcake/laravel-cors": "^2.0",
|
"fruitcake/laravel-cors": "^2.0",
|
||||||
"guzzlehttp/guzzle": "^7.0.1",
|
"guzzlehttp/guzzle": "^7.0.1",
|
||||||
"inertiajs/inertia-laravel": "^0.5.1",
|
"inertiajs/inertia-laravel": "^0.5.1",
|
||||||
"laravel/framework": "^9.0",
|
"laravel/framework": "9.5.*",
|
||||||
"laravel/sanctum": "^2.14",
|
"laravel/sanctum": "^2.14",
|
||||||
"laravel/socialite": "^5.2",
|
"laravel/socialite": "^5.2",
|
||||||
"laravel/telescope": "^4.6",
|
"laravel/telescope": "^4.6",
|
||||||
@ -24,7 +24,7 @@
|
|||||||
"spatie/laravel-model-states": "^2.1"
|
"spatie/laravel-model-states": "^2.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"blumilksoftware/codestyle": "^0.10.0",
|
"blumilksoftware/codestyle": "^1.0.0",
|
||||||
"fakerphp/faker": "^1.19",
|
"fakerphp/faker": "^1.19",
|
||||||
"laravel/dusk": "^6.21",
|
"laravel/dusk": "^6.21",
|
||||||
"mockery/mockery": "^1.4.4",
|
"mockery/mockery": "^1.4.4",
|
||||||
@ -45,8 +45,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ecs": "./vendor/bin/ecs check --clear-cache",
|
"cs": "./vendor/bin/php-cs-fixer fix --dry-run --diff --config codestyle.php",
|
||||||
"ecsf": "./vendor/bin/ecs check --clear-cache --fix",
|
"csf": "./vendor/bin/php-cs-fixer fix --diff --config codestyle.php",
|
||||||
"test": "@php artisan test",
|
"test": "@php artisan test",
|
||||||
"fresh": "@php artisan migrate:fresh",
|
"fresh": "@php artisan migrate:fresh",
|
||||||
"fresh:demo": [
|
"fresh:demo": [
|
||||||
|
969
composer.lock
generated
969
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class() extends Migration {
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table("vacation_requests", function (Blueprint $table): void {
|
||||||
|
$table->string("name")->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table("vacation_requests", function (Blueprint $table): void {
|
||||||
|
$table->dropColumn("name");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
28
package-lock.json
generated
28
package-lock.json
generated
@ -17,7 +17,7 @@
|
|||||||
"@vue/compiler-sfc": "^3.2.31",
|
"@vue/compiler-sfc": "^3.2.31",
|
||||||
"autoprefixer": "^10.4.4",
|
"autoprefixer": "^10.4.4",
|
||||||
"axios": "^0.26.1",
|
"axios": "^0.26.1",
|
||||||
"echarts": "^5.3.1",
|
"echarts": "^5.3.2",
|
||||||
"eslit": "^6.0.0",
|
"eslit": "^6.0.0",
|
||||||
"flatpickr": "^4.6.11",
|
"flatpickr": "^4.6.11",
|
||||||
"laravel-mix": "^6.0.43",
|
"laravel-mix": "^6.0.43",
|
||||||
@ -34,7 +34,7 @@
|
|||||||
"vue3-popper": "^1.4.2"
|
"vue3-popper": "^1.4.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.11.0",
|
"eslint": "^8.12.0",
|
||||||
"eslint-plugin-tailwindcss": "^3.5.0",
|
"eslint-plugin-tailwindcss": "^3.5.0",
|
||||||
"eslint-plugin-vue": "^8.5.0"
|
"eslint-plugin-vue": "^8.5.0"
|
||||||
}
|
}
|
||||||
@ -4167,9 +4167,9 @@
|
|||||||
"integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA=="
|
"integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA=="
|
||||||
},
|
},
|
||||||
"node_modules/echarts": {
|
"node_modules/echarts": {
|
||||||
"version": "5.3.1",
|
"version": "5.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.3.2.tgz",
|
||||||
"integrity": "sha512-nWdlbgX3OVY0hpqncSvp0gDt1FRSKWn7lsWEH+PHmfCuvE0QmSw17pczQvm8AvawnLEkmf1Cts7YwQJZNC0AEQ==",
|
"integrity": "sha512-LWCt7ohOKdJqyiBJ0OGBmE9szLdfA9sGcsMEi+GGoc6+Xo75C+BkcT/6NNGRHAWtnQl2fNow05AQjznpap28TQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "2.3.0",
|
"tslib": "2.3.0",
|
||||||
"zrender": "5.3.1"
|
"zrender": "5.3.1"
|
||||||
@ -4295,9 +4295,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint": {
|
"node_modules/eslint": {
|
||||||
"version": "8.11.0",
|
"version": "8.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.12.0.tgz",
|
||||||
"integrity": "sha512-/KRpd9mIRg2raGxHRGwW9ZywYNAClZrHjdueHcrVDuO3a6bj83eoTirCCk0M0yPwOjWYKHwRVRid+xK4F/GHgA==",
|
"integrity": "sha512-it1oBL9alZg1S8UycLm5YDMAkIhtH6FtAzuZs6YvoGVldWjbS08BkAdb/ymP9LlAyq8koANu32U7Ib/w+UNh8Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint/eslintrc": "^1.2.1",
|
"@eslint/eslintrc": "^1.2.1",
|
||||||
@ -12762,9 +12762,9 @@
|
|||||||
"integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA=="
|
"integrity": "sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA=="
|
||||||
},
|
},
|
||||||
"echarts": {
|
"echarts": {
|
||||||
"version": "5.3.1",
|
"version": "5.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.3.2.tgz",
|
||||||
"integrity": "sha512-nWdlbgX3OVY0hpqncSvp0gDt1FRSKWn7lsWEH+PHmfCuvE0QmSw17pczQvm8AvawnLEkmf1Cts7YwQJZNC0AEQ==",
|
"integrity": "sha512-LWCt7ohOKdJqyiBJ0OGBmE9szLdfA9sGcsMEi+GGoc6+Xo75C+BkcT/6NNGRHAWtnQl2fNow05AQjznpap28TQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "2.3.0",
|
"tslib": "2.3.0",
|
||||||
"zrender": "5.3.1"
|
"zrender": "5.3.1"
|
||||||
@ -12865,9 +12865,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"eslint": {
|
"eslint": {
|
||||||
"version": "8.11.0",
|
"version": "8.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.12.0.tgz",
|
||||||
"integrity": "sha512-/KRpd9mIRg2raGxHRGwW9ZywYNAClZrHjdueHcrVDuO3a6bj83eoTirCCk0M0yPwOjWYKHwRVRid+xK4F/GHgA==",
|
"integrity": "sha512-it1oBL9alZg1S8UycLm5YDMAkIhtH6FtAzuZs6YvoGVldWjbS08BkAdb/ymP9LlAyq8koANu32U7Ib/w+UNh8Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@eslint/eslintrc": "^1.2.1",
|
"@eslint/eslintrc": "^1.2.1",
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
"@vue/compiler-sfc": "^3.2.31",
|
"@vue/compiler-sfc": "^3.2.31",
|
||||||
"autoprefixer": "^10.4.4",
|
"autoprefixer": "^10.4.4",
|
||||||
"axios": "^0.26.1",
|
"axios": "^0.26.1",
|
||||||
"echarts": "^5.3.1",
|
"echarts": "^5.3.2",
|
||||||
"eslit": "^6.0.0",
|
"eslit": "^6.0.0",
|
||||||
"flatpickr": "^4.6.11",
|
"flatpickr": "^4.6.11",
|
||||||
"laravel-mix": "^6.0.43",
|
"laravel-mix": "^6.0.43",
|
||||||
@ -41,7 +41,7 @@
|
|||||||
"vue3-popper": "^1.4.2"
|
"vue3-popper": "^1.4.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.11.0",
|
"eslint": "^8.12.0",
|
||||||
"eslint-plugin-tailwindcss": "^3.5.0",
|
"eslint-plugin-tailwindcss": "^3.5.0",
|
||||||
"eslint-plugin-vue": "^8.5.0"
|
"eslint-plugin-vue": "^8.5.0"
|
||||||
}
|
}
|
||||||
|
@ -71,10 +71,8 @@ If xDebug is installed, set environment variable **XDEBUG_MODE=off** to improve
|
|||||||
|
|
||||||
### Code style check
|
### Code style check
|
||||||
|
|
||||||
dcr php php vendor/bin/ecs check
|
dcr php composer cs
|
||||||
dcr php composer ecs
|
dcr php composer csf
|
||||||
dcr php php vendor/bin/ecs check --fix
|
|
||||||
dcr php composer ecsf
|
|
||||||
dcr node npm run lint
|
dcr node npm run lint
|
||||||
dcr node npm run lintf
|
dcr node npm run lintf
|
||||||
|
|
||||||
|
11
server.php
11
server.php
@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
$uri = urldecode(parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH));
|
|
||||||
|
|
||||||
if ($uri !== "/" && file_exists(__DIR__ . "/public" . $uri)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once __DIR__ . "/public/index.php";
|
|
Loading…
x
Reference in New Issue
Block a user