diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c06f5e6..05f35e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: 'Tests: Playground Matrix Resource' +name: 'CI' on: push: @@ -99,7 +99,7 @@ jobs: env: XDEBUG_MODE: coverage with: - version: "10.5" + version: "11.0" php_version: "8.2" php_extensions: intl xdebug coverage_clover: clover.xml diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index d7f29d5..97cd8fe 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -45,7 +45,7 @@ 'class_definition' => [ 'multi_line_extends_each_single_line' => true, 'single_item_single_line' => true, - 'single_line' => true, + 'single_line' => false, ], 'clean_namespace' => true, 'compact_nullable_typehint' => true, @@ -59,6 +59,7 @@ 'encoding' => true, 'full_opening_tag' => true, 'fully_qualified_strict_types' => true, + 'declare_strict_types' => true, 'function_declaration' => true, 'general_phpdoc_tag_rename' => true, 'heredoc_to_nowdoc' => true, @@ -215,11 +216,12 @@ ->in([ __DIR__.'/config', __DIR__.'/database', - // __DIR__ . '/lang', + // __DIR__.'/lang', __DIR__.'/routes', + __DIR__.'/resources', __DIR__.'/src', __DIR__.'/tests/Feature', - // __DIR__ . '/tests/Unit', + __DIR__.'/tests/Unit', ]) ->name('*.php') ->notName('*.blade.php') diff --git a/README.md b/README.md index 0b9cf96..6200483 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ This application provides Swagger documentation: [swagger.json](swagger.json). - The endpoint models support locks, trash with force delete, restoring and more. - Index endpoints support advanced query filtering. +Read more on using Playground Matrix Resource [at the Read the Docs for Playground.](https://gammamatrix-playground.readthedocs.io/) + ## Installation You can install the package via composer: diff --git a/composer.json b/composer.json index 72d770c..d6c1cfa 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "gammamatrix/playground-matrix-resource", - "description": "Playground: Provide the Matrix UI for a Laravel application.", + "description": "Playground: Provides an API and a Blade UI for interacting with Playground Matrix, a Project Management System for Laravel applications.", "keywords": [ "matrix", "agile", @@ -11,7 +11,7 @@ "laravel", "playground" ], - "homepage": "https://github.com/gammamatrix/playground-matrix-resource", + "homepage": "https://gammamatrix-playground.readthedocs.io/", "license": "MIT", "authors": [ { @@ -20,26 +20,17 @@ "role": "Developer" } ], - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/gammamatrix/playground-http.git" - } - ], "require": { - "php": "^8.1", - "gammamatrix/playground-auth": "dev-develop|dev-master|dev-feature/*|^73.0", - "gammamatrix/playground-blade": "dev-develop|dev-master|dev-feature/*|^73.0", - "gammamatrix/playground-http": "dev-develop|dev-master|dev-feature/*|^73.0", - "gammamatrix/playground-login-blade": "dev-develop|dev-master|dev-feature/*|^73.0", - "gammamatrix/playground-site-blade": "dev-develop|dev-master|dev-feature/*|^73.0", - "gammamatrix/playground-matrix": "dev-develop|dev-master|dev-feature/*|^73.0" + "php": "^8.2", + "gammamatrix/playground-auth": "dev-develop|dev-master|dev-feature/*|^73.0@dev|^73.0", + "gammamatrix/playground-blade": "dev-develop|dev-master|dev-feature/*|^73.0@dev|^73.0", + "gammamatrix/playground-http": "dev-develop|dev-master|dev-feature/*|^73.0@dev|^73.0", + "gammamatrix/playground-matrix": "dev-develop|dev-master|dev-feature/*|^73.0@dev|^73.0" }, "require-dev": { - "gammamatrix/playground-test": "dev-develop|dev-master|dev-feature/*|^73.0" - }, - "suggest": { - "gammamatrix/playground-matrix": "Provides the models used by the Resource API in this package." + "gammamatrix/playground-login-blade": "dev-develop|dev-master|dev-feature/*|^73.0@dev|^73.0", + "gammamatrix/playground-site-blade": "dev-develop|dev-master|dev-feature/*|^73.0@dev|^73.0", + "gammamatrix/playground-test": "dev-develop|dev-master|dev-feature/*|^73.0@dev|^73.0" }, "minimum-stability": "dev", "prefer-stable": true, diff --git a/config/playground-matrix-resource.php b/config/playground-matrix-resource.php index ed7d984..c984ed8 100644 --- a/config/playground-matrix-resource.php +++ b/config/playground-matrix-resource.php @@ -1,5 +1,7 @@ [ 'default' => env('PLAYGROUND_MATRIX_RESOURCE_MIDDLEWARE_DEFAULT', ['web']), diff --git a/database/migrations-laravel/0001_01_01_000000_create_users_table.php b/database/migrations-laravel/0001_01_01_000000_create_users_table.php new file mode 100644 index 0000000..5ef79e4 --- /dev/null +++ b/database/migrations-laravel/0001_01_01_000000_create_users_table.php @@ -0,0 +1,51 @@ +id(); + $table->string('name'); + $table->string('email')->unique(); + $table->timestamp('email_verified_at')->nullable(); + $table->string('password'); + $table->rememberToken(); + $table->timestamps(); + }); + + Schema::create('password_reset_tokens', function (Blueprint $table) { + $table->string('email')->primary(); + $table->string('token'); + $table->timestamp('created_at')->nullable(); + }); + + Schema::create('sessions', function (Blueprint $table) { + $table->string('id')->primary(); + $table->foreignId('user_id')->nullable()->index(); + $table->string('ip_address', 45)->nullable(); + $table->text('user_agent')->nullable(); + $table->longText('payload'); + $table->integer('last_activity')->index(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('users'); + Schema::dropIfExists('password_reset_tokens'); + Schema::dropIfExists('sessions'); + } +}; diff --git a/database/migrations-laravel/0001_01_01_000001_create_cache_table.php b/database/migrations-laravel/0001_01_01_000001_create_cache_table.php new file mode 100644 index 0000000..960e12b --- /dev/null +++ b/database/migrations-laravel/0001_01_01_000001_create_cache_table.php @@ -0,0 +1,37 @@ +string('key')->primary(); + $table->mediumText('value'); + $table->integer('expiration'); + }); + + Schema::create('cache_locks', function (Blueprint $table) { + $table->string('key')->primary(); + $table->string('owner'); + $table->integer('expiration'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('cache'); + Schema::dropIfExists('cache_locks'); + } +}; diff --git a/database/migrations-laravel/0001_01_01_000002_create_jobs_table.php b/database/migrations-laravel/0001_01_01_000002_create_jobs_table.php new file mode 100644 index 0000000..0dcb8c4 --- /dev/null +++ b/database/migrations-laravel/0001_01_01_000002_create_jobs_table.php @@ -0,0 +1,59 @@ +id(); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedTinyInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); + + Schema::create('job_batches', function (Blueprint $table) { + $table->string('id')->primary(); + $table->string('name'); + $table->integer('total_jobs'); + $table->integer('pending_jobs'); + $table->integer('failed_jobs'); + $table->longText('failed_job_ids'); + $table->mediumText('options')->nullable(); + $table->integer('cancelled_at')->nullable(); + $table->integer('created_at'); + $table->integer('finished_at')->nullable(); + }); + + Schema::create('failed_jobs', function (Blueprint $table) { + $table->id(); + $table->string('uuid')->unique(); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('jobs'); + Schema::dropIfExists('job_batches'); + Schema::dropIfExists('failed_jobs'); + } +}; diff --git a/database/migrations-laravel/2014_10_12_000000_create_users_table.php b/database/migrations-laravel/2014_10_12_000000_create_users_table.php deleted file mode 100644 index 1f97419..0000000 --- a/database/migrations-laravel/2014_10_12_000000_create_users_table.php +++ /dev/null @@ -1,32 +0,0 @@ -id(); - $table->string('name'); - $table->string('email')->unique(); - $table->timestamp('email_verified_at')->nullable(); - $table->string('password'); - $table->rememberToken(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('users'); - } -}; diff --git a/database/migrations-laravel/2014_10_12_100000_create_password_reset_tokens_table.php b/database/migrations-laravel/2014_10_12_100000_create_password_reset_tokens_table.php deleted file mode 100644 index 8b5b388..0000000 --- a/database/migrations-laravel/2014_10_12_100000_create_password_reset_tokens_table.php +++ /dev/null @@ -1,28 +0,0 @@ -string('email')->primary(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('password_reset_tokens'); - } -}; diff --git a/database/migrations-laravel/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations-laravel/2019_08_19_000000_create_failed_jobs_table.php deleted file mode 100644 index 3eec77b..0000000 --- a/database/migrations-laravel/2019_08_19_000000_create_failed_jobs_table.php +++ /dev/null @@ -1,32 +0,0 @@ -id(); - $table->string('uuid')->unique(); - $table->text('connection'); - $table->text('queue'); - $table->longText('payload'); - $table->longText('exception'); - $table->timestamp('failed_at')->useCurrent(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('failed_jobs'); - } -}; diff --git a/database/migrations-laravel/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations-laravel/2024_03_13_210031_create_personal_access_tokens_table.php similarity index 93% rename from database/migrations-laravel/2019_12_14_000001_create_personal_access_tokens_table.php rename to database/migrations-laravel/2024_03_13_210031_create_personal_access_tokens_table.php index 0fc7a63..8dd13c9 100644 --- a/database/migrations-laravel/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/database/migrations-laravel/2024_03_13_210031_create_personal_access_tokens_table.php @@ -1,10 +1,12 @@ bigInteger('rank')->default(0); $table->bigInteger('size')->default(0); + // Matrix + + $table->string('matrix')->default(''); + $table->bigInteger('x')->nullable(); + $table->bigInteger('y')->nullable(); + $table->bigInteger('z')->nullable(); + $table->decimal('r', 65, 10)->nullable()->default(null); + $table->decimal('theta', 10, 6)->nullable()->default(null); + $table->decimal('rho', 10, 6)->nullable()->default(null); + $table->decimal('phi', 10, 6)->nullable()->default(null); + $table->decimal('elevation', 65, 10)->nullable()->default(null); + $table->decimal('latitude', 8, 6)->nullable()->default(null); + $table->decimal('longitude', 9, 6)->nullable()->default(null); + // Flags $table->boolean('active')->default(1)->index(); @@ -130,6 +146,21 @@ public function up(): void ->comment('Encrypted array of sources'); }); + + Schema::create('password_reset_tokens', function (Blueprint $table) { + $table->string('email')->primary(); + $table->string('token'); + $table->timestamp('created_at')->nullable(); + }); + + Schema::create('sessions', function (Blueprint $table) { + $table->string('id')->primary(); + $table->foreignId('user_id')->nullable()->index(); + $table->string('ip_address', 45)->nullable(); + $table->text('user_agent')->nullable(); + $table->longText('payload'); + $table->integer('last_activity')->index(); + }); } /** @@ -138,5 +169,7 @@ public function up(): void public function down(): void { Schema::dropIfExists('users'); + Schema::dropIfExists('password_reset_tokens'); + Schema::dropIfExists('sessions'); } }; diff --git a/database/migrations-playground/0001_01_01_000001_create_cache_table.php b/database/migrations-playground/0001_01_01_000001_create_cache_table.php new file mode 100644 index 0000000..960e12b --- /dev/null +++ b/database/migrations-playground/0001_01_01_000001_create_cache_table.php @@ -0,0 +1,37 @@ +string('key')->primary(); + $table->mediumText('value'); + $table->integer('expiration'); + }); + + Schema::create('cache_locks', function (Blueprint $table) { + $table->string('key')->primary(); + $table->string('owner'); + $table->integer('expiration'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('cache'); + Schema::dropIfExists('cache_locks'); + } +}; diff --git a/database/migrations-playground/0001_01_01_000002_create_jobs_table.php b/database/migrations-playground/0001_01_01_000002_create_jobs_table.php new file mode 100644 index 0000000..0dcb8c4 --- /dev/null +++ b/database/migrations-playground/0001_01_01_000002_create_jobs_table.php @@ -0,0 +1,59 @@ +id(); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedTinyInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); + + Schema::create('job_batches', function (Blueprint $table) { + $table->string('id')->primary(); + $table->string('name'); + $table->integer('total_jobs'); + $table->integer('pending_jobs'); + $table->integer('failed_jobs'); + $table->longText('failed_job_ids'); + $table->mediumText('options')->nullable(); + $table->integer('cancelled_at')->nullable(); + $table->integer('created_at'); + $table->integer('finished_at')->nullable(); + }); + + Schema::create('failed_jobs', function (Blueprint $table) { + $table->id(); + $table->string('uuid')->unique(); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('jobs'); + Schema::dropIfExists('job_batches'); + Schema::dropIfExists('failed_jobs'); + } +}; diff --git a/database/migrations-playground/2014_10_12_100000_create_password_reset_tokens_table.php b/database/migrations-playground/2014_10_12_100000_create_password_reset_tokens_table.php deleted file mode 100644 index 8b5b388..0000000 --- a/database/migrations-playground/2014_10_12_100000_create_password_reset_tokens_table.php +++ /dev/null @@ -1,28 +0,0 @@ -string('email')->primary(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('password_reset_tokens'); - } -}; diff --git a/database/migrations-playground/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations-playground/2024_03_13_210031_create_personal_access_tokens_table.php similarity index 93% rename from database/migrations-playground/2019_12_14_000001_create_personal_access_tokens_table.php rename to database/migrations-playground/2024_03_13_210031_create_personal_access_tokens_table.php index a297dc2..ccdd208 100644 --- a/database/migrations-playground/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/database/migrations-playground/2024_03_13_210031_create_personal_access_tokens_table.php @@ -1,10 +1,12 @@ set('playground-auth.debug', true); $app['config']->set('playground-auth.verify', 'roles'); + $app['config']->set('auth.testing.password', 'password'); + $app['config']->set('auth.testing.hashed', false); // $app['config']->set('playground-auth.verify', 'privileges'); $app['config']->set('playground-auth.sanctum', false); $app['config']->set('playground-auth.hasPrivilege', true); diff --git a/tests/Feature/Http/Controllers/Playground/TicketRouteTest.php b/tests/Feature/Http/Controllers/Playground/TicketRouteTest.php index 155ae09..2af31b3 100644 --- a/tests/Feature/Http/Controllers/Playground/TicketRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/TicketRouteTest.php @@ -1,4 +1,6 @@ set('auth.providers.users.model', 'Playground\\Test\\Models\\User'); + $app['config']->set('playground-auth.verify', 'user'); + $app['config']->set('auth.testing.password', 'password'); + $app['config']->set('auth.testing.hashed', false); + + $app['config']->set('playground-cms.load.migrations', true); + } } diff --git a/tests/Unit/Http/Requests/Backlog/CreateRequestTest.php b/tests/Unit/Http/Requests/Backlog/CreateRequestTest.php index 7e007ee..52b40c1 100644 --- a/tests/Unit/Http/Requests/Backlog/CreateRequestTest.php +++ b/tests/Unit/Http/Requests/Backlog/CreateRequestTest.php @@ -1,16 +1,15 @@ set('auth.providers.users.model', '\\Playground\\Test\\Models\\PlaygroundUserWithSanctum'); - - // $app['config']->set('playground-matrix.load.migrations', true); - - // $app['config']->set('app.debug', true); - // $app['config']->set('playground-auth.debug', true); - - // // $app['config']->set('playground-auth.verify', 'roles'); - // // // $app['config']->set('playground-auth.verify', 'privileges'); - // // $app['config']->set('playground-auth.sanctum', false); - // // $app['config']->set('playground-auth.hasPrivilege', true); - // // $app['config']->set('playground-auth.userPrivileges', true); - // // $app['config']->set('playground-auth.hasRole', true); - // // $app['config']->set('playground-auth.userRole', true); - // // $app['config']->set('playground-auth.userRoles', true); - - // // $app['config']->set('playground-auth.token.roles', true); - // // $app['config']->set('playground-auth.token.sanctum', true); - - // // $middleware = []; - // // api,auth:sanctum,web - - // $app['config']->set('playground-matrix-resource.routes.matrix', true); - // $app['config']->set('playground-matrix-resource.routes.backlogs', true); - // $app['config']->set('playground-matrix-resource.routes.boards', true); - // $app['config']->set('playground-matrix-resource.routes.epics', true); - // $app['config']->set('playground-matrix-resource.routes.flows', true); - // $app['config']->set('playground-matrix-resource.routes.milestones', true); - // $app['config']->set('playground-matrix-resource.routes.notes', true); - // $app['config']->set('playground-matrix-resource.routes.projects', true); - // $app['config']->set('playground-matrix-resource.routes.releases', true); - // $app['config']->set('playground-matrix-resource.routes.roadmaps', true); - // $app['config']->set('playground-matrix-resource.routes.sources', true); - // $app['config']->set('playground-matrix-resource.routes.sprints', true); - // $app['config']->set('playground-matrix-resource.routes.tags', true); - // $app['config']->set('playground-matrix-resource.routes.teams', true); - // $app['config']->set('playground-matrix-resource.routes.tickets', true); - // $app['config']->set('playground-matrix-resource.routes.versions', true); - - // $app['config']->set('playground-matrix-resource.sitemap.enable', true); - // $app['config']->set('playground-matrix-resource.sitemap.guest', true); - // $app['config']->set('playground-matrix-resource.sitemap.user', true); + /** + * Set up the environment. + * + * @param \Illuminate\Foundation\Application $app + */ + protected function getEnvironmentSetUp($app) + { + $app['config']->set('auth.providers.users.model', 'Playground\\Test\\Models\\User'); + $app['config']->set('playground-auth.verify', 'user'); + $app['config']->set('auth.testing.password', 'password'); + $app['config']->set('auth.testing.hashed', false); - // } + $app['config']->set('playground-cms.load.migrations', true); + } }