Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-9 #10

Merged
merged 1 commit into from
Feb 20, 2024
Merged

GH-9 #10

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"gammamatrix/playground-test": "dev-develop|dev-master|dev-feature/*|^73.0"
},
"suggest": {
"gammamatrix/playground-matrix-api": "Provides an API, without a UI, to interact with the models provided in this package.",
"gammamatrix/playground-matrix-resource": "Provides a resource API and optional Blade UI to interact with the models provided in this package."
},
"minimum-stability": "dev",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {

// IDs
$table->uuid('id')->primary();

$table->uuid('created_id')->nullable()->index();
$table->uuid('modified_id')->nullable()->index();

// Date columns

$table->timestamps();
$table->timestamp('email_verified_at')->nullable();

// Status

$table->softDeletes();

$table->tinyInteger('active')->unsigned()->index()->default(0);
$table->tinyInteger('banned')->unsigned()->index()->default(0);
$table->tinyInteger('closed')->unsigned()->index()->default(0);
$table->tinyInteger('flagged')->unsigned()->index()->default(0);
$table->tinyInteger('internal')->unsigned()->index()->default(0);
$table->tinyInteger('locked')->unsigned()->index()->default(0);

// UI

$table->string('style', 128)->default('');
$table->string('klass', 128)->default('');
$table->string('icon', 128)->default('');

// Entity columns

$table->string('name')->default('');
$table->string('email')->unique();
$table->string('password')->default('');
$table->string('phone')->default('');
$table->string('locale')->default('');
$table->string('timezone')->default('');

$table->rememberToken();

$table->string('role')->default('');

// A link to the external source of the user.
$table->string('url', 512)->default('');

// Description is an internal field.
$table->string('description', 512)->default('');

$table->string('image', 512)->default('');
$table->string('avatar', 512)->default('');

// The introduction should be the first 255 characters or less of the content.
// The introduction is visible to the client. No HTML.
$table->string('introduction', 512)->default('');

// The HTML content of the user.
$table->mediumText('content')->nullable();

// The summary of the content, HTML allowed, to be shown to the client.
$table->mediumText('summary')->nullable();

$table->json('abilities')
->default(new Expression('(JSON_ARRAY())'))
->comment('Array of ability strings');
$table->json('accounts')
->default(new Expression('(JSON_OBJECT())'))
->comment('User accounts object');
$table->json('address')
->default(new Expression('(JSON_OBJECT())'))
->comment('User address object');
$table->json('contact')
->default(new Expression('(JSON_OBJECT())'))
->comment('User contact object');
$table->json('meta')
->default(new Expression('(JSON_OBJECT())'))
->comment('Model meta object');
$table->json('notes')
->default(new Expression('(JSON_ARRAY())'))
->comment('Array of note objects');
$table->json('options')
->default(new Expression('(JSON_OBJECT())'))
->comment('Model options object');
$table->json('registration')
->default(new Expression('(JSON_OBJECT())'))
->comment('Registration information object');
$table->json('roles')
->default(new Expression('(JSON_ARRAY())'))
->comment('Array of role strings');
$table->json('permissions')
->default(new Expression('(JSON_ARRAY())'))
->comment('Array of permission strings');
$table->json('privileges')
->default(new Expression('(JSON_ARRAY())'))
->comment('Array of privilege strings');

});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('password_reset_tokens');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->uuidMorphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ public function up(): void
$table->dateTime('canceled_at')->nullable();
$table->dateTime('closed_at')->nullable()->index();
$table->dateTime('embargo_at')->nullable();
$table->dateTime('fixed_at')->nullable();
$table->dateTime('postponed_at')->nullable();
$table->dateTime('published_at')->nullable();
$table->dateTime('released_at')->nullable();
$table->dateTime('resolved_at')->nullable();
$table->dateTime('resumed_at')->nullable();
$table->dateTime('suspended_at')->nullable();

Expand Down
6 changes: 5 additions & 1 deletion src/Models/Flow.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class Flow extends Model
'postponed_at' => null,
'published_at' => null,
'released_at' => null,
'resumed_at' => null,
'resolved_at' => null,
'resumed_at' => null,
'suspended_at' => null,
'gids' => 0,
'po' => 0,
Expand Down Expand Up @@ -118,9 +118,11 @@ class Flow extends Model
'canceled_at' => 'datetime',
'closed_at' => 'datetime',
'embargo_at' => 'datetime',
'fixed_at' => 'datetime',
'postponed_at' => 'datetime',
'published_at' => 'datetime',
'released_at' => 'datetime',
'resolved_at' => 'datetime',
'resumed_at' => 'datetime',
'suspended_at' => 'datetime',
'label' => 'string',
Expand Down Expand Up @@ -219,9 +221,11 @@ class Flow extends Model
'canceled_at',
'closed_at',
'embargo_at',
'fixed_at',
'postponed_at',
'published_at',
'released_at',
'resolved_at',
'resumed_at',
'suspended_at',
'assets',
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public function completedBy(): HasOne
/**
* @var class-string<\Illuminate\Contracts\Auth\Authenticatable>
*/
$uc = config('playground.user', '\\App\\Models\\User');
$uc = config('auth.providers.users.model', '\\App\\Models\\User');

return $this->hasOne(
$uc,
Expand Down Expand Up @@ -436,7 +436,7 @@ public function reportedBy(): HasOne
/**
* @var class-string<\Illuminate\Contracts\Auth\Authenticatable>
*/
$uc = config('playground.user', '\\App\\Models\\User');
$uc = config('auth.providers.users.model', '\\App\\Models\\User');

return $this->hasOne(
$uc,
Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/Models/Backlog/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ class ModelTest extends ModelCase
'creator' => [
'key' => 'created_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'modifier' => [
'key' => 'modified_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'owner' => [
'key' => 'owned_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'parent' => [
'key' => 'parent_id',
Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/Models/Board/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ class ModelTest extends ModelCase
'creator' => [
'key' => 'created_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'modifier' => [
'key' => 'modified_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'owner' => [
'key' => 'owned_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'parent' => [
'key' => 'parent_id',
Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/Models/Epic/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ class ModelTest extends ModelCase
'creator' => [
'key' => 'created_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'modifier' => [
'key' => 'modified_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'owner' => [
'key' => 'owned_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'parent' => [
'key' => 'parent_id',
Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/Models/Flow/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ class ModelTest extends ModelCase
'creator' => [
'key' => 'created_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'modifier' => [
'key' => 'modified_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'owner' => [
'key' => 'owned_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'parent' => [
'key' => 'parent_id',
Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/Models/Milestone/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ class ModelTest extends ModelCase
'creator' => [
'key' => 'created_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'modifier' => [
'key' => 'modified_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'owner' => [
'key' => 'owned_by_id',
'rule' => 'create',
'modelClass' => \Playground\Test\Models\User::class,
'modelClass' => \Playground\Models\User::class,
],
'parent' => [
'key' => 'parent_id',
Expand Down
Loading
Loading