From 16ebd59e564ef8673b48f3766d44a2658e1c87cb Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Sun, 21 Apr 2024 13:48:42 -0700 Subject: [PATCH 01/18] GH-19 --- ...02_100001_create_matrix_backlogs_table.php | 2 + src/Models/Backlog.php | 109 ++++++++++++++++++ 2 files changed, 111 insertions(+) diff --git a/database/migrations/2020_01_02_100001_create_matrix_backlogs_table.php b/database/migrations/2020_01_02_100001_create_matrix_backlogs_table.php index f9e98bc..c86a95c 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_backlogs_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_backlogs_table.php @@ -110,11 +110,13 @@ public function up(): void $table->boolean('locked')->default(0); $table->boolean('pending')->default(0); $table->boolean('planned')->default(0); + $table->boolean('prioritized')->default(0); $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); $table->boolean('retired')->default(0); $table->boolean('resolved')->default(0); + $table->boolean('special')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); diff --git a/src/Models/Backlog.php b/src/Models/Backlog.php index b7a6924..925128e 100644 --- a/src/Models/Backlog.php +++ b/src/Models/Backlog.php @@ -11,6 +11,109 @@ /** * \Playground\Matrix\Models\Backlog + * + * @property string $id + * @property ?scalar $created_by_id + * @property ?scalar $modified_by_id + * @property ?scalar $owned_by_id + * @property ?string $parent_id + * @property ?string $backlog_type + * @property ?string $board_id + * @property ?string $epic_id + * @property ?string $flow_id + * @property ?string $matrix_id + * @property ?string $milestone_id + * @property ?string $note_id + * @property ?string $project_id + * @property ?string $release_id + * @property ?string $roadmap_id + * @property ?string $source_id + * @property ?string $sprint_id + * @property ?string $tag_id + * @property ?string $team_id + * @property ?string $ticket_id + * @property ?string $version_id + * @property ?Carbon $created_at + * @property ?Carbon $updated_at + * @property ?Carbon $deleted_at + * @property ?Carbon $start_at + * @property ?Carbon $planned_start_at + * @property ?Carbon $end_at + * @property ?Carbon $planned_end_at + * @property ?Carbon $canceled_at + * @property ?Carbon $closed_at + * @property ?Carbon $embargo_at + * @property ?Carbon $fixed_at + * @property ?Carbon $postponed_at + * @property ?Carbon $published_at + * @property ?Carbon $released_at + * @property ?Carbon $resumed_at + * @property ?Carbon $resolved_at + * @property ?Carbon $suspended_at + * @property int $gids + * @property int $po + * @property int $pg + * @property int $pw + * @property bool $only_admin + * @property bool $only_user + * @property bool $only_guest + * @property bool $allow_public + * @property int $status + * @property int $rank + * @property int $size + * @property ?array $matrix + * @property ?int $x + * @property ?int $y + * @property ?int $z + * @property ?double $r + * @property ?double $theta + * @property ?double $rho + * @property ?double $phi + * @property ?double $elevation + * @property ?double $latitude + * @property ?double $longitude + * @property bool $active + * @property bool $canceled + * @property bool $closed + * @property bool $completed + * @property bool $duplicate + * @property bool $fixed + * @property bool $flagged + * @property bool $internal + * @property bool $locked + * @property bool $pending + * @property bool $planned + * @property bool $prioritized + * @property bool $problem + * @property bool $published + * @property bool $released + * @property bool $retired + * @property bool $resolved + * @property bool $special + * @property bool $suspended + * @property string $label + * @property string $title + * @property string $byline + * @property string $timezone + * @property ?string $slug + * @property string $url + * @property string $description + * @property string $introduction + * @property ?string $content + * @property ?string $summary + * @property string $icon + * @property string $image + * @property string $avatar + * @property ?array $ui + * @property ?array $assets + * @property ?array $backlog + * @property ?array $board + * @property ?array $flow + * @property ?array $meta + * @property ?array $notes + * @property ?array $options + * @property ?array $roadmap + * @property ?array $sources */ class Backlog extends Model { @@ -91,11 +194,13 @@ class Backlog extends Model 'locked' => false, 'pending' => false, 'planned' => false, + 'prioritized' => false, 'problem' => false, 'published' => false, 'released' => false, 'retired' => false, 'resolved' => false, + 'special' => false, 'suspended' => false, 'unknown' => false, 'label' => '', @@ -192,11 +297,13 @@ class Backlog extends Model 'locked', 'pending', 'planned', + 'prioritized', 'problem', 'published', 'released', 'retired', 'resolved', + 'special', 'suspended', 'unknown', 'label', @@ -282,11 +389,13 @@ protected function casts(): array 'locked' => 'boolean', 'pending' => 'boolean', 'planned' => 'boolean', + 'prioritized' => 'boolean', 'problem' => 'boolean', 'published' => 'boolean', 'released' => 'boolean', 'retired' => 'boolean', 'resolved' => 'boolean', + 'special' => 'boolean', 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', From e2b7b61cc8bf3e40cdafb87ad822723b3320291b Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Fri, 26 Apr 2024 11:10:24 -0700 Subject: [PATCH 02/18] GH-19 --- database/factories/BacklogFactory.php | 4 +- database/factories/TicketFactory.php | 4 +- ...02_100001_create_matrix_backlogs_table.php | 13 +- ..._02_100001_create_matrix_tickets_table.php | 17 ++- src/Models/Backlog.php | 131 ++++++++---------- src/Models/Ticket.php | 78 ++++++----- 6 files changed, 127 insertions(+), 120 deletions(-) diff --git a/database/factories/BacklogFactory.php b/database/factories/BacklogFactory.php index 28ec98c..bd3a450 100644 --- a/database/factories/BacklogFactory.php +++ b/database/factories/BacklogFactory.php @@ -1,9 +1,9 @@ uuid('id')->primary(); @@ -103,6 +107,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -120,7 +125,7 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns $table->string('label')->default(''); $table->string('title')->default(''); @@ -132,7 +137,7 @@ public function up(): void $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui $table->string('icon')->default(''); $table->string('image')->default(''); diff --git a/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php b/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php index 6064f6d..640cdec 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -28,6 +32,7 @@ public function up(): void $table->uuid('modified_by_id')->nullable()->index(); $table->uuid('owned_by_id')->nullable()->index(); $table->uuid('parent_id')->nullable()->index(); + $table->string('ticket_type')->nullable()->index(); $table->uuid('duplicate_id')->nullable()->index(); $table->uuid('backlog_id')->nullable()->index(); $table->uuid('board_id')->nullable()->index(); @@ -48,7 +53,6 @@ public function up(): void $table->uuid('team_id')->nullable()->index(); $table->uuid('version_id')->nullable()->index(); $table->uuid('version_fixed_id')->nullable()->index(); - $table->string('ticket_type')->nullable()->index(); // Dates @@ -115,15 +119,18 @@ public function up(): void $table->boolean('locked')->default(0); $table->boolean('pending')->default(0); $table->boolean('planned')->default(0); + $table->boolean('prioritized')->default(0); $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); $table->boolean('retired')->default(0); $table->boolean('resolved')->default(0); + $table->boolean('special')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); + $table->boolean('cron')->default(0)->index(); - // Strings + // Columns $table->string('label')->default(''); $table->string('title')->default(''); @@ -152,7 +159,7 @@ public function up(): void $table->mediumText('criteria')->nullable(); $table->decimal('reproducibility', 8, 2)->nullable()->default(null); - // UI + // Ui $table->string('icon')->default(''); $table->string('image')->default(''); diff --git a/src/Models/Backlog.php b/src/Models/Backlog.php index 925128e..dbd5eab 100644 --- a/src/Models/Backlog.php +++ b/src/Models/Backlog.php @@ -1,11 +1,12 @@ null, 'ticket_id' => null, 'version_id' => null, - 'created_at' => null, - 'updated_at' => null, - 'deleted_at' => null, - 'start_at' => null, - 'planned_start_at' => null, - 'end_at' => null, - 'planned_end_at' => null, - 'canceled_at' => null, - 'closed_at' => null, - 'embargo_at' => null, - 'fixed_at' => null, - 'postponed_at' => null, - 'published_at' => null, - 'released_at' => null, - 'resolved_at' => null, - 'resumed_at' => null, - 'suspended_at' => null, - 'gids' => 0, - 'po' => 0, - 'pg' => 0, - 'pw' => 0, - 'only_admin' => false, - 'only_user' => false, - 'only_guest' => false, - 'allow_public' => false, - 'status' => 0, - 'rank' => 0, - 'size' => 0, - 'matrix' => '', - 'x' => null, - 'y' => null, - 'z' => null, - 'r' => null, - 'theta' => null, - 'rho' => null, - 'phi' => null, - 'elevation' => null, - 'latitude' => null, - 'longitude' => null, 'active' => true, 'canceled' => false, 'closed' => false, @@ -194,13 +157,11 @@ class Backlog extends Model 'locked' => false, 'pending' => false, 'planned' => false, - 'prioritized' => false, 'problem' => false, 'published' => false, 'released' => false, 'retired' => false, 'resolved' => false, - 'special' => false, 'suspended' => false, 'unknown' => false, 'label' => '', @@ -225,6 +186,35 @@ class Backlog extends Model 'options' => '{}', 'roadmap' => '{}', 'sources' => '{}', + 'created_at' => null, + 'updated_at' => null, + 'deleted_at' => null, + 'start_at' => null, + 'planned_start_at' => null, + 'end_at' => null, + 'planned_end_at' => null, + 'canceled_at' => null, + 'closed_at' => null, + 'embargo_at' => null, + 'fixed_at' => null, + 'postponed_at' => null, + 'published_at' => null, + 'released_at' => null, + 'resumed_at' => null, + 'resolved_at' => null, + 'suspended_at' => null, + 'gids' => 0, + 'po' => 0, + 'pg' => 0, + 'pw' => 0, + 'only_admin' => false, + 'only_user' => false, + 'only_guest' => false, + 'allow_public' => false, + 'status' => 0, + 'rank' => 0, + 'size' => 0, + 'cron' => false, ]; /** @@ -275,21 +265,11 @@ class Backlog extends Model 'status', 'rank', 'size', - 'matrix', - 'x', - 'y', - 'z', - 'r', - 'theta', - 'rho', - 'phi', - 'elevation', - 'latitude', - 'longitude', 'active', 'canceled', 'closed', 'completed', + 'cron', 'duplicate', 'fixed', 'flagged', @@ -297,13 +277,11 @@ class Backlog extends Model 'locked', 'pending', 'planned', - 'prioritized', 'problem', 'published', 'released', 'retired', 'resolved', - 'special', 'suspended', 'unknown', 'label', @@ -324,7 +302,6 @@ class Backlog extends Model 'board', 'flow', 'meta', - 'notes', 'options', 'roadmap', 'sources', @@ -367,21 +344,11 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', - 'x' => 'integer', - 'y' => 'integer', - 'z' => 'integer', - 'r' => 'float', - 'theta' => 'float', - 'rho' => 'float', - 'phi' => 'float', - 'elevation' => 'float', - 'latitude' => 'float', - 'longitude' => 'float', 'active' => 'boolean', 'canceled' => 'boolean', 'closed' => 'boolean', 'completed' => 'boolean', + 'cron' => 'boolean', 'duplicate' => 'boolean', 'fixed' => 'boolean', 'flagged' => 'boolean', @@ -389,13 +356,11 @@ protected function casts(): array 'locked' => 'boolean', 'pending' => 'boolean', 'planned' => 'boolean', - 'prioritized' => 'boolean', 'problem' => 'boolean', 'published' => 'boolean', 'released' => 'boolean', 'retired' => 'boolean', 'resolved' => 'boolean', - 'special' => 'boolean', 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', @@ -590,4 +555,28 @@ public function version(): HasOne 'version_id' ); } + + /** + * The sprints of the backlog. + */ + public function sprints(): HasMany + { + return $this->hasMany( + Sprint::class, + 'sprint_id', + 'id' + ); + } + + /** + * The tickets of the backlog. + */ + public function tickets(): HasMany + { + return $this->hasMany( + Ticket::class, + 'ticket_id', + 'id' + ); + } } diff --git a/src/Models/Ticket.php b/src/Models/Ticket.php index 5efcba1..e16fc51 100644 --- a/src/Models/Ticket.php +++ b/src/Models/Ticket.php @@ -1,11 +1,12 @@ null, 'owned_by_id' => null, 'parent_id' => null, + 'ticket_type' => null, + 'board_id' => null, 'duplicate_id' => null, 'backlog_id' => null, - 'board_id' => null, 'completed_by_id' => null, 'epic_id' => null, 'fixed_by_id' => null, @@ -169,9 +173,8 @@ class Ticket extends Model 'sprint_id' => null, 'tag_id' => null, 'team_id' => null, - 'version_id' => null, 'version_fixed_id' => null, - 'ticket_type' => null, + 'version_id' => null, 'created_at' => null, 'updated_at' => null, 'deleted_at' => null, @@ -186,8 +189,8 @@ class Ticket extends Model 'postponed_at' => null, 'published_at' => null, 'released_at' => null, - 'resolved_at' => null, 'resumed_at' => null, + 'resolved_at' => null, 'suspended_at' => null, 'gids' => 0, 'po' => 0, @@ -215,6 +218,7 @@ class Ticket extends Model 'canceled' => false, 'closed' => false, 'completed' => false, + 'cron' => false, 'duplicate' => false, 'fixed' => false, 'flagged' => false, @@ -280,10 +284,10 @@ class Ticket extends Model 'owned_by_id', 'parent_id', 'ticket_type', - 'backlog_id', 'board_id', - 'completed_by_id', 'duplicate_id', + 'backlog_id', + 'completed_by_id', 'epic_id', 'fixed_by_id', 'flow_id', @@ -298,8 +302,8 @@ class Ticket extends Model 'sprint_id', 'tag_id', 'team_id', - 'version_id', 'version_fixed_id', + 'version_id', 'start_at', 'planned_start_at', 'end_at', @@ -340,6 +344,7 @@ class Ticket extends Model 'canceled', 'closed', 'completed', + 'cron', 'duplicate', 'fixed', 'flagged', @@ -449,6 +454,7 @@ protected function casts(): array 'canceled' => 'boolean', 'closed' => 'boolean', 'completed' => 'boolean', + 'cron' => 'boolean', 'duplicate' => 'boolean', 'fixed' => 'boolean', 'flagged' => 'boolean', From a8cffa3f13b2c2c5030502f69b1d2744c9487154 Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Fri, 26 Apr 2024 12:03:57 -0700 Subject: [PATCH 03/18] GH-19 --- src/Models/Backlog.php | 60 ++++++++++++++++++++++-------------------- src/Models/Ticket.php | 16 +++++------ 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/Models/Backlog.php b/src/Models/Backlog.php index dbd5eab..07d3353 100644 --- a/src/Models/Backlog.php +++ b/src/Models/Backlog.php @@ -135,6 +135,7 @@ class Backlog extends Model 'board_id' => null, 'epic_id' => null, 'flow_id' => null, + 'matrix_id' => null, 'milestone_id' => null, 'note_id' => null, 'project_id' => null, @@ -146,10 +147,39 @@ class Backlog extends Model 'team_id' => null, 'ticket_id' => null, 'version_id' => null, + 'created_at' => null, + 'updated_at' => null, + 'deleted_at' => null, + 'start_at' => null, + 'planned_start_at' => null, + 'end_at' => null, + 'planned_end_at' => null, + 'canceled_at' => null, + 'closed_at' => null, + 'embargo_at' => null, + 'fixed_at' => null, + 'postponed_at' => null, + 'published_at' => null, + 'released_at' => null, + 'resumed_at' => null, + 'resolved_at' => null, + 'suspended_at' => null, + 'gids' => 0, + 'po' => 0, + 'pg' => 0, + 'pw' => 0, + 'only_admin' => false, + 'only_user' => false, + 'only_guest' => false, + 'allow_public' => false, + 'status' => 0, + 'rank' => 0, + 'size' => 0, 'active' => true, 'canceled' => false, 'closed' => false, 'completed' => false, + 'cron' => false, 'duplicate' => false, 'fixed' => false, 'flagged' => false, @@ -186,35 +216,6 @@ class Backlog extends Model 'options' => '{}', 'roadmap' => '{}', 'sources' => '{}', - 'created_at' => null, - 'updated_at' => null, - 'deleted_at' => null, - 'start_at' => null, - 'planned_start_at' => null, - 'end_at' => null, - 'planned_end_at' => null, - 'canceled_at' => null, - 'closed_at' => null, - 'embargo_at' => null, - 'fixed_at' => null, - 'postponed_at' => null, - 'published_at' => null, - 'released_at' => null, - 'resumed_at' => null, - 'resolved_at' => null, - 'suspended_at' => null, - 'gids' => 0, - 'po' => 0, - 'pg' => 0, - 'pw' => 0, - 'only_admin' => false, - 'only_user' => false, - 'only_guest' => false, - 'allow_public' => false, - 'status' => 0, - 'rank' => 0, - 'size' => 0, - 'cron' => false, ]; /** @@ -229,6 +230,7 @@ class Backlog extends Model 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', diff --git a/src/Models/Ticket.php b/src/Models/Ticket.php index e16fc51..159c0fc 100644 --- a/src/Models/Ticket.php +++ b/src/Models/Ticket.php @@ -6,7 +6,6 @@ declare(strict_types=1); namespace Playground\Matrix\Models; -use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasOne; use Playground\Models\Model; @@ -155,10 +154,10 @@ class Ticket extends Model 'owned_by_id' => null, 'parent_id' => null, 'ticket_type' => null, - 'board_id' => null, - 'duplicate_id' => null, 'backlog_id' => null, + 'board_id' => null, 'completed_by_id' => null, + 'duplicate_id' => null, 'epic_id' => null, 'fixed_by_id' => null, 'flow_id' => null, @@ -255,8 +254,8 @@ class Ticket extends Model 'points' => 0, 'actual' => null, 'expected' => null, - 'steps' => null, 'story' => null, + 'steps' => null, 'criteria' => null, 'reproducibility' => null, 'icon' => '', @@ -284,10 +283,10 @@ class Ticket extends Model 'owned_by_id', 'parent_id', 'ticket_type', - 'board_id', - 'duplicate_id', 'backlog_id', + 'board_id', 'completed_by_id', + 'duplicate_id', 'epic_id', 'fixed_by_id', 'flow_id', @@ -383,7 +382,6 @@ class Ticket extends Model 'expected', 'story', 'steps', - 'story', 'criteria', 'reproducibility', 'icon', @@ -396,7 +394,6 @@ class Ticket extends Model 'flow', 'history', 'meta', - 'notes', 'options', 'roadmap', 'sources', @@ -489,7 +486,10 @@ protected function casts(): array 'state' => 'string', 'workflow_type' => 'string', 'points' => 'integer', + 'actual' => 'string', + 'expected' => 'string', 'story' => 'string', + 'steps' => 'string', 'criteria' => 'string', 'reproducibility' => 'decimal', 'icon' => 'string', From 764fadcd37a8038857d39023ff21a11f5ba82dea Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Fri, 26 Apr 2024 21:55:27 -0700 Subject: [PATCH 04/18] GH-19 --- database/factories/BoardFactory.php | 4 +- database/factories/SprintFactory.php | 4 +- ...02_100001_create_matrix_backlogs_table.php | 18 +-- ...1_02_100001_create_matrix_boards_table.php | 31 +++-- ..._02_100001_create_matrix_sprints_table.php | 29 ++-- ..._02_100001_create_matrix_tickets_table.php | 4 +- src/Models/Backlog.php | 49 ++++++- src/Models/Board.php | 130 +++++++++++++++++- src/Models/Sprint.php | 130 +++++++++++++++++- src/Models/Ticket.php | 14 +- tests/Feature/Models/Backlog/ModelTest.php | 13 ++ tests/Feature/Models/Board/ModelTest.php | 5 + tests/Feature/Models/Sprint/ModelTest.php | 5 + tests/Feature/Models/Ticket/ModelTest.php | 10 ++ 14 files changed, 391 insertions(+), 55 deletions(-) diff --git a/database/factories/BoardFactory.php b/database/factories/BoardFactory.php index daa4e27..35f7130 100644 --- a/database/factories/BoardFactory.php +++ b/database/factories/BoardFactory.php @@ -1,9 +1,9 @@ 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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -130,7 +130,7 @@ public function up(): void $table->string('label')->default(''); $table->string('title')->default(''); $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); + $table->string('slug')->nullable()->index(); $table->string('url')->default(''); $table->string('description')->default(''); $table->string('introduction')->default(''); diff --git a/database/migrations/2020_01_02_100001_create_matrix_boards_table.php b/database/migrations/2020_01_02_100001_create_matrix_boards_table.php index a3c3c17..df72ee8 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_boards_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_boards_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -28,8 +32,8 @@ public function up(): void $table->uuid('modified_by_id')->nullable()->index(); $table->uuid('owned_by_id')->nullable()->index(); $table->uuid('parent_id')->nullable()->index(); - $table->string('board_type')->nullable()->index(); $table->uuid('backlog_id')->nullable()->index(); + $table->string('board_type')->nullable()->index(); $table->uuid('epic_id')->nullable()->index(); $table->uuid('flow_id')->nullable()->index(); $table->uuid('matrix_id')->nullable()->index(); @@ -89,13 +93,13 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -103,6 +107,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -118,19 +123,19 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns $table->string('label')->default(''); $table->string('title')->default(''); $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); + $table->string('slug')->nullable()->index(); $table->string('url')->default(''); $table->string('description')->default(''); $table->string('introduction')->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui $table->string('icon')->default(''); $table->string('image')->default(''); diff --git a/database/migrations/2020_01_02_100001_create_matrix_sprints_table.php b/database/migrations/2020_01_02_100001_create_matrix_sprints_table.php index b48645c..00129ae 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_sprints_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_sprints_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -89,13 +93,13 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -103,6 +107,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -118,19 +123,19 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns $table->string('label')->default(''); $table->string('title')->default(''); $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); + $table->string('slug')->nullable()->index(); $table->string('url')->default(''); $table->string('description')->default(''); $table->string('introduction')->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui $table->string('icon')->default(''); $table->string('image')->default(''); diff --git a/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php b/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php index 640cdec..f8e761f 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php @@ -11,7 +11,7 @@ use Illuminate\Support\Facades\Schema; /** - * Playground\Matrix\Models\Ticket + * \Playground\Matrix\Models\Ticket */ return new class() extends Migration { @@ -112,6 +112,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -128,7 +129,6 @@ public function up(): void $table->boolean('special')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - $table->boolean('cron')->default(0)->index(); // Columns diff --git a/src/Models/Backlog.php b/src/Models/Backlog.php index 07d3353..9ffb370 100644 --- a/src/Models/Backlog.php +++ b/src/Models/Backlog.php @@ -175,6 +175,17 @@ class Backlog extends Model 'status' => 0, 'rank' => 0, 'size' => 0, + 'matrix' => '{}', + 'x' => null, + 'y' => null, + 'z' => null, + 'r' => null, + 'theta' => null, + 'rho' => null, + 'phi' => null, + 'elevation' => null, + 'latitude' => null, + 'longitude' => null, 'active' => true, 'canceled' => false, 'closed' => false, @@ -267,6 +278,17 @@ class Backlog extends Model 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', 'canceled', 'closed', @@ -344,6 +366,17 @@ protected function casts(): array 'only_guest' => 'boolean', 'allow_public' => 'boolean', 'status' => 'integer', + 'matrix' => 'array', + 'x' => 'integer', + 'y' => 'integer', + 'z' => 'integer', + 'r' => 'float', + 'theta' => 'float', + 'rho' => 'float', + 'phi' => 'float', + 'elevation' => 'float', + 'latitude' => 'float', + 'longitude' => 'float', 'rank' => 'integer', 'size' => 'integer', 'active' => 'boolean', @@ -426,6 +459,18 @@ public function flow(): HasOne ); } + /** + * The matrix of the backlog. + */ + public function matrix(): HasOne + { + return $this->hasOne( + Matrix::class, + 'id', + 'matrix_id' + ); + } + /** * The milestone of the backlog. */ @@ -565,7 +610,7 @@ public function sprints(): HasMany { return $this->hasMany( Sprint::class, - 'sprint_id', + 'backlog_id', 'id' ); } @@ -577,7 +622,7 @@ public function tickets(): HasMany { return $this->hasMany( Ticket::class, - 'ticket_id', + 'backlog_id', 'id' ); } diff --git a/src/Models/Board.php b/src/Models/Board.php index ded648e..d984637 100644 --- a/src/Models/Board.php +++ b/src/Models/Board.php @@ -1,9 +1,9 @@ null, 'epic_id' => null, 'flow_id' => null, + 'matrix_id' => null, 'milestone_id' => null, 'note_id' => null, 'project_id' => null, @@ -55,8 +158,8 @@ class Board extends Model 'postponed_at' => null, 'published_at' => null, 'released_at' => null, - 'resolved_at' => null, 'resumed_at' => null, + 'resolved_at' => null, 'suspended_at' => null, 'gids' => 0, 'po' => 0, @@ -69,7 +172,7 @@ class Board extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -84,6 +187,7 @@ class Board extends Model 'canceled' => false, 'closed' => false, 'completed' => false, + 'cron' => false, 'duplicate' => false, 'fixed' => false, 'flagged' => false, @@ -134,6 +238,7 @@ class Board extends Model 'backlog_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', @@ -185,6 +290,7 @@ class Board extends Model 'canceled', 'closed', 'completed', + 'cron', 'duplicate', 'fixed', 'flagged', @@ -217,7 +323,6 @@ class Board extends Model 'board', 'flow', 'meta', - 'notes', 'options', 'roadmap', 'sources', @@ -260,7 +365,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -275,6 +380,7 @@ protected function casts(): array 'canceled' => 'boolean', 'closed' => 'boolean', 'completed' => 'boolean', + 'cron' => 'boolean', 'duplicate' => 'boolean', 'fixed' => 'boolean', 'flagged' => 'boolean', @@ -350,6 +456,18 @@ public function flow(): HasOne ); } + /** + * The matrix of the board. + */ + public function matrix(): HasOne + { + return $this->hasOne( + Matrix::class, + 'id', + 'matrix_id' + ); + } + /** * The milestone of the board. */ diff --git a/src/Models/Sprint.php b/src/Models/Sprint.php index 3f833fa..0ccbd27 100644 --- a/src/Models/Sprint.php +++ b/src/Models/Sprint.php @@ -1,9 +1,9 @@ null, 'epic_id' => null, 'flow_id' => null, + 'matrix_id' => null, 'milestone_id' => null, 'note_id' => null, 'project_id' => null, @@ -55,8 +158,8 @@ class Sprint extends Model 'postponed_at' => null, 'published_at' => null, 'released_at' => null, - 'resolved_at' => null, 'resumed_at' => null, + 'resolved_at' => null, 'suspended_at' => null, 'gids' => 0, 'po' => 0, @@ -69,7 +172,7 @@ class Sprint extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -84,6 +187,7 @@ class Sprint extends Model 'canceled' => false, 'closed' => false, 'completed' => false, + 'cron' => false, 'duplicate' => false, 'fixed' => false, 'flagged' => false, @@ -135,6 +239,7 @@ class Sprint extends Model 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', @@ -185,6 +290,7 @@ class Sprint extends Model 'canceled', 'closed', 'completed', + 'cron', 'duplicate', 'fixed', 'flagged', @@ -217,7 +323,6 @@ class Sprint extends Model 'board', 'flow', 'meta', - 'notes', 'options', 'roadmap', 'sources', @@ -260,7 +365,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -275,6 +380,7 @@ protected function casts(): array 'canceled' => 'boolean', 'closed' => 'boolean', 'completed' => 'boolean', + 'cron' => 'boolean', 'duplicate' => 'boolean', 'fixed' => 'boolean', 'flagged' => 'boolean', @@ -362,6 +468,18 @@ public function flow(): HasOne ); } + /** + * The matrix of the board. + */ + public function matrix(): HasOne + { + return $this->hasOne( + Matrix::class, + 'id', + 'matrix_id' + ); + } + /** * The milestone of the sprint. */ diff --git a/src/Models/Ticket.php b/src/Models/Ticket.php index 159c0fc..a768356 100644 --- a/src/Models/Ticket.php +++ b/src/Models/Ticket.php @@ -202,7 +202,7 @@ class Ticket extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -591,6 +591,18 @@ public function flow(): HasOne ); } + /** + * The matrix of the ticket. + */ + public function matrix(): HasOne + { + return $this->hasOne( + Matrix::class, + 'id', + 'matrix_id' + ); + } + /** * The milestone of the ticket. */ diff --git a/tests/Feature/Models/Backlog/ModelTest.php b/tests/Feature/Models/Backlog/ModelTest.php index 3b66bc2..5211a2a 100644 --- a/tests/Feature/Models/Backlog/ModelTest.php +++ b/tests/Feature/Models/Backlog/ModelTest.php @@ -17,6 +17,14 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array> Test hasMany relationships. + */ + protected array $hasMany = [ + 'sprints' => ['key' => 'backlog_id', 'modelClass' => \Playground\Matrix\Models\Sprint::class], + 'tickets' => ['key' => 'backlog_id', 'modelClass' => \Playground\Matrix\Models\Ticket::class], + ]; + protected array $hasOne = [ 'creator' => [ 'key' => 'created_by_id', @@ -53,6 +61,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Flow::class, ], + 'matrix' => [ + 'key' => 'matrix_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Matrix::class, + ], 'milestone' => [ 'key' => 'milestone_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Board/ModelTest.php b/tests/Feature/Models/Board/ModelTest.php index 0ee8bf9..fc03fe0 100644 --- a/tests/Feature/Models/Board/ModelTest.php +++ b/tests/Feature/Models/Board/ModelTest.php @@ -53,6 +53,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Flow::class, ], + 'matrix' => [ + 'key' => 'matrix_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Matrix::class, + ], 'milestone' => [ 'key' => 'milestone_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Sprint/ModelTest.php b/tests/Feature/Models/Sprint/ModelTest.php index 93eec4e..2f88b6e 100644 --- a/tests/Feature/Models/Sprint/ModelTest.php +++ b/tests/Feature/Models/Sprint/ModelTest.php @@ -58,6 +58,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Flow::class, ], + 'matrix' => [ + 'key' => 'matrix_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Matrix::class, + ], 'milestone' => [ 'key' => 'milestone_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Ticket/ModelTest.php b/tests/Feature/Models/Ticket/ModelTest.php index 60abfa8..d5c5efd 100644 --- a/tests/Feature/Models/Ticket/ModelTest.php +++ b/tests/Feature/Models/Ticket/ModelTest.php @@ -58,11 +58,21 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Epic::class, ], + 'fixedBy' => [ + 'key' => 'fixed_by_id', + 'rule' => 'create', + 'modelClass' => \Playground\Models\User::class, + ], 'flow' => [ 'key' => 'flow_id', 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Flow::class, ], + 'matrix' => [ + 'key' => 'matrix_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Matrix::class, + ], 'milestone' => [ 'key' => 'milestone_id', 'rule' => 'create', From 057450b8a528326a90a58a13eff4b7eaed2e0cad Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Fri, 26 Apr 2024 22:17:24 -0700 Subject: [PATCH 05/18] GH-19 --- database/factories/EpicFactory.php | 4 +- ...01_02_100001_create_matrix_epics_table.php | 29 ++-- src/Models/Epic.php | 130 +++++++++++++++++- tests/Feature/Models/Epic/ModelTest.php | 5 + tests/Unit/Models/Backlog/ModelTest.php | 1 + tests/Unit/Models/Board/ModelTest.php | 1 + tests/Unit/Models/Epic/ModelTest.php | 1 + tests/Unit/Models/Sprint/ModelTest.php | 1 + tests/Unit/Models/Ticket/ModelTest.php | 1 + 9 files changed, 153 insertions(+), 20 deletions(-) diff --git a/database/factories/EpicFactory.php b/database/factories/EpicFactory.php index 77c2607..df38e0b 100644 --- a/database/factories/EpicFactory.php +++ b/database/factories/EpicFactory.php @@ -1,9 +1,9 @@ uuid('id')->primary(); @@ -89,13 +93,13 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -103,6 +107,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -118,19 +123,19 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns $table->string('label')->default(''); $table->string('title')->default(''); $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); + $table->string('slug')->nullable()->index(); $table->string('url')->default(''); $table->string('description')->default(''); $table->string('introduction')->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui $table->string('icon')->default(''); $table->string('image')->default(''); diff --git a/src/Models/Epic.php b/src/Models/Epic.php index 3a35b15..454aee5 100644 --- a/src/Models/Epic.php +++ b/src/Models/Epic.php @@ -1,9 +1,9 @@ null, 'board_id' => null, 'flow_id' => null, + 'matrix_id' => null, 'milestone_id' => null, 'note_id' => null, 'project_id' => null, @@ -55,8 +158,8 @@ class Epic extends Model 'postponed_at' => null, 'published_at' => null, 'released_at' => null, - 'resolved_at' => null, 'resumed_at' => null, + 'resolved_at' => null, 'suspended_at' => null, 'gids' => 0, 'po' => 0, @@ -69,7 +172,7 @@ class Epic extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -84,6 +187,7 @@ class Epic extends Model 'canceled' => false, 'closed' => false, 'completed' => false, + 'cron' => false, 'duplicate' => false, 'fixed' => false, 'flagged' => false, @@ -134,6 +238,7 @@ class Epic extends Model 'backlog_id', 'board_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', @@ -185,6 +290,7 @@ class Epic extends Model 'canceled', 'closed', 'completed', + 'cron', 'duplicate', 'fixed', 'flagged', @@ -217,7 +323,6 @@ class Epic extends Model 'board', 'flow', 'meta', - 'notes', 'options', 'roadmap', 'sources', @@ -260,7 +365,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -275,6 +380,7 @@ protected function casts(): array 'canceled' => 'boolean', 'closed' => 'boolean', 'completed' => 'boolean', + 'cron' => 'boolean', 'duplicate' => 'boolean', 'fixed' => 'boolean', 'flagged' => 'boolean', @@ -350,6 +456,18 @@ public function flow(): HasOne ); } + /** + * The matrix of the board. + */ + public function matrix(): HasOne + { + return $this->hasOne( + Matrix::class, + 'id', + 'matrix_id' + ); + } + /** * The milestone of the epic. */ diff --git a/tests/Feature/Models/Epic/ModelTest.php b/tests/Feature/Models/Epic/ModelTest.php index 14cf93c..105bb62 100644 --- a/tests/Feature/Models/Epic/ModelTest.php +++ b/tests/Feature/Models/Epic/ModelTest.php @@ -53,6 +53,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Flow::class, ], + 'matrix' => [ + 'key' => 'matrix_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Matrix::class, + ], 'milestone' => [ 'key' => 'milestone_id', 'rule' => 'create', diff --git a/tests/Unit/Models/Backlog/ModelTest.php b/tests/Unit/Models/Backlog/ModelTest.php index 3f38dd0..2b8ce28 100644 --- a/tests/Unit/Models/Backlog/ModelTest.php +++ b/tests/Unit/Models/Backlog/ModelTest.php @@ -25,6 +25,7 @@ class ModelTest extends ModelCase 'board', 'epic', 'flow', + 'matrix', 'milestone', 'note', 'project', diff --git a/tests/Unit/Models/Board/ModelTest.php b/tests/Unit/Models/Board/ModelTest.php index ff9b70a..02c1362 100644 --- a/tests/Unit/Models/Board/ModelTest.php +++ b/tests/Unit/Models/Board/ModelTest.php @@ -25,6 +25,7 @@ class ModelTest extends ModelCase 'backlog', 'epic', 'flow', + 'matrix', 'milestone', 'project', 'release', diff --git a/tests/Unit/Models/Epic/ModelTest.php b/tests/Unit/Models/Epic/ModelTest.php index 92916a3..367200f 100644 --- a/tests/Unit/Models/Epic/ModelTest.php +++ b/tests/Unit/Models/Epic/ModelTest.php @@ -25,6 +25,7 @@ class ModelTest extends ModelCase 'backlog', 'board', 'flow', + 'matrix', 'milestone', 'project', 'release', diff --git a/tests/Unit/Models/Sprint/ModelTest.php b/tests/Unit/Models/Sprint/ModelTest.php index 3bc330f..af9587f 100644 --- a/tests/Unit/Models/Sprint/ModelTest.php +++ b/tests/Unit/Models/Sprint/ModelTest.php @@ -26,6 +26,7 @@ class ModelTest extends ModelCase 'board', 'epic', 'flow', + 'matrix', 'milestone', 'project', 'release', diff --git a/tests/Unit/Models/Ticket/ModelTest.php b/tests/Unit/Models/Ticket/ModelTest.php index f82da53..5cf0dfc 100644 --- a/tests/Unit/Models/Ticket/ModelTest.php +++ b/tests/Unit/Models/Ticket/ModelTest.php @@ -27,6 +27,7 @@ class ModelTest extends ModelCase 'completedBy', 'epic', 'flow', + 'matrix', 'milestone', 'project', 'release', From 970b70ef86e6d91e00852a86c43e9ac50c85d004 Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Sat, 27 Apr 2024 10:10:07 -0700 Subject: [PATCH 06/18] GH-19 --- database/factories/FlowFactory.php | 4 +- database/factories/MilestoneFactory.php | 4 +- ...01_02_100001_create_matrix_flows_table.php | 47 +++--- ..._100001_create_matrix_milestones_table.php | 31 ++-- src/Models/Flow.php | 155 ++++++++++++------ src/Models/Milestone.php | 134 +++++++++++++-- tests/Feature/Models/Flow/ModelTest.php | 5 + tests/Feature/Models/Milestone/ModelTest.php | 5 + tests/Unit/Models/Backlog/ModelTest.php | 5 + tests/Unit/Models/Flow/ModelTest.php | 1 + tests/Unit/Models/Milestone/ModelTest.php | 1 + tests/Unit/Models/Ticket/ModelTest.php | 1 + 12 files changed, 292 insertions(+), 101 deletions(-) diff --git a/database/factories/FlowFactory.php b/database/factories/FlowFactory.php index 6ccb573..97d354b 100644 --- a/database/factories/FlowFactory.php +++ b/database/factories/FlowFactory.php @@ -1,9 +1,9 @@ uuid('id')->primary(); @@ -44,14 +48,8 @@ public function up(): void $table->dateTime('planned_start_at')->nullable(); $table->dateTime('end_at')->nullable()->index(); $table->dateTime('planned_end_at')->nullable(); - $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(); @@ -78,48 +76,41 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags $table->boolean('active')->default(1)->index(); - $table->boolean('canceled')->default(0); - $table->boolean('closed')->default(0); - $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); - $table->boolean('fixed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); $table->boolean('locked')->default(0); $table->boolean('pending')->default(0); $table->boolean('planned')->default(0); $table->boolean('problem')->default(0); - $table->boolean('published')->default(0); - $table->boolean('released')->default(0); $table->boolean('retired')->default(0); - $table->boolean('resolved')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns $table->string('label')->default(''); $table->string('title')->default(''); $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); + $table->string('slug')->nullable()->index(); $table->string('url')->default(''); $table->string('description')->default(''); $table->string('introduction')->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui $table->string('icon')->default(''); $table->string('image')->default(''); @@ -133,6 +124,10 @@ public function up(): void $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('backlog')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('board')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('roadmap')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); }); } diff --git a/database/migrations/2020_01_02_100001_create_matrix_milestones_table.php b/database/migrations/2020_01_02_100001_create_matrix_milestones_table.php index f7542fa..8c18b2c 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_milestones_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_milestones_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -62,8 +66,8 @@ public function up(): void $table->dateTime('postponed_at')->nullable(); $table->dateTime('published_at')->nullable(); $table->dateTime('released_at')->nullable(); - $table->dateTime('resumed_at')->nullable(); $table->dateTime('resolved_at')->nullable()->index(); + $table->dateTime('resumed_at')->nullable(); $table->dateTime('suspended_at')->nullable(); // Permissions @@ -89,13 +93,13 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -103,6 +107,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -118,19 +123,19 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns $table->string('label')->default(''); $table->string('title')->default(''); $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); + $table->string('slug')->nullable()->index(); $table->string('url')->default(''); $table->string('description')->default(''); $table->string('introduction')->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui $table->string('icon')->default(''); $table->string('image')->default(''); diff --git a/src/Models/Flow.php b/src/Models/Flow.php index 6010df5..f48c52f 100644 --- a/src/Models/Flow.php +++ b/src/Models/Flow.php @@ -1,9 +1,9 @@ null, 'parent_id' => null, 'flow_type' => null, + 'matrix_id' => null, 'note_id' => null, 'tag_id' => null, 'team_id' => null, @@ -37,14 +115,8 @@ class Flow extends Model 'planned_start_at' => null, 'end_at' => null, 'planned_end_at' => null, - 'canceled_at' => null, - 'closed_at' => null, 'embargo_at' => null, - 'fixed_at' => null, 'postponed_at' => null, - 'published_at' => null, - 'released_at' => null, - 'resolved_at' => null, 'resumed_at' => null, 'suspended_at' => null, 'gids' => 0, @@ -58,7 +130,7 @@ class Flow extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -70,21 +142,14 @@ class Flow extends Model 'latitude' => null, 'longitude' => null, 'active' => true, - 'canceled' => false, - 'closed' => false, - 'completed' => false, - 'duplicate' => false, - 'fixed' => false, + 'cron' => false, 'flagged' => false, 'internal' => false, 'locked' => false, 'pending' => false, 'planned' => false, 'problem' => false, - 'published' => false, - 'released' => false, 'retired' => false, - 'resolved' => false, 'suspended' => false, 'unknown' => false, 'label' => '', @@ -101,10 +166,14 @@ class Flow extends Model 'avatar' => '', 'ui' => '{}', 'assets' => '{}', + 'backlog' => '{}', + 'board' => '{}', 'flow' => '{}', 'meta' => '{}', 'notes' => '[]', 'options' => '{}', + 'roadmap' => '{}', + 'sources' => '{}', ]; /** @@ -116,6 +185,7 @@ class Flow extends Model 'owned_by_id', 'parent_id', 'flow_type', + 'matrix_id', 'note_id', 'tag_id', 'team_id', @@ -123,15 +193,9 @@ class Flow extends Model 'planned_start_at', 'end_at', 'planned_end_at', - 'canceled_at', - 'closed_at', 'embargo_at', - 'fixed_at', 'postponed_at', - 'published_at', - 'released_at', 'resumed_at', - 'resolved_at', 'suspended_at', 'gids', 'po', @@ -156,21 +220,14 @@ class Flow extends Model 'latitude', 'longitude', 'active', - 'canceled', - 'closed', - 'completed', - 'duplicate', - 'fixed', + 'cron', 'flagged', 'internal', 'locked', 'pending', 'planned', 'problem', - 'published', - 'released', 'retired', - 'resolved', 'suspended', 'unknown', 'label', @@ -187,10 +244,13 @@ class Flow extends Model 'avatar', 'ui', 'assets', + 'backlog', + 'board', 'flow', 'meta', - 'notes', 'options', + 'roadmap', + 'sources', ]; /** @@ -209,15 +269,9 @@ protected function casts(): array 'planned_start_at' => 'datetime', 'end_at' => 'datetime', 'planned_end_at' => 'datetime', - 'canceled_at' => 'datetime', - 'closed_at' => 'datetime', 'embargo_at' => 'datetime', - 'fixed_at' => 'datetime', 'postponed_at' => 'datetime', - 'published_at' => 'datetime', - 'released_at' => 'datetime', 'resumed_at' => 'datetime', - 'resolved_at' => 'datetime', 'suspended_at' => 'datetime', 'gids' => 'integer', 'po' => 'integer', @@ -230,7 +284,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -242,21 +296,14 @@ protected function casts(): array 'latitude' => 'float', 'longitude' => 'float', 'active' => 'boolean', - 'canceled' => 'boolean', - 'closed' => 'boolean', - 'completed' => 'boolean', - 'duplicate' => 'boolean', - 'fixed' => 'boolean', + 'cron' => 'boolean', 'flagged' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', 'pending' => 'boolean', 'planned' => 'boolean', 'problem' => 'boolean', - 'published' => 'boolean', - 'released' => 'boolean', 'retired' => 'boolean', - 'resolved' => 'boolean', 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', @@ -273,6 +320,8 @@ protected function casts(): array 'avatar' => 'string', 'ui' => 'array', 'assets' => 'array', + 'backlog' => 'array', + 'board' => 'array', 'flow' => 'array', 'meta' => 'array', 'notes' => 'array', @@ -282,6 +331,18 @@ protected function casts(): array ]; } + /** + * The matrix of the flow. + */ + public function matrix(): HasOne + { + return $this->hasOne( + Matrix::class, + 'id', + 'matrix_id' + ); + } + /** * The note of the flow. */ diff --git a/src/Models/Milestone.php b/src/Models/Milestone.php index eacebe5..38e6f07 100644 --- a/src/Models/Milestone.php +++ b/src/Models/Milestone.php @@ -1,9 +1,9 @@ null, 'epic_id' => null, 'flow_id' => null, + 'matrix_id' => null, 'note_id' => null, 'project_id' => null, 'release_id' => null, @@ -51,11 +154,9 @@ class Milestone extends Model 'canceled_at' => null, 'closed_at' => null, 'embargo_at' => null, - 'fixed_at' => null, 'postponed_at' => null, 'published_at' => null, 'released_at' => null, - 'resolved_at' => null, 'resumed_at' => null, 'suspended_at' => null, 'gids' => 0, @@ -69,7 +170,7 @@ class Milestone extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -84,6 +185,7 @@ class Milestone extends Model 'canceled' => false, 'closed' => false, 'completed' => false, + 'cron' => false, 'duplicate' => false, 'fixed' => false, 'flagged' => false, @@ -135,6 +237,7 @@ class Milestone extends Model 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'note_id', 'project_id', 'release_id', @@ -152,12 +255,10 @@ class Milestone extends Model 'canceled_at', 'closed_at', 'embargo_at', - 'fixed_at', 'postponed_at', 'published_at', 'released_at', 'resumed_at', - 'resolved_at', 'suspended_at', 'gids', 'po', @@ -185,6 +286,7 @@ class Milestone extends Model 'canceled', 'closed', 'completed', + 'cron', 'duplicate', 'fixed', 'flagged', @@ -217,7 +319,6 @@ class Milestone extends Model 'board', 'flow', 'meta', - 'notes', 'options', 'roadmap', 'sources', @@ -242,12 +343,10 @@ protected function casts(): array 'canceled_at' => 'datetime', 'closed_at' => 'datetime', 'embargo_at' => 'datetime', - 'fixed_at' => 'datetime', 'postponed_at' => 'datetime', 'published_at' => 'datetime', 'released_at' => 'datetime', 'resumed_at' => 'datetime', - 'resolved_at' => 'datetime', 'suspended_at' => 'datetime', 'gids' => 'integer', 'po' => 'integer', @@ -260,7 +359,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -275,6 +374,7 @@ protected function casts(): array 'canceled' => 'boolean', 'closed' => 'boolean', 'completed' => 'boolean', + 'cron' => 'boolean', 'duplicate' => 'boolean', 'fixed' => 'boolean', 'flagged' => 'boolean', @@ -362,6 +462,18 @@ public function flow(): HasOne ); } + /** + * The matrix of the milestone. + */ + public function matrix(): HasOne + { + return $this->hasOne( + Matrix::class, + 'id', + 'matrix_id' + ); + } + /** * The project of the milestone. */ diff --git a/tests/Feature/Models/Flow/ModelTest.php b/tests/Feature/Models/Flow/ModelTest.php index f1ef2d3..cb56278 100644 --- a/tests/Feature/Models/Flow/ModelTest.php +++ b/tests/Feature/Models/Flow/ModelTest.php @@ -38,6 +38,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Flow::class, ], + 'matrix' => [ + 'key' => 'matrix_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Matrix::class, + ], 'note' => [ 'key' => 'note_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Milestone/ModelTest.php b/tests/Feature/Models/Milestone/ModelTest.php index c21d53c..65c9637 100644 --- a/tests/Feature/Models/Milestone/ModelTest.php +++ b/tests/Feature/Models/Milestone/ModelTest.php @@ -58,6 +58,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Flow::class, ], + 'matrix' => [ + 'key' => 'matrix_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Matrix::class, + ], 'project' => [ 'key' => 'project_id', 'rule' => 'create', diff --git a/tests/Unit/Models/Backlog/ModelTest.php b/tests/Unit/Models/Backlog/ModelTest.php index 2b8ce28..dc7f0b5 100644 --- a/tests/Unit/Models/Backlog/ModelTest.php +++ b/tests/Unit/Models/Backlog/ModelTest.php @@ -17,6 +17,11 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + protected array $hasMany = [ + 'sprints', + 'tickets', + ]; + protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Flow/ModelTest.php b/tests/Unit/Models/Flow/ModelTest.php index d6bdae8..1645a63 100644 --- a/tests/Unit/Models/Flow/ModelTest.php +++ b/tests/Unit/Models/Flow/ModelTest.php @@ -22,6 +22,7 @@ class ModelTest extends ModelCase 'modifier', 'owner', 'parent', + 'matrix', 'note', 'tag', 'team', diff --git a/tests/Unit/Models/Milestone/ModelTest.php b/tests/Unit/Models/Milestone/ModelTest.php index d13a36a..8b608e5 100644 --- a/tests/Unit/Models/Milestone/ModelTest.php +++ b/tests/Unit/Models/Milestone/ModelTest.php @@ -26,6 +26,7 @@ class ModelTest extends ModelCase 'board', 'epic', 'flow', + 'matrix', 'project', 'release', 'roadmap', diff --git a/tests/Unit/Models/Ticket/ModelTest.php b/tests/Unit/Models/Ticket/ModelTest.php index 5cf0dfc..72e033d 100644 --- a/tests/Unit/Models/Ticket/ModelTest.php +++ b/tests/Unit/Models/Ticket/ModelTest.php @@ -26,6 +26,7 @@ class ModelTest extends ModelCase 'board', 'completedBy', 'epic', + 'fixedBy', 'flow', 'matrix', 'milestone', From a2f887b1962e3e86b0537b0bf97749526598d5fe Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Sat, 27 Apr 2024 11:00:05 -0700 Subject: [PATCH 07/18] GH-19 --- database/factories/NoteFactory.php | 4 +- ...01_02_100001_create_matrix_notes_table.php | 55 ++---- src/Models/Note.php | 176 ++++++++++-------- tests/Feature/Models/Note/ModelTest.php | 35 +++- tests/Unit/Models/Note/ModelTest.php | 11 +- 5 files changed, 159 insertions(+), 122 deletions(-) diff --git a/database/factories/NoteFactory.php b/database/factories/NoteFactory.php index bdbb297..35737d0 100644 --- a/database/factories/NoteFactory.php +++ b/database/factories/NoteFactory.php @@ -1,9 +1,9 @@ uuid('id')->primary(); @@ -30,6 +34,7 @@ public function up(): void $table->uuid('parent_id')->nullable()->index(); $table->string('note_type')->nullable()->index(); $table->uuid('matrix_id')->nullable()->index(); + $table->uuid('tag_id')->nullable()->index(); // Dates @@ -37,21 +42,6 @@ public function up(): void $table->softDeletes(); - $table->dateTime('start_at')->nullable()->index(); - $table->dateTime('planned_start_at')->nullable(); - $table->dateTime('end_at')->nullable()->index(); - $table->dateTime('planned_end_at')->nullable(); - $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('resumed_at')->nullable(); - $table->dateTime('resolved_at')->nullable()->index(); - $table->dateTime('suspended_at')->nullable(); - // Permissions $table->bigInteger('gids')->default(0)->unsigned(); @@ -75,13 +65,13 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -89,34 +79,27 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); - $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); $table->boolean('locked')->default(0); $table->boolean('pending')->default(0); $table->boolean('planned')->default(0); $table->boolean('problem')->default(0); - $table->boolean('published')->default(0); - $table->boolean('released')->default(0); - $table->boolean('retired')->default(0); - $table->boolean('resolved')->default(0); - $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns $table->string('label')->default(''); $table->string('title')->default(''); $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); + $table->string('slug')->nullable()->index(); $table->string('url')->default(''); $table->string('description')->default(''); $table->string('introduction')->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui $table->string('icon')->default(''); $table->string('image')->default(''); @@ -126,13 +109,9 @@ public function up(): void // JSON $table->json('assets')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('backlog')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('board')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('flow')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('roadmap')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); }); } diff --git a/src/Models/Note.php b/src/Models/Note.php index 75a801d..66d5d67 100644 --- a/src/Models/Note.php +++ b/src/Models/Note.php @@ -1,15 +1,79 @@ null, 'parent_id' => null, 'note_type' => null, + 'matrix_id' => null, + 'tag_id' => null, 'created_at' => null, 'updated_at' => null, 'deleted_at' => null, - 'start_at' => null, - 'planned_start_at' => null, - 'end_at' => null, - 'planned_end_at' => null, - 'canceled_at' => null, - 'closed_at' => null, - 'embargo_at' => null, - 'fixed_at' => null, - 'postponed_at' => null, - 'published_at' => null, - 'released_at' => null, - 'resolved_at' => null, - 'resumed_at' => null, - 'suspended_at' => null, 'gids' => 0, 'po' => 0, 'pg' => 0, @@ -54,7 +106,7 @@ class Note extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -69,19 +121,12 @@ class Note extends Model 'canceled' => false, 'closed' => false, 'completed' => false, - 'duplicate' => false, - 'fixed' => false, 'flagged' => false, 'internal' => false, 'locked' => false, 'pending' => false, 'planned' => false, 'problem' => false, - 'published' => false, - 'released' => false, - 'retired' => false, - 'resolved' => false, - 'suspended' => false, 'unknown' => false, 'label' => '', 'title' => '', @@ -97,13 +142,9 @@ class Note extends Model 'avatar' => '', 'ui' => '{}', 'assets' => '{}', - 'backlog' => '{}', - 'board' => '{}', - 'flow' => '{}', 'meta' => '{}', 'notes' => '[]', 'options' => '{}', - 'roadmap' => '{}', 'sources' => '{}', ]; @@ -116,20 +157,8 @@ class Note extends Model 'owned_by_id', 'parent_id', 'note_type', - 'start_at', - 'planned_start_at', - 'end_at', - 'planned_end_at', - 'canceled_at', - 'closed_at', - 'embargo_at', - 'fixed_at', - 'postponed_at', - 'published_at', - 'released_at', - 'resumed_at', - 'resolved_at', - 'suspended_at', + 'matrix_id', + 'tag_id', 'gids', 'po', 'pg', @@ -156,19 +185,12 @@ class Note extends Model 'canceled', 'closed', 'completed', - 'duplicate', - 'fixed', 'flagged', 'internal', 'locked', 'pending', 'planned', 'problem', - 'published', - 'released', - 'retired', - 'resolved', - 'suspended', 'unknown', 'label', 'title', @@ -184,13 +206,8 @@ class Note extends Model 'avatar', 'ui', 'assets', - 'backlog', - 'board', - 'flow', 'meta', - 'notes', 'options', - 'roadmap', 'sources', ]; @@ -206,20 +223,6 @@ protected function casts(): array 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', - 'start_at' => 'datetime', - 'planned_start_at' => 'datetime', - 'end_at' => 'datetime', - 'planned_end_at' => 'datetime', - 'canceled_at' => 'datetime', - 'closed_at' => 'datetime', - 'embargo_at' => 'datetime', - 'fixed_at' => 'datetime', - 'postponed_at' => 'datetime', - 'published_at' => 'datetime', - 'released_at' => 'datetime', - 'resumed_at' => 'datetime', - 'resolved_at' => 'datetime', - 'suspended_at' => 'datetime', 'gids' => 'integer', 'po' => 'integer', 'pg' => 'integer', @@ -231,7 +234,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -246,19 +249,12 @@ protected function casts(): array 'canceled' => 'boolean', 'closed' => 'boolean', 'completed' => 'boolean', - 'duplicate' => 'boolean', - 'fixed' => 'boolean', 'flagged' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', 'pending' => 'boolean', 'planned' => 'boolean', 'problem' => 'boolean', - 'published' => 'boolean', - 'released' => 'boolean', - 'retired' => 'boolean', - 'resolved' => 'boolean', - 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', 'title' => 'string', @@ -274,14 +270,34 @@ protected function casts(): array 'avatar' => 'string', 'ui' => 'array', 'assets' => 'array', - 'backlog' => 'array', - 'board' => 'array', - 'flow' => 'array', 'meta' => 'array', 'notes' => 'array', 'options' => 'array', - 'roadmap' => 'array', 'sources' => 'array', ]; } + + /** + * The matrix of the note. + */ + public function matrix(): HasOne + { + return $this->hasOne( + Matrix::class, + 'id', + 'matrix_id' + ); + } + + /** + * The tag of the note. + */ + public function tag(): HasOne + { + return $this->hasOne( + Tag::class, + 'id', + 'tag_id' + ); + } } diff --git a/tests/Feature/Models/Note/ModelTest.php b/tests/Feature/Models/Note/ModelTest.php index 43cbd92..264cfde 100644 --- a/tests/Feature/Models/Note/ModelTest.php +++ b/tests/Feature/Models/Note/ModelTest.php @@ -15,5 +15,38 @@ class ModelTest extends ModelCase { protected string $modelClass = \Playground\Matrix\Models\Note::class; - protected bool $hasRelationships = false; + protected bool $hasRelationships = true; + + protected array $hasOne = [ + 'creator' => [ + 'key' => 'created_by_id', + 'rule' => 'create', + 'modelClass' => \Playground\Models\User::class, + ], + 'modifier' => [ + 'key' => 'modified_by_id', + 'rule' => 'create', + 'modelClass' => \Playground\Models\User::class, + ], + 'owner' => [ + 'key' => 'owned_by_id', + 'rule' => 'create', + 'modelClass' => \Playground\Models\User::class, + ], + 'parent' => [ + 'key' => 'parent_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Note::class, + ], + 'matrix' => [ + 'key' => 'matrix_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Matrix::class, + ], + 'tag' => [ + 'key' => 'tag_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Tag::class, + ], + ]; } diff --git a/tests/Unit/Models/Note/ModelTest.php b/tests/Unit/Models/Note/ModelTest.php index 087352a..04ddf97 100644 --- a/tests/Unit/Models/Note/ModelTest.php +++ b/tests/Unit/Models/Note/ModelTest.php @@ -15,5 +15,14 @@ class ModelTest extends ModelCase { protected string $modelClass = \Playground\Matrix\Models\Note::class; - protected bool $hasRelationships = false; + protected bool $hasRelationships = true; + + protected array $hasOne = [ + 'creator', + 'modifier', + 'owner', + 'parent', + 'matrix', + 'tag', + ]; } From 5808531e43530e2af4a6cecc1f5e7eef49330f55 Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Sat, 27 Apr 2024 15:35:27 -0700 Subject: [PATCH 08/18] GH-19 --- database/factories/ReleaseFactory.php | 4 +- ...02_100001_create_matrix_backlogs_table.php | 20 +-- ...1_02_100001_create_matrix_boards_table.php | 20 +-- ...01_02_100001_create_matrix_epics_table.php | 20 +-- ...01_02_100001_create_matrix_flows_table.php | 20 +-- ..._100001_create_matrix_milestones_table.php | 20 +-- ...01_02_100001_create_matrix_notes_table.php | 20 +-- ...02_100001_create_matrix_projects_table.php | 53 +++--- ...02_100001_create_matrix_releases_table.php | 53 +++--- ..._02_100001_create_matrix_sprints_table.php | 20 +-- ..._02_100001_create_matrix_tickets_table.php | 42 ++--- src/Models/Epic.php | 4 +- src/Models/Project.php | 160 +++++++++++++++--- src/Models/Release.php | 140 ++++++++++++--- src/Models/Sprint.php | 2 +- src/Models/Ticket.php | 15 +- tests/Feature/Models/Project/ModelTest.php | 5 + tests/Feature/Models/Release/ModelTest.php | 5 + tests/Unit/Models/Project/ModelTest.php | 1 + tests/Unit/Models/Release/ModelTest.php | 1 + 20 files changed, 420 insertions(+), 205 deletions(-) diff --git a/database/factories/ReleaseFactory.php b/database/factories/ReleaseFactory.php index edef0cb..2c4d3f5 100644 --- a/database/factories/ReleaseFactory.php +++ b/database/factories/ReleaseFactory.php @@ -1,9 +1,9 @@ string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations/2020_01_02_100001_create_matrix_boards_table.php b/database/migrations/2020_01_02_100001_create_matrix_boards_table.php index df72ee8..883da40 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_boards_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_boards_table.php @@ -125,21 +125,21 @@ public function up(): void // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations/2020_01_02_100001_create_matrix_epics_table.php b/database/migrations/2020_01_02_100001_create_matrix_epics_table.php index a0a9bd9..1c0b96b 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_epics_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_epics_table.php @@ -125,21 +125,21 @@ public function up(): void // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations/2020_01_02_100001_create_matrix_flows_table.php b/database/migrations/2020_01_02_100001_create_matrix_flows_table.php index ad7f5ca..292766e 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_flows_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_flows_table.php @@ -100,21 +100,21 @@ public function up(): void // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations/2020_01_02_100001_create_matrix_milestones_table.php b/database/migrations/2020_01_02_100001_create_matrix_milestones_table.php index 8c18b2c..a959018 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_milestones_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_milestones_table.php @@ -125,21 +125,21 @@ public function up(): void // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations/2020_01_02_100001_create_matrix_notes_table.php b/database/migrations/2020_01_02_100001_create_matrix_notes_table.php index 9bf56cf..2bf60fa 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_notes_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_notes_table.php @@ -89,21 +89,21 @@ public function up(): void // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations/2020_01_02_100001_create_matrix_projects_table.php b/database/migrations/2020_01_02_100001_create_matrix_projects_table.php index 8902052..ed6b18e 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_projects_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_projects_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -58,7 +62,6 @@ 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(); @@ -89,13 +92,13 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -103,6 +106,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -118,25 +122,25 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - $table->string('key', 128)->default(''); - $table->string('code_name', 128)->default(''); + $table->string('key', 32)->nullable()->index(); + $table->string('code_name', 128)->nullable()->index(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON @@ -145,6 +149,7 @@ public function up(): void $table->json('backlog')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('board')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('flow')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('history')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); diff --git a/database/migrations/2020_01_02_100001_create_matrix_releases_table.php b/database/migrations/2020_01_02_100001_create_matrix_releases_table.php index c46da27..c47197d 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_releases_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_releases_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -58,12 +62,10 @@ 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('resumed_at')->nullable(); - $table->dateTime('resolved_at')->nullable()->index(); $table->dateTime('suspended_at')->nullable(); // Permissions @@ -89,13 +91,13 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -103,8 +105,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); - $table->boolean('fixed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); $table->boolean('locked')->default(0); @@ -113,28 +114,26 @@ public function up(): void $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); - $table->boolean('retired')->default(0); - $table->boolean('resolved')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations/2020_01_02_100001_create_matrix_sprints_table.php b/database/migrations/2020_01_02_100001_create_matrix_sprints_table.php index 00129ae..3936cc0 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_sprints_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_sprints_table.php @@ -125,21 +125,21 @@ public function up(): void // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php b/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php index f8e761f..5352dfd 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php @@ -98,13 +98,13 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -132,19 +132,19 @@ public function up(): void // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - $table->string('key')->default(''); $table->string('handler')->default(''); - $table->bigInteger('code')->default(0)->unsigned()->index(); - $table->string('key_code_hash')->default(''); + $table->string('key', 32)->nullable()->index(); + $table->bigInteger('code')->nullable()->unsigned()->index(); + $table->string('key_code_hash')->nullable(); $table->string('priority')->default(''); $table->string('severity')->default(''); $table->string('resolution')->default(''); @@ -157,13 +157,13 @@ public function up(): void $table->mediumText('story')->nullable(); $table->mediumText('steps')->nullable(); $table->mediumText('criteria')->nullable(); - $table->decimal('reproducibility', 8, 2)->nullable()->default(null); + $table->decimal('reproducibility', 8, 2)->nullable(); // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/src/Models/Epic.php b/src/Models/Epic.php index 454aee5..fd7bbfe 100644 --- a/src/Models/Epic.php +++ b/src/Models/Epic.php @@ -76,6 +76,7 @@ * @property bool $canceled * @property bool $closed * @property bool $completed + * @property bool $cron * @property bool $duplicate * @property bool $fixed * @property bool $flagged @@ -90,7 +91,6 @@ * @property bool $resolved * @property bool $suspended * @property bool $unknown - * @property bool $cron * @property string $label * @property string $title * @property string $byline @@ -457,7 +457,7 @@ public function flow(): HasOne } /** - * The matrix of the board. + * The matrix of the epic. */ public function matrix(): HasOne { diff --git a/src/Models/Project.php b/src/Models/Project.php index 516ab9f..22f8125 100644 --- a/src/Models/Project.php +++ b/src/Models/Project.php @@ -1,9 +1,9 @@ null, 'epic_id' => null, 'flow_id' => null, + 'matrix_id' => null, 'milestone_id' => null, 'note_id' => null, 'release_id' => null, @@ -51,11 +156,9 @@ class Project extends Model 'canceled_at' => null, 'closed_at' => null, 'embargo_at' => null, - 'fixed_at' => null, 'postponed_at' => null, 'published_at' => null, 'released_at' => null, - 'resolved_at' => null, 'resumed_at' => null, 'suspended_at' => null, 'gids' => 0, @@ -69,7 +172,7 @@ class Project extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -84,18 +187,14 @@ class Project extends Model 'canceled' => false, 'closed' => false, 'completed' => false, - 'duplicate' => false, - 'fixed' => false, + 'cron' => false, 'flagged' => false, 'internal' => false, 'locked' => false, 'pending' => false, 'planned' => false, 'problem' => false, - 'published' => false, 'released' => false, - 'retired' => false, - 'resolved' => false, 'suspended' => false, 'unknown' => false, 'label' => '', @@ -107,6 +206,8 @@ class Project extends Model 'introduction' => '', 'content' => null, 'summary' => null, + 'key' => null, + 'code_name' => null, 'icon' => '', 'image' => '', 'avatar' => '', @@ -115,6 +216,7 @@ class Project extends Model 'backlog' => '{}', 'board' => '{}', 'flow' => '{}', + 'history' => '{}', 'meta' => '{}', 'notes' => '[]', 'options' => '{}', @@ -135,6 +237,7 @@ class Project extends Model 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'release_id', @@ -152,12 +255,10 @@ class Project extends Model 'canceled_at', 'closed_at', 'embargo_at', - 'fixed_at', 'postponed_at', 'published_at', 'released_at', 'resumed_at', - 'resolved_at', 'suspended_at', 'gids', 'po', @@ -185,18 +286,14 @@ class Project extends Model 'canceled', 'closed', 'completed', - 'duplicate', - 'fixed', + 'cron', 'flagged', 'internal', 'locked', 'pending', 'planned', 'problem', - 'published', 'released', - 'retired', - 'resolved', 'suspended', 'unknown', 'label', @@ -208,6 +305,8 @@ class Project extends Model 'introduction', 'content', 'summary', + 'key', + 'code_name', 'icon', 'image', 'avatar', @@ -216,8 +315,8 @@ class Project extends Model 'backlog', 'board', 'flow', + 'history', 'meta', - 'notes', 'options', 'roadmap', 'sources', @@ -242,12 +341,10 @@ protected function casts(): array 'canceled_at' => 'datetime', 'closed_at' => 'datetime', 'embargo_at' => 'datetime', - 'fixed_at' => 'datetime', 'postponed_at' => 'datetime', 'published_at' => 'datetime', 'released_at' => 'datetime', 'resumed_at' => 'datetime', - 'resolved_at' => 'datetime', 'suspended_at' => 'datetime', 'gids' => 'integer', 'po' => 'integer', @@ -260,7 +357,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -275,18 +372,14 @@ protected function casts(): array 'canceled' => 'boolean', 'closed' => 'boolean', 'completed' => 'boolean', - 'duplicate' => 'boolean', - 'fixed' => 'boolean', + 'cron' => 'boolean', 'flagged' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', 'pending' => 'boolean', 'planned' => 'boolean', 'problem' => 'boolean', - 'published' => 'boolean', 'released' => 'boolean', - 'retired' => 'boolean', - 'resolved' => 'boolean', 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', @@ -298,6 +391,8 @@ protected function casts(): array 'introduction' => 'string', 'content' => 'string', 'summary' => 'string', + 'key' => 'string', + 'code_name' => 'string', 'icon' => 'string', 'image' => 'string', 'avatar' => 'string', @@ -306,6 +401,7 @@ protected function casts(): array 'backlog' => 'array', 'board' => 'array', 'flow' => 'array', + 'history' => 'array', 'meta' => 'array', 'notes' => 'array', 'options' => 'array', @@ -362,6 +458,18 @@ public function flow(): HasOne ); } + /** + * The matrix of the project. + */ + public function matrix(): HasOne + { + return $this->hasOne( + Matrix::class, + 'id', + 'matrix_id' + ); + } + /** * The milestone of the project. */ diff --git a/src/Models/Release.php b/src/Models/Release.php index 816434a..f142a94 100644 --- a/src/Models/Release.php +++ b/src/Models/Release.php @@ -1,9 +1,9 @@ null, 'epic_id' => null, 'flow_id' => null, + 'matrix_id' => null, 'milestone_id' => null, 'note_id' => null, 'project_id' => null, @@ -51,11 +148,9 @@ class Release extends Model 'canceled_at' => null, 'closed_at' => null, 'embargo_at' => null, - 'fixed_at' => null, 'postponed_at' => null, 'published_at' => null, 'released_at' => null, - 'resolved_at' => null, 'resumed_at' => null, 'suspended_at' => null, 'gids' => 0, @@ -69,7 +164,7 @@ class Release extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -84,8 +179,7 @@ class Release extends Model 'canceled' => false, 'closed' => false, 'completed' => false, - 'duplicate' => false, - 'fixed' => false, + 'cron' => false, 'flagged' => false, 'internal' => false, 'locked' => false, @@ -94,8 +188,6 @@ class Release extends Model 'problem' => false, 'published' => false, 'released' => false, - 'retired' => false, - 'resolved' => false, 'suspended' => false, 'unknown' => false, 'label' => '', @@ -135,6 +227,7 @@ class Release extends Model 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', @@ -152,12 +245,10 @@ class Release extends Model 'canceled_at', 'closed_at', 'embargo_at', - 'fixed_at', 'postponed_at', 'published_at', 'released_at', 'resumed_at', - 'resolved_at', 'suspended_at', 'gids', 'po', @@ -185,8 +276,7 @@ class Release extends Model 'canceled', 'closed', 'completed', - 'duplicate', - 'fixed', + 'cron', 'flagged', 'internal', 'locked', @@ -195,8 +285,6 @@ class Release extends Model 'problem', 'published', 'released', - 'retired', - 'resolved', 'suspended', 'unknown', 'label', @@ -217,7 +305,6 @@ class Release extends Model 'board', 'flow', 'meta', - 'notes', 'options', 'roadmap', 'sources', @@ -242,12 +329,10 @@ protected function casts(): array 'canceled_at' => 'datetime', 'closed_at' => 'datetime', 'embargo_at' => 'datetime', - 'fixed_at' => 'datetime', 'postponed_at' => 'datetime', 'published_at' => 'datetime', 'released_at' => 'datetime', 'resumed_at' => 'datetime', - 'resolved_at' => 'datetime', 'suspended_at' => 'datetime', 'gids' => 'integer', 'po' => 'integer', @@ -260,7 +345,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -275,8 +360,7 @@ protected function casts(): array 'canceled' => 'boolean', 'closed' => 'boolean', 'completed' => 'boolean', - 'duplicate' => 'boolean', - 'fixed' => 'boolean', + 'cron' => 'boolean', 'flagged' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', @@ -285,8 +369,6 @@ protected function casts(): array 'problem' => 'boolean', 'published' => 'boolean', 'released' => 'boolean', - 'retired' => 'boolean', - 'resolved' => 'boolean', 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', @@ -362,6 +444,18 @@ public function flow(): HasOne ); } + /** + * The matrix of the release. + */ + public function matrix(): HasOne + { + return $this->hasOne( + Matrix::class, + 'id', + 'matrix_id' + ); + } + /** * The milestone of the release. */ diff --git a/src/Models/Sprint.php b/src/Models/Sprint.php index 0ccbd27..92bc958 100644 --- a/src/Models/Sprint.php +++ b/src/Models/Sprint.php @@ -22,6 +22,7 @@ * @property ?string $board_id * @property ?string $epic_id * @property ?string $flow_id + * @property ?string $matrix_id * @property ?string $milestone_id * @property ?string $note_id * @property ?string $project_id @@ -32,7 +33,6 @@ * @property ?string $team_id * @property ?string $ticket_id * @property ?string $version_id - * @property ?string $matrix_id * @property ?Carbon $created_at * @property ?Carbon $updated_at * @property ?Carbon $deleted_at diff --git a/src/Models/Ticket.php b/src/Models/Ticket.php index a768356..7f7b1e1 100644 --- a/src/Models/Ticket.php +++ b/src/Models/Ticket.php @@ -107,10 +107,10 @@ * @property string $introduction * @property ?string $content * @property ?string $summary - * @property string $key * @property string $handler - * @property int $code - * @property string $key_code_hash + * @property ?string $key + * @property ?int $code + * @property ?string $key_code_hash * @property string $priority * @property string $severity * @property string $resolution @@ -241,10 +241,10 @@ class Ticket extends Model 'introduction' => '', 'content' => null, 'summary' => null, - 'key' => '', 'handler' => '', - 'code' => 0, - 'key_code_hash' => '', + 'key' => null, + 'code' => null, + 'key_code_hash' => null, 'priority' => '', 'severity' => '', 'resolution' => '', @@ -367,10 +367,7 @@ class Ticket extends Model 'introduction', 'content', 'summary', - 'key', 'handler', - 'code', - 'key_code_hash', 'priority', 'severity', 'resolution', diff --git a/tests/Feature/Models/Project/ModelTest.php b/tests/Feature/Models/Project/ModelTest.php index fe31982..8e89daf 100644 --- a/tests/Feature/Models/Project/ModelTest.php +++ b/tests/Feature/Models/Project/ModelTest.php @@ -58,6 +58,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Flow::class, ], + 'matrix' => [ + 'key' => 'matrix_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Matrix::class, + ], 'milestone' => [ 'key' => 'milestone_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Release/ModelTest.php b/tests/Feature/Models/Release/ModelTest.php index bb7a7a4..0c0572b 100644 --- a/tests/Feature/Models/Release/ModelTest.php +++ b/tests/Feature/Models/Release/ModelTest.php @@ -58,6 +58,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Flow::class, ], + 'matrix' => [ + 'key' => 'matrix_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Matrix::class, + ], 'milestone' => [ 'key' => 'milestone_id', 'rule' => 'create', diff --git a/tests/Unit/Models/Project/ModelTest.php b/tests/Unit/Models/Project/ModelTest.php index 4579805..0b9e0cc 100644 --- a/tests/Unit/Models/Project/ModelTest.php +++ b/tests/Unit/Models/Project/ModelTest.php @@ -26,6 +26,7 @@ class ModelTest extends ModelCase 'board', 'epic', 'flow', + 'matrix', 'milestone', 'release', 'roadmap', diff --git a/tests/Unit/Models/Release/ModelTest.php b/tests/Unit/Models/Release/ModelTest.php index 62578d0..9e3a16a 100644 --- a/tests/Unit/Models/Release/ModelTest.php +++ b/tests/Unit/Models/Release/ModelTest.php @@ -26,6 +26,7 @@ class ModelTest extends ModelCase 'board', 'epic', 'flow', + 'matrix', 'milestone', 'project', 'roadmap', From ee1574fad1b16245d2735e8bfe20bfb506c796f2 Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Sun, 28 Apr 2024 09:09:00 -0700 Subject: [PATCH 09/18] GH-19 --- database/factories/RoadmapFactory.php | 4 +- database/factories/SourceFactory.php | 4 +- database/factories/TagFactory.php | 4 +- database/factories/VersionFactory.php | 4 +- ...02_100001_create_matrix_roadmaps_table.php | 52 +-- ..._02_100001_create_matrix_sources_table.php | 63 ++-- ..._01_02_100001_create_matrix_tags_table.php | 91 ++--- ...02_100001_create_matrix_versions_table.php | 59 ++- src/Models/Roadmap.php | 141 ++++++-- src/Models/Source.php | 282 +++++---------- src/Models/Tag.php | 338 ++++-------------- src/Models/Version.php | 297 +++++---------- tests/Feature/Models/Backlog/ModelTest.php | 4 +- tests/Feature/Models/Board/ModelTest.php | 4 +- tests/Feature/Models/Epic/ModelTest.php | 4 +- tests/Feature/Models/Flow/ModelTest.php | 4 +- tests/Feature/Models/Matrix/ModelTest.php | 4 +- tests/Feature/Models/Milestone/ModelTest.php | 4 +- tests/Feature/Models/ModelCase.php | 4 +- tests/Feature/Models/Note/ModelTest.php | 4 +- tests/Feature/Models/Project/ModelTest.php | 4 +- tests/Feature/Models/Release/ModelTest.php | 4 +- tests/Feature/Models/Roadmap/ModelTest.php | 9 +- tests/Feature/Models/Source/ModelTest.php | 60 +--- tests/Feature/Models/Sprint/ModelTest.php | 4 +- tests/Feature/Models/Tag/ModelTest.php | 70 +--- tests/Feature/Models/Team/ModelTest.php | 4 +- tests/Feature/Models/Ticket/ModelTest.php | 4 +- tests/Feature/Models/Version/ModelTest.php | 4 +- tests/Unit/Models/Backlog/ModelTest.php | 4 +- tests/Unit/Models/Board/ModelTest.php | 4 +- tests/Unit/Models/Epic/ModelTest.php | 4 +- tests/Unit/Models/Flow/ModelTest.php | 4 +- tests/Unit/Models/Matrix/ModelTest.php | 4 +- tests/Unit/Models/Milestone/ModelTest.php | 4 +- tests/Unit/Models/ModelCase.php | 4 +- tests/Unit/Models/Note/ModelTest.php | 4 +- tests/Unit/Models/Project/ModelTest.php | 4 +- tests/Unit/Models/Release/ModelTest.php | 4 +- tests/Unit/Models/Roadmap/ModelTest.php | 5 +- tests/Unit/Models/Source/ModelTest.php | 16 +- tests/Unit/Models/Sprint/ModelTest.php | 4 +- tests/Unit/Models/Tag/ModelTest.php | 18 +- tests/Unit/Models/Team/ModelTest.php | 4 +- tests/Unit/Models/Ticket/ModelTest.php | 4 +- tests/Unit/Models/Version/ModelTest.php | 4 +- 46 files changed, 574 insertions(+), 1055 deletions(-) diff --git a/database/factories/RoadmapFactory.php b/database/factories/RoadmapFactory.php index 327f042..c0823bf 100644 --- a/database/factories/RoadmapFactory.php +++ b/database/factories/RoadmapFactory.php @@ -1,9 +1,9 @@ uuid('id')->primary(); @@ -58,12 +62,10 @@ 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('resumed_at')->nullable(); - $table->dateTime('resolved_at')->nullable()->index(); $table->dateTime('suspended_at')->nullable(); // Permissions @@ -89,13 +91,13 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -103,8 +105,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); - $table->boolean('fixed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); $table->boolean('locked')->default(0); @@ -113,28 +114,27 @@ public function up(): void $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); - $table->boolean('retired')->default(0); $table->boolean('resolved')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations/2020_01_02_100001_create_matrix_sources_table.php b/database/migrations/2020_01_02_100001_create_matrix_sources_table.php index 1fd31c4..f9a54ce 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_sources_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_sources_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -29,21 +33,9 @@ public function up(): void $table->uuid('owned_by_id')->nullable()->index(); $table->uuid('parent_id')->nullable()->index(); $table->string('source_type')->nullable()->index(); - $table->uuid('backlog_id')->nullable()->index(); - $table->uuid('board_id')->nullable()->index(); - $table->uuid('epic_id')->nullable()->index(); - $table->uuid('flow_id')->nullable()->index(); $table->uuid('matrix_id')->nullable()->index(); - $table->uuid('milestone_id')->nullable()->index(); - $table->uuid('note_id')->nullable()->index(); - $table->uuid('project_id')->nullable()->index(); - $table->uuid('release_id')->nullable()->index(); - $table->uuid('roadmap_id')->nullable()->index(); - $table->uuid('sprint_id')->nullable()->index(); $table->uuid('tag_id')->nullable()->index(); $table->uuid('team_id')->nullable()->index(); - $table->uuid('ticket_id')->nullable()->index(); - $table->uuid('version_id')->nullable()->index(); // Dates @@ -89,13 +81,13 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -103,6 +95,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -118,35 +111,31 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON $table->json('assets')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('backlog')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('board')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('flow')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('roadmap')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); }); } diff --git a/database/migrations/2020_01_02_100001_create_matrix_tags_table.php b/database/migrations/2020_01_02_100001_create_matrix_tags_table.php index efd7bd6..b3caa09 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_tags_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_tags_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -29,21 +33,7 @@ public function up(): void $table->uuid('owned_by_id')->nullable()->index(); $table->uuid('parent_id')->nullable()->index(); $table->string('tag_type')->nullable()->index(); - $table->uuid('backlog_id')->nullable()->index(); - $table->uuid('board_id')->nullable()->index(); - $table->uuid('epic_id')->nullable()->index(); - $table->uuid('flow_id')->nullable()->index(); $table->uuid('matrix_id')->nullable()->index(); - $table->uuid('milestone_id')->nullable()->index(); - $table->uuid('note_id')->nullable()->index(); - $table->uuid('project_id')->nullable()->index(); - $table->uuid('release_id')->nullable()->index(); - $table->uuid('roadmap_id')->nullable()->index(); - $table->uuid('source_id')->nullable()->index(); - $table->uuid('sprint_id')->nullable()->index(); - $table->uuid('team_id')->nullable()->index(); - $table->uuid('ticket_id')->nullable()->index(); - $table->uuid('version_id')->nullable()->index(); // Dates @@ -51,21 +41,6 @@ public function up(): void $table->softDeletes(); - $table->dateTime('start_at')->nullable()->index(); - $table->dateTime('planned_start_at')->nullable(); - $table->dateTime('end_at')->nullable()->index(); - $table->dateTime('planned_end_at')->nullable(); - $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('resumed_at')->nullable(); - $table->dateTime('resolved_at')->nullable()->index(); - $table->dateTime('suspended_at')->nullable(); - // Permissions $table->bigInteger('gids')->default(0)->unsigned(); @@ -89,64 +64,48 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags $table->boolean('active')->default(1)->index(); - $table->boolean('canceled')->default(0); - $table->boolean('closed')->default(0); - $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); - $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); $table->boolean('locked')->default(0); - $table->boolean('pending')->default(0); - $table->boolean('planned')->default(0); - $table->boolean('problem')->default(0); - $table->boolean('published')->default(0); - $table->boolean('released')->default(0); $table->boolean('retired')->default(0); - $table->boolean('resolved')->default(0); - $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON $table->json('assets')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('backlog')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('board')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('flow')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('roadmap')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); }); } diff --git a/database/migrations/2020_01_02_100001_create_matrix_versions_table.php b/database/migrations/2020_01_02_100001_create_matrix_versions_table.php index 03dffcc..a4637b7 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_versions_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_versions_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -29,18 +33,10 @@ public function up(): void $table->uuid('owned_by_id')->nullable()->index(); $table->uuid('parent_id')->nullable()->index(); $table->string('version_type')->nullable()->index(); - $table->uuid('backlog_id')->nullable()->index(); - $table->uuid('board_id')->nullable()->index(); - $table->uuid('epic_id')->nullable()->index(); - $table->uuid('flow_id')->nullable()->index(); $table->uuid('matrix_id')->nullable()->index(); - $table->uuid('milestone_id')->nullable()->index(); - $table->uuid('note_id')->nullable()->index(); $table->uuid('project_id')->nullable()->index(); - $table->uuid('release_id')->nullable()->index(); $table->uuid('roadmap_id')->nullable()->index(); $table->uuid('source_id')->nullable()->index(); - $table->uuid('sprint_id')->nullable()->index(); $table->uuid('tag_id')->nullable()->index(); $table->uuid('team_id')->nullable()->index(); $table->uuid('ticket_id')->nullable()->index(); @@ -89,13 +85,13 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -103,7 +99,6 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); @@ -118,35 +113,31 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON $table->json('assets')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('backlog')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('board')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('flow')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('roadmap')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); }); } diff --git a/src/Models/Roadmap.php b/src/Models/Roadmap.php index 8c15caa..2c96974 100644 --- a/src/Models/Roadmap.php +++ b/src/Models/Roadmap.php @@ -1,9 +1,9 @@ null, 'epic_id' => null, 'flow_id' => null, + 'matrix_id' => null, 'milestone_id' => null, 'note_id' => null, 'project_id' => null, @@ -51,11 +149,9 @@ class Roadmap extends Model 'canceled_at' => null, 'closed_at' => null, 'embargo_at' => null, - 'fixed_at' => null, 'postponed_at' => null, 'published_at' => null, 'released_at' => null, - 'resolved_at' => null, 'resumed_at' => null, 'suspended_at' => null, 'gids' => 0, @@ -69,7 +165,7 @@ class Roadmap extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -84,8 +180,7 @@ class Roadmap extends Model 'canceled' => false, 'closed' => false, 'completed' => false, - 'duplicate' => false, - 'fixed' => false, + 'cron' => false, 'flagged' => false, 'internal' => false, 'locked' => false, @@ -94,8 +189,6 @@ class Roadmap extends Model 'problem' => false, 'published' => false, 'released' => false, - 'retired' => false, - 'resolved' => false, 'suspended' => false, 'unknown' => false, 'label' => '', @@ -135,6 +228,7 @@ class Roadmap extends Model 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', @@ -152,12 +246,10 @@ class Roadmap extends Model 'canceled_at', 'closed_at', 'embargo_at', - 'fixed_at', 'postponed_at', 'published_at', 'released_at', 'resumed_at', - 'resolved_at', 'suspended_at', 'gids', 'po', @@ -185,8 +277,7 @@ class Roadmap extends Model 'canceled', 'closed', 'completed', - 'duplicate', - 'fixed', + 'cron', 'flagged', 'internal', 'locked', @@ -195,8 +286,6 @@ class Roadmap extends Model 'problem', 'published', 'released', - 'retired', - 'resolved', 'suspended', 'unknown', 'label', @@ -217,7 +306,6 @@ class Roadmap extends Model 'board', 'flow', 'meta', - 'notes', 'options', 'roadmap', 'sources', @@ -242,12 +330,10 @@ protected function casts(): array 'canceled_at' => 'datetime', 'closed_at' => 'datetime', 'embargo_at' => 'datetime', - 'fixed_at' => 'datetime', 'postponed_at' => 'datetime', 'published_at' => 'datetime', 'released_at' => 'datetime', 'resumed_at' => 'datetime', - 'resolved_at' => 'datetime', 'suspended_at' => 'datetime', 'gids' => 'integer', 'po' => 'integer', @@ -260,7 +346,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -275,8 +361,7 @@ protected function casts(): array 'canceled' => 'boolean', 'closed' => 'boolean', 'completed' => 'boolean', - 'duplicate' => 'boolean', - 'fixed' => 'boolean', + 'cron' => 'boolean', 'flagged' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', @@ -285,8 +370,6 @@ protected function casts(): array 'problem' => 'boolean', 'published' => 'boolean', 'released' => 'boolean', - 'retired' => 'boolean', - 'resolved' => 'boolean', 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', @@ -362,6 +445,18 @@ public function flow(): HasOne ); } + /** + * The matrix of the roadmap. + */ + public function matrix(): HasOne + { + return $this->hasOne( + Matrix::class, + 'id', + 'matrix_id' + ); + } + /** * The milestone of the roadmap. */ diff --git a/src/Models/Source.php b/src/Models/Source.php index 77b49da..e8b92c8 100644 --- a/src/Models/Source.php +++ b/src/Models/Source.php @@ -1,9 +1,9 @@ null, 'parent_id' => null, 'source_type' => null, - 'backlog_id' => null, - 'board_id' => null, - 'epic_id' => null, - 'flow_id' => null, - 'milestone_id' => null, - 'note_id' => null, - 'project_id' => null, - 'release_id' => null, - 'roadmap_id' => null, - 'sprint_id' => null, + 'matrix_id' => null, 'tag_id' => null, 'team_id' => null, - 'ticket_id' => null, - 'version_id' => null, 'created_at' => null, 'updated_at' => null, 'deleted_at' => null, @@ -51,11 +126,9 @@ class Source extends Model 'canceled_at' => null, 'closed_at' => null, 'embargo_at' => null, - 'fixed_at' => null, 'postponed_at' => null, 'published_at' => null, 'released_at' => null, - 'resolved_at' => null, 'resumed_at' => null, 'suspended_at' => null, 'gids' => 0, @@ -69,7 +142,7 @@ class Source extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -84,8 +157,7 @@ class Source extends Model 'canceled' => false, 'closed' => false, 'completed' => false, - 'duplicate' => false, - 'fixed' => false, + 'cron' => false, 'flagged' => false, 'internal' => false, 'locked' => false, @@ -94,8 +166,6 @@ class Source extends Model 'problem' => false, 'published' => false, 'released' => false, - 'retired' => false, - 'resolved' => false, 'suspended' => false, 'unknown' => false, 'label' => '', @@ -112,13 +182,9 @@ class Source extends Model 'avatar' => '', 'ui' => '{}', 'assets' => '{}', - 'backlog' => '{}', - 'board' => '{}', - 'flow' => '{}', 'meta' => '{}', 'notes' => '[]', 'options' => '{}', - 'roadmap' => '{}', 'sources' => '{}', ]; @@ -131,20 +197,9 @@ class Source extends Model 'owned_by_id', 'parent_id', 'source_type', - 'backlog_id', - 'board_id', - 'epic_id', - 'flow_id', - 'milestone_id', - 'note_id', - 'project_id', - 'release_id', - 'roadmap_id', - 'sprint_id', + 'matrix_id', 'tag_id', 'team_id', - 'ticket_id', - 'version_id', 'start_at', 'planned_start_at', 'end_at', @@ -152,12 +207,10 @@ class Source extends Model 'canceled_at', 'closed_at', 'embargo_at', - 'fixed_at', 'postponed_at', 'published_at', 'released_at', 'resumed_at', - 'resolved_at', 'suspended_at', 'gids', 'po', @@ -185,8 +238,7 @@ class Source extends Model 'canceled', 'closed', 'completed', - 'duplicate', - 'fixed', + 'cron', 'flagged', 'internal', 'locked', @@ -195,8 +247,6 @@ class Source extends Model 'problem', 'published', 'released', - 'retired', - 'resolved', 'suspended', 'unknown', 'label', @@ -213,13 +263,8 @@ class Source extends Model 'avatar', 'ui', 'assets', - 'backlog', - 'board', - 'flow', 'meta', - 'notes', 'options', - 'roadmap', 'sources', ]; @@ -242,12 +287,10 @@ protected function casts(): array 'canceled_at' => 'datetime', 'closed_at' => 'datetime', 'embargo_at' => 'datetime', - 'fixed_at' => 'datetime', 'postponed_at' => 'datetime', 'published_at' => 'datetime', 'released_at' => 'datetime', 'resumed_at' => 'datetime', - 'resolved_at' => 'datetime', 'suspended_at' => 'datetime', 'gids' => 'integer', 'po' => 'integer', @@ -260,7 +303,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -275,8 +318,7 @@ protected function casts(): array 'canceled' => 'boolean', 'closed' => 'boolean', 'completed' => 'boolean', - 'duplicate' => 'boolean', - 'fixed' => 'boolean', + 'cron' => 'boolean', 'flagged' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', @@ -285,8 +327,6 @@ protected function casts(): array 'problem' => 'boolean', 'published' => 'boolean', 'released' => 'boolean', - 'retired' => 'boolean', - 'resolved' => 'boolean', 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', @@ -303,122 +343,22 @@ protected function casts(): array 'avatar' => 'string', 'ui' => 'array', 'assets' => 'array', - 'backlog' => 'array', - 'board' => 'array', - 'flow' => 'array', 'meta' => 'array', 'notes' => 'array', 'options' => 'array', - 'roadmap' => 'array', 'sources' => 'array', ]; } /** - * The backlog of the source. - */ - public function backlog(): HasOne - { - return $this->hasOne( - Backlog::class, - 'id', - 'backlog_id' - ); - } - - /** - * The board of the source. - */ - public function board(): HasOne - { - return $this->hasOne( - Board::class, - 'id', - 'board_id' - ); - } - - /** - * The epic of the source. - */ - public function epic(): HasOne - { - return $this->hasOne( - Epic::class, - 'id', - 'epic_id' - ); - } - - /** - * The flow of the source. - */ - public function flow(): HasOne - { - return $this->hasOne( - Flow::class, - 'id', - 'flow_id' - ); - } - - /** - * The milestone of the source. - */ - public function milestone(): HasOne - { - return $this->hasOne( - Milestone::class, - 'id', - 'milestone_id' - ); - } - - /** - * The project of the source. - */ - public function project(): HasOne - { - return $this->hasOne( - Project::class, - 'id', - 'project_id' - ); - } - - /** - * The release of the source. - */ - public function release(): HasOne - { - return $this->hasOne( - Release::class, - 'id', - 'release_id' - ); - } - - /** - * The roadmap of the source. - */ - public function roadmap(): HasOne - { - return $this->hasOne( - Roadmap::class, - 'id', - 'roadmap_id' - ); - } - - /** - * The sprint of the source. + * The matrix of the source. */ - public function sprint(): HasOne + public function matrix(): HasOne { return $this->hasOne( - Sprint::class, + Matrix::class, 'id', - 'sprint_id' + 'matrix_id' ); } @@ -445,28 +385,4 @@ public function team(): HasOne 'team_id' ); } - - /** - * The ticket of the source. - */ - public function ticket(): HasOne - { - return $this->hasOne( - Ticket::class, - 'id', - 'ticket_id' - ); - } - - /** - * The version of the source. - */ - public function version(): HasOne - { - return $this->hasOne( - Version::class, - 'id', - 'version_id' - ); - } } diff --git a/src/Models/Tag.php b/src/Models/Tag.php index 8aa7f4c..47e3409 100644 --- a/src/Models/Tag.php +++ b/src/Models/Tag.php @@ -1,9 +1,9 @@ null, 'parent_id' => null, 'tag_type' => null, - 'backlog_id' => null, - 'board_id' => null, - 'epic_id' => null, - 'flow_id' => null, - 'milestone_id' => null, - 'note_id' => null, - 'project_id' => null, - 'release_id' => null, - 'roadmap_id' => null, - 'source_id' => null, - 'sprint_id' => null, - 'team_id' => null, - 'ticket_id' => null, - 'version_id' => null, + 'matrix_id' => null, 'created_at' => null, 'updated_at' => null, 'deleted_at' => null, - 'start_at' => null, - 'planned_start_at' => null, - 'end_at' => null, - 'planned_end_at' => null, - 'canceled_at' => null, - 'closed_at' => null, - 'embargo_at' => null, - 'fixed_at' => null, - 'postponed_at' => null, - 'published_at' => null, - 'released_at' => null, - 'resolved_at' => null, - 'resumed_at' => null, - 'suspended_at' => null, 'gids' => 0, 'po' => 0, 'pg' => 0, @@ -69,7 +99,7 @@ class Tag extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -81,22 +111,10 @@ class Tag extends Model 'latitude' => null, 'longitude' => null, 'active' => true, - 'canceled' => false, - 'closed' => false, - 'completed' => false, - 'duplicate' => false, - 'fixed' => false, 'flagged' => false, 'internal' => false, 'locked' => false, - 'pending' => false, - 'planned' => false, - 'problem' => false, - 'published' => false, - 'released' => false, 'retired' => false, - 'resolved' => false, - 'suspended' => false, 'unknown' => false, 'label' => '', 'title' => '', @@ -112,13 +130,9 @@ class Tag extends Model 'avatar' => '', 'ui' => '{}', 'assets' => '{}', - 'backlog' => '{}', - 'board' => '{}', - 'flow' => '{}', 'meta' => '{}', 'notes' => '[]', 'options' => '{}', - 'roadmap' => '{}', 'sources' => '{}', ]; @@ -131,34 +145,7 @@ class Tag extends Model 'owned_by_id', 'parent_id', 'tag_type', - 'backlog_id', - 'board_id', - 'epic_id', - 'flow_id', - 'milestone_id', - 'note_id', - 'project_id', - 'release_id', - 'roadmap_id', - 'source_id', - 'sprint_id', - 'team_id', - 'ticket_id', - 'version_id', - 'start_at', - 'planned_start_at', - 'end_at', - 'planned_end_at', - 'canceled_at', - 'closed_at', - 'embargo_at', - 'fixed_at', - 'postponed_at', - 'published_at', - 'released_at', - 'resumed_at', - 'resolved_at', - 'suspended_at', + 'matrix_id', 'gids', 'po', 'pg', @@ -182,22 +169,10 @@ class Tag extends Model 'latitude', 'longitude', 'active', - 'canceled', - 'closed', - 'completed', - 'duplicate', - 'fixed', 'flagged', 'internal', 'locked', - 'pending', - 'planned', - 'problem', - 'published', - 'released', 'retired', - 'resolved', - 'suspended', 'unknown', 'label', 'title', @@ -213,13 +188,8 @@ class Tag extends Model 'avatar', 'ui', 'assets', - 'backlog', - 'board', - 'flow', 'meta', - 'notes', 'options', - 'roadmap', 'sources', ]; @@ -235,20 +205,6 @@ protected function casts(): array 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', - 'start_at' => 'datetime', - 'planned_start_at' => 'datetime', - 'end_at' => 'datetime', - 'planned_end_at' => 'datetime', - 'canceled_at' => 'datetime', - 'closed_at' => 'datetime', - 'embargo_at' => 'datetime', - 'fixed_at' => 'datetime', - 'postponed_at' => 'datetime', - 'published_at' => 'datetime', - 'released_at' => 'datetime', - 'resumed_at' => 'datetime', - 'resolved_at' => 'datetime', - 'suspended_at' => 'datetime', 'gids' => 'integer', 'po' => 'integer', 'pg' => 'integer', @@ -260,7 +216,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -272,22 +228,10 @@ protected function casts(): array 'latitude' => 'float', 'longitude' => 'float', 'active' => 'boolean', - 'canceled' => 'boolean', - 'closed' => 'boolean', - 'completed' => 'boolean', - 'duplicate' => 'boolean', - 'fixed' => 'boolean', 'flagged' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', - 'pending' => 'boolean', - 'planned' => 'boolean', - 'problem' => 'boolean', - 'published' => 'boolean', - 'released' => 'boolean', 'retired' => 'boolean', - 'resolved' => 'boolean', - 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', 'title' => 'string', @@ -303,170 +247,22 @@ protected function casts(): array 'avatar' => 'string', 'ui' => 'array', 'assets' => 'array', - 'backlog' => 'array', - 'board' => 'array', - 'flow' => 'array', 'meta' => 'array', 'notes' => 'array', 'options' => 'array', - 'roadmap' => 'array', 'sources' => 'array', ]; } /** - * The backlog of the tag. - */ - public function backlog(): HasOne - { - return $this->hasOne( - Backlog::class, - 'id', - 'backlog_id' - ); - } - - /** - * The board of the tag. - */ - public function board(): HasOne - { - return $this->hasOne( - Board::class, - 'id', - 'board_id' - ); - } - - /** - * The epic of the tag. - */ - public function epic(): HasOne - { - return $this->hasOne( - Epic::class, - 'id', - 'epic_id' - ); - } - - /** - * The flow of the tag. - */ - public function flow(): HasOne - { - return $this->hasOne( - Flow::class, - 'id', - 'flow_id' - ); - } - - /** - * The milestone of the tag. - */ - public function milestone(): HasOne - { - return $this->hasOne( - Milestone::class, - 'id', - 'milestone_id' - ); - } - - /** - * The project of the tag. - */ - public function project(): HasOne - { - return $this->hasOne( - Project::class, - 'id', - 'project_id' - ); - } - - /** - * The release of the tag. - */ - public function release(): HasOne - { - return $this->hasOne( - Release::class, - 'id', - 'release_id' - ); - } - - /** - * The roadmap of the tag. - */ - public function roadmap(): HasOne - { - return $this->hasOne( - Roadmap::class, - 'id', - 'roadmap_id' - ); - } - - /** - * The source of the tag. - */ - public function source(): HasOne - { - return $this->hasOne( - Source::class, - 'id', - 'source_id' - ); - } - - /** - * The sprint of the tag. - */ - public function sprint(): HasOne - { - return $this->hasOne( - Sprint::class, - 'id', - 'sprint_id' - ); - } - - /** - * The team of the tag. - */ - public function team(): HasOne - { - return $this->hasOne( - Team::class, - 'id', - 'team_id' - ); - } - - /** - * The ticket of the tag. - */ - public function ticket(): HasOne - { - return $this->hasOne( - Ticket::class, - 'id', - 'ticket_id' - ); - } - - /** - * The version of the tag. + * The matrix of the tag. */ - public function version(): HasOne + public function matrix(): HasOne { return $this->hasOne( - Version::class, + Matrix::class, 'id', - 'version_id' + 'matrix_id' ); } } diff --git a/src/Models/Version.php b/src/Models/Version.php index 3c63d76..476301d 100644 --- a/src/Models/Version.php +++ b/src/Models/Version.php @@ -1,9 +1,9 @@ null, 'parent_id' => null, 'version_type' => null, - 'backlog_id' => null, - 'board_id' => null, - 'epic_id' => null, - 'flow_id' => null, - 'milestone_id' => null, - 'note_id' => null, - 'project_id' => null, - 'release_id' => null, - 'roadmap_id' => null, - 'source_id' => null, - 'sprint_id' => null, - 'tag_id' => null, - 'team_id' => null, - 'ticket_id' => null, + 'matrix_id' => null, 'created_at' => null, 'updated_at' => null, 'deleted_at' => null, - 'start_at' => null, - 'planned_start_at' => null, - 'end_at' => null, - 'planned_end_at' => null, - 'canceled_at' => null, - 'closed_at' => null, - 'embargo_at' => null, - 'fixed_at' => null, - 'postponed_at' => null, - 'published_at' => null, - 'released_at' => null, - 'resolved_at' => null, - 'resumed_at' => null, - 'suspended_at' => null, 'gids' => 0, 'po' => 0, 'pg' => 0, @@ -69,7 +130,7 @@ class Version extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -81,22 +142,10 @@ class Version extends Model 'latitude' => null, 'longitude' => null, 'active' => true, - 'canceled' => false, - 'closed' => false, - 'completed' => false, - 'duplicate' => false, - 'fixed' => false, 'flagged' => false, 'internal' => false, 'locked' => false, - 'pending' => false, - 'planned' => false, - 'problem' => false, - 'published' => false, - 'released' => false, 'retired' => false, - 'resolved' => false, - 'suspended' => false, 'unknown' => false, 'label' => '', 'title' => '', @@ -112,13 +161,9 @@ class Version extends Model 'avatar' => '', 'ui' => '{}', 'assets' => '{}', - 'backlog' => '{}', - 'board' => '{}', - 'flow' => '{}', 'meta' => '{}', 'notes' => '[]', 'options' => '{}', - 'roadmap' => '{}', 'sources' => '{}', ]; @@ -131,34 +176,7 @@ class Version extends Model 'owned_by_id', 'parent_id', 'version_type', - 'backlog_id', - 'board_id', - 'epic_id', - 'flow_id', - 'milestone_id', - 'note_id', - 'project_id', - 'release_id', - 'roadmap_id', - 'source_id', - 'sprint_id', - 'tag_id', - 'team_id', - 'ticket_id', - 'start_at', - 'planned_start_at', - 'end_at', - 'planned_end_at', - 'canceled_at', - 'closed_at', - 'embargo_at', - 'fixed_at', - 'postponed_at', - 'published_at', - 'released_at', - 'resumed_at', - 'resolved_at', - 'suspended_at', + 'matrix_id', 'gids', 'po', 'pg', @@ -182,22 +200,10 @@ class Version extends Model 'latitude', 'longitude', 'active', - 'canceled', - 'closed', - 'completed', - 'duplicate', - 'fixed', 'flagged', 'internal', 'locked', - 'pending', - 'planned', - 'problem', - 'published', - 'released', 'retired', - 'resolved', - 'suspended', 'unknown', 'label', 'title', @@ -213,13 +219,8 @@ class Version extends Model 'avatar', 'ui', 'assets', - 'backlog', - 'board', - 'flow', 'meta', - 'notes', 'options', - 'roadmap', 'sources', ]; @@ -235,20 +236,6 @@ protected function casts(): array 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', - 'start_at' => 'datetime', - 'planned_start_at' => 'datetime', - 'end_at' => 'datetime', - 'planned_end_at' => 'datetime', - 'canceled_at' => 'datetime', - 'closed_at' => 'datetime', - 'embargo_at' => 'datetime', - 'fixed_at' => 'datetime', - 'postponed_at' => 'datetime', - 'published_at' => 'datetime', - 'released_at' => 'datetime', - 'resumed_at' => 'datetime', - 'resolved_at' => 'datetime', - 'suspended_at' => 'datetime', 'gids' => 'integer', 'po' => 'integer', 'pg' => 'integer', @@ -260,7 +247,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -272,22 +259,10 @@ protected function casts(): array 'latitude' => 'float', 'longitude' => 'float', 'active' => 'boolean', - 'canceled' => 'boolean', - 'closed' => 'boolean', - 'completed' => 'boolean', - 'duplicate' => 'boolean', - 'fixed' => 'boolean', 'flagged' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', - 'pending' => 'boolean', - 'planned' => 'boolean', - 'problem' => 'boolean', - 'published' => 'boolean', - 'released' => 'boolean', 'retired' => 'boolean', - 'resolved' => 'boolean', - 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', 'title' => 'string', @@ -303,74 +278,22 @@ protected function casts(): array 'avatar' => 'string', 'ui' => 'array', 'assets' => 'array', - 'backlog' => 'array', - 'board' => 'array', - 'flow' => 'array', 'meta' => 'array', 'notes' => 'array', 'options' => 'array', - 'roadmap' => 'array', 'sources' => 'array', ]; } /** - * The backlog of the version. - */ - public function backlog(): HasOne - { - return $this->hasOne( - Backlog::class, - 'id', - 'backlog_id' - ); - } - - /** - * The board of the version. - */ - public function board(): HasOne - { - return $this->hasOne( - Board::class, - 'id', - 'board_id' - ); - } - - /** - * The epic of the version. - */ - public function epic(): HasOne - { - return $this->hasOne( - Epic::class, - 'id', - 'epic_id' - ); - } - - /** - * The flow of the version. + * The matrix of the version. */ - public function flow(): HasOne + public function matrix(): HasOne { return $this->hasOne( - Flow::class, + Matrix::class, 'id', - 'flow_id' - ); - } - - /** - * The milestone of the version. - */ - public function milestone(): HasOne - { - return $this->hasOne( - Milestone::class, - 'id', - 'milestone_id' + 'matrix_id' ); } @@ -386,18 +309,6 @@ public function project(): HasOne ); } - /** - * The release of the version. - */ - public function release(): HasOne - { - return $this->hasOne( - Release::class, - 'id', - 'release_id' - ); - } - /** * The roadmap of the version. */ @@ -422,18 +333,6 @@ public function source(): HasOne ); } - /** - * The sprint of the version. - */ - public function sprint(): HasOne - { - return $this->hasOne( - Sprint::class, - 'id', - 'sprint_id' - ); - } - /** * The tag of the version. */ diff --git a/tests/Feature/Models/Backlog/ModelTest.php b/tests/Feature/Models/Backlog/ModelTest.php index 5211a2a..ddaccc3 100644 --- a/tests/Feature/Models/Backlog/ModelTest.php +++ b/tests/Feature/Models/Backlog/ModelTest.php @@ -1,9 +1,9 @@ 'create', 'modelClass' => \Playground\Matrix\Models\Flow::class, ], + 'matrix' => [ + 'key' => 'matrix_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Matrix::class, + ], 'milestone' => [ 'key' => 'milestone_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Source/ModelTest.php b/tests/Feature/Models/Source/ModelTest.php index 5edee88..5c429e7 100644 --- a/tests/Feature/Models/Source/ModelTest.php +++ b/tests/Feature/Models/Source/ModelTest.php @@ -1,9 +1,9 @@ 'create', 'modelClass' => \Playground\Matrix\Models\Source::class, ], - 'backlog' => [ - 'key' => 'backlog_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Backlog::class, - ], - 'board' => [ - 'key' => 'board_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Board::class, - ], - 'epic' => [ - 'key' => 'epic_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Epic::class, - ], - 'flow' => [ - 'key' => 'flow_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Flow::class, - ], - 'milestone' => [ - 'key' => 'milestone_id', + 'matrix' => [ + 'key' => 'matrix_id', 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Milestone::class, - ], - 'project' => [ - 'key' => 'project_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Project::class, - ], - 'release' => [ - 'key' => 'release_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Release::class, - ], - 'roadmap' => [ - 'key' => 'roadmap_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Roadmap::class, - ], - 'sprint' => [ - 'key' => 'sprint_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Sprint::class, + 'modelClass' => \Playground\Matrix\Models\Matrix::class, ], 'tag' => [ 'key' => 'tag_id', @@ -93,15 +53,5 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Team::class, ], - 'ticket' => [ - 'key' => 'ticket_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Ticket::class, - ], - 'version' => [ - 'key' => 'version_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Version::class, - ], ]; } diff --git a/tests/Feature/Models/Sprint/ModelTest.php b/tests/Feature/Models/Sprint/ModelTest.php index 2f88b6e..f2c15a5 100644 --- a/tests/Feature/Models/Sprint/ModelTest.php +++ b/tests/Feature/Models/Sprint/ModelTest.php @@ -1,9 +1,9 @@ 'create', 'modelClass' => \Playground\Matrix\Models\Tag::class, ], - 'backlog' => [ - 'key' => 'backlog_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Backlog::class, - ], - 'board' => [ - 'key' => 'board_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Board::class, - ], - 'epic' => [ - 'key' => 'epic_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Epic::class, - ], - 'flow' => [ - 'key' => 'flow_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Flow::class, - ], - 'milestone' => [ - 'key' => 'milestone_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Milestone::class, - ], - 'project' => [ - 'key' => 'project_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Project::class, - ], - 'release' => [ - 'key' => 'release_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Release::class, - ], - 'roadmap' => [ - 'key' => 'roadmap_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Roadmap::class, - ], - 'source' => [ - 'key' => 'source_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Source::class, - ], - 'sprint' => [ - 'key' => 'sprint_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Sprint::class, - ], - 'team' => [ - 'key' => 'team_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Team::class, - ], - 'ticket' => [ - 'key' => 'ticket_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Ticket::class, - ], - 'version' => [ - 'key' => 'version_id', + 'matrix' => [ + 'key' => 'matrix_id', 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Version::class, + 'modelClass' => \Playground\Matrix\Models\Matrix::class, ], ]; } diff --git a/tests/Feature/Models/Team/ModelTest.php b/tests/Feature/Models/Team/ModelTest.php index dd8d447..5b789dc 100644 --- a/tests/Feature/Models/Team/ModelTest.php +++ b/tests/Feature/Models/Team/ModelTest.php @@ -1,9 +1,9 @@ Date: Sun, 28 Apr 2024 10:55:36 -0700 Subject: [PATCH 10/18] GH-19 --- database/factories/MatrixFactory.php | 4 +- database/factories/ProjectFactory.php | 4 +- database/factories/TeamFactory.php | 4 +- ...02_100001_create_matrix_matrices_table.php | 52 +++--- ...01_02_100001_create_matrix_teams_table.php | 56 +++---- src/Models/Matrix.php | 114 ++++++++++++- src/Models/Team.php | 158 ++++++++++++++---- tests/Feature/Models/Matrix/ModelTest.php | 5 + tests/Feature/Models/Team/ModelTest.php | 10 ++ tests/Feature/Models/Version/ModelTest.php | 36 +--- tests/Unit/Models/Matrix/ModelTest.php | 1 + tests/Unit/Models/Team/ModelTest.php | 2 + tests/Unit/Models/Version/ModelTest.php | 8 +- 13 files changed, 316 insertions(+), 138 deletions(-) diff --git a/database/factories/MatrixFactory.php b/database/factories/MatrixFactory.php index 5f7cad5..cf46da7 100644 --- a/database/factories/MatrixFactory.php +++ b/database/factories/MatrixFactory.php @@ -1,9 +1,9 @@ uuid('id')->primary(); @@ -27,9 +31,9 @@ public function up(): void $table->uuid('created_by_id')->nullable()->index(); $table->uuid('modified_by_id')->nullable()->index(); $table->uuid('owned_by_id')->nullable()->index(); - $table->uuid('matrix_id')->nullable()->index(); $table->uuid('parent_id')->nullable()->index(); $table->string('matrix_type')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); // Dates @@ -43,6 +47,8 @@ public function up(): void $table->dateTime('planned_end_at')->nullable(); $table->dateTime('canceled_at')->nullable(); $table->dateTime('closed_at')->nullable()->index(); + $table->dateTime('embargo_at')->nullable(); + $table->dateTime('postponed_at')->nullable(); $table->dateTime('resumed_at')->nullable(); $table->dateTime('suspended_at')->nullable(); @@ -69,19 +75,21 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags $table->boolean('active')->default(1)->index(); $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); + $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); $table->boolean('locked')->default(0); @@ -92,23 +100,23 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations/2020_01_02_100001_create_matrix_teams_table.php b/database/migrations/2020_01_02_100001_create_matrix_teams_table.php index 95682ce..7fe3c62 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_teams_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_teams_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -58,12 +62,8 @@ 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('resumed_at')->nullable(); - $table->dateTime('resolved_at')->nullable()->index(); $table->dateTime('suspended_at')->nullable(); // Permissions @@ -89,13 +89,13 @@ public function up(): void $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); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -103,38 +103,34 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); - $table->boolean('fixed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); $table->boolean('locked')->default(0); $table->boolean('pending')->default(0); $table->boolean('planned')->default(0); $table->boolean('problem')->default(0); - $table->boolean('published')->default(0); - $table->boolean('released')->default(0); $table->boolean('retired')->default(0); - $table->boolean('resolved')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/src/Models/Matrix.php b/src/Models/Matrix.php index a29d371..dc17bbe 100644 --- a/src/Models/Matrix.php +++ b/src/Models/Matrix.php @@ -1,15 +1,91 @@ null, 'parent_id' => null, 'matrix_type' => null, + 'matrix_id' => null, 'created_at' => null, 'updated_at' => null, 'deleted_at' => null, @@ -35,6 +112,8 @@ class Matrix extends Model 'planned_end_at' => null, 'canceled_at' => null, 'closed_at' => null, + 'embargo_at' => null, + 'postponed_at' => null, 'resumed_at' => null, 'suspended_at' => null, 'gids' => 0, @@ -48,7 +127,7 @@ class Matrix extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -62,6 +141,8 @@ class Matrix extends Model 'active' => true, 'canceled' => false, 'closed' => false, + 'completed' => false, + 'cron' => false, 'flagged' => false, 'internal' => false, 'locked' => false, @@ -100,12 +181,15 @@ class Matrix extends Model 'owned_by_id', 'parent_id', 'matrix_type', + 'matrix_id', 'start_at', 'planned_start_at', 'end_at', 'planned_end_at', 'canceled_at', 'closed_at', + 'embargo_at', + 'postponed_at', 'resumed_at', 'suspended_at', 'gids', @@ -133,6 +217,8 @@ class Matrix extends Model 'active', 'canceled', 'closed', + 'completed', + 'cron', 'flagged', 'internal', 'locked', @@ -157,7 +243,6 @@ class Matrix extends Model 'ui', 'assets', 'meta', - 'notes', 'options', 'sources', ]; @@ -180,6 +265,8 @@ protected function casts(): array 'planned_end_at' => 'datetime', 'canceled_at' => 'datetime', 'closed_at' => 'datetime', + 'embargo_at' => 'datetime', + 'postponed_at' => 'datetime', 'resumed_at' => 'datetime', 'suspended_at' => 'datetime', 'gids' => 'integer', @@ -193,7 +280,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -207,6 +294,8 @@ protected function casts(): array 'active' => 'boolean', 'canceled' => 'boolean', 'closed' => 'boolean', + 'completed' => 'boolean', + 'cron' => 'boolean', 'flagged' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', @@ -230,9 +319,6 @@ protected function casts(): array 'avatar' => 'string', 'ui' => 'array', 'assets' => 'array', - 'backlog' => 'array', - 'board' => 'array', - 'flow' => 'array', 'meta' => 'array', 'notes' => 'array', 'options' => 'array', @@ -240,4 +326,16 @@ protected function casts(): array 'sources' => 'array', ]; } + + /** + * The matrix of the matrix. + */ + public function matrix(): HasOne + { + return $this->hasOne( + Matrix::class, + 'id', + 'matrix_id' + ); + } } diff --git a/src/Models/Team.php b/src/Models/Team.php index a64abe3..b110617 100644 --- a/src/Models/Team.php +++ b/src/Models/Team.php @@ -1,9 +1,9 @@ null, 'epic_id' => null, 'flow_id' => null, + 'matrix_id' => null, 'milestone_id' => null, 'note_id' => null, 'project_id' => null, @@ -51,11 +145,7 @@ class Team extends Model 'canceled_at' => null, 'closed_at' => null, 'embargo_at' => null, - 'fixed_at' => null, 'postponed_at' => null, - 'published_at' => null, - 'released_at' => null, - 'resolved_at' => null, 'resumed_at' => null, 'suspended_at' => null, 'gids' => 0, @@ -69,7 +159,7 @@ class Team extends Model 'status' => 0, 'rank' => 0, 'size' => 0, - 'matrix' => '', + 'matrix' => '{}', 'x' => null, 'y' => null, 'z' => null, @@ -84,18 +174,14 @@ class Team extends Model 'canceled' => false, 'closed' => false, 'completed' => false, - 'duplicate' => false, - 'fixed' => false, + 'cron' => false, 'flagged' => false, 'internal' => false, 'locked' => false, 'pending' => false, 'planned' => false, 'problem' => false, - 'published' => false, - 'released' => false, 'retired' => false, - 'resolved' => false, 'suspended' => false, 'unknown' => false, 'label' => '', @@ -135,6 +221,7 @@ class Team extends Model 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', @@ -152,12 +239,8 @@ class Team extends Model 'canceled_at', 'closed_at', 'embargo_at', - 'fixed_at', 'postponed_at', - 'published_at', - 'released_at', 'resumed_at', - 'resolved_at', 'suspended_at', 'gids', 'po', @@ -185,18 +268,14 @@ class Team extends Model 'canceled', 'closed', 'completed', - 'duplicate', - 'fixed', + 'cron', 'flagged', 'internal', 'locked', 'pending', 'planned', 'problem', - 'published', - 'released', 'retired', - 'resolved', 'suspended', 'unknown', 'label', @@ -217,7 +296,6 @@ class Team extends Model 'board', 'flow', 'meta', - 'notes', 'options', 'roadmap', 'sources', @@ -242,12 +320,8 @@ protected function casts(): array 'canceled_at' => 'datetime', 'closed_at' => 'datetime', 'embargo_at' => 'datetime', - 'fixed_at' => 'datetime', 'postponed_at' => 'datetime', - 'published_at' => 'datetime', - 'released_at' => 'datetime', 'resumed_at' => 'datetime', - 'resolved_at' => 'datetime', 'suspended_at' => 'datetime', 'gids' => 'integer', 'po' => 'integer', @@ -260,7 +334,7 @@ protected function casts(): array 'status' => 'integer', 'rank' => 'integer', 'size' => 'integer', - 'matrix' => 'string', + 'matrix' => 'array', 'x' => 'integer', 'y' => 'integer', 'z' => 'integer', @@ -275,18 +349,14 @@ protected function casts(): array 'canceled' => 'boolean', 'closed' => 'boolean', 'completed' => 'boolean', - 'duplicate' => 'boolean', - 'fixed' => 'boolean', + 'cron' => 'boolean', 'flagged' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', 'pending' => 'boolean', 'planned' => 'boolean', 'problem' => 'boolean', - 'published' => 'boolean', - 'released' => 'boolean', 'retired' => 'boolean', - 'resolved' => 'boolean', 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', @@ -362,6 +432,18 @@ public function flow(): HasOne ); } + /** + * The matrix of the team. + */ + public function matrix(): HasOne + { + return $this->hasOne( + Matrix::class, + 'id', + 'matrix_id' + ); + } + /** * The milestone of the team. */ @@ -374,6 +456,18 @@ public function milestone(): HasOne ); } + /** + * The note of the team. + */ + public function note(): HasOne + { + return $this->hasOne( + Note::class, + 'id', + 'note_id' + ); + } + /** * The project of the team. */ diff --git a/tests/Feature/Models/Matrix/ModelTest.php b/tests/Feature/Models/Matrix/ModelTest.php index 5a3fa6b..f848fbb 100644 --- a/tests/Feature/Models/Matrix/ModelTest.php +++ b/tests/Feature/Models/Matrix/ModelTest.php @@ -38,5 +38,10 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Matrix::class, ], + 'matrix' => [ + 'key' => 'matrix_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Matrix::class, + ], ]; } diff --git a/tests/Feature/Models/Team/ModelTest.php b/tests/Feature/Models/Team/ModelTest.php index 5b789dc..8f0f1d9 100644 --- a/tests/Feature/Models/Team/ModelTest.php +++ b/tests/Feature/Models/Team/ModelTest.php @@ -58,11 +58,21 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Flow::class, ], + 'matrix' => [ + 'key' => 'matrix_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Matrix::class, + ], 'milestone' => [ 'key' => 'milestone_id', 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Milestone::class, ], + 'note' => [ + 'key' => 'note_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Note::class, + ], 'project' => [ 'key' => 'project_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Version/ModelTest.php b/tests/Feature/Models/Version/ModelTest.php index cdc93af..e6f26fd 100644 --- a/tests/Feature/Models/Version/ModelTest.php +++ b/tests/Feature/Models/Version/ModelTest.php @@ -38,41 +38,16 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Version::class, ], - 'backlog' => [ - 'key' => 'backlog_id', + 'matrix' => [ + 'key' => 'matrix_id', 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Backlog::class, - ], - 'board' => [ - 'key' => 'board_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Board::class, - ], - 'epic' => [ - 'key' => 'epic_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Epic::class, - ], - 'flow' => [ - 'key' => 'flow_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Flow::class, - ], - 'milestone' => [ - 'key' => 'milestone_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Milestone::class, + 'modelClass' => \Playground\Matrix\Models\Matrix::class, ], 'project' => [ 'key' => 'project_id', 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Project::class, ], - 'release' => [ - 'key' => 'release_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Release::class, - ], 'roadmap' => [ 'key' => 'roadmap_id', 'rule' => 'create', @@ -83,11 +58,6 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Source::class, ], - 'sprint' => [ - 'key' => 'sprint_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Sprint::class, - ], 'tag' => [ 'key' => 'tag_id', 'rule' => 'create', diff --git a/tests/Unit/Models/Matrix/ModelTest.php b/tests/Unit/Models/Matrix/ModelTest.php index 80a1679..d4f9d4b 100644 --- a/tests/Unit/Models/Matrix/ModelTest.php +++ b/tests/Unit/Models/Matrix/ModelTest.php @@ -22,5 +22,6 @@ class ModelTest extends ModelCase 'modifier', 'owner', 'parent', + 'matrix', ]; } diff --git a/tests/Unit/Models/Team/ModelTest.php b/tests/Unit/Models/Team/ModelTest.php index 2f3cd26..e56f1c0 100644 --- a/tests/Unit/Models/Team/ModelTest.php +++ b/tests/Unit/Models/Team/ModelTest.php @@ -26,7 +26,9 @@ class ModelTest extends ModelCase 'board', 'epic', 'flow', + 'matrix', 'milestone', + 'note', 'project', 'release', 'roadmap', diff --git a/tests/Unit/Models/Version/ModelTest.php b/tests/Unit/Models/Version/ModelTest.php index 7982e2e..2a6544e 100644 --- a/tests/Unit/Models/Version/ModelTest.php +++ b/tests/Unit/Models/Version/ModelTest.php @@ -22,16 +22,10 @@ class ModelTest extends ModelCase 'modifier', 'owner', 'parent', - 'backlog', - 'board', - 'epic', - 'flow', - 'milestone', + 'matrix', 'project', - 'release', 'roadmap', 'source', - 'sprint', 'tag', 'team', 'ticket', From 5e4f0e95b6941911495db0eaf7a5eafe248147bd Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Sun, 28 Apr 2024 11:29:58 -0700 Subject: [PATCH 11/18] GH-19 --- src/Models/Board.php | 12 ++++++++++++ src/Models/Epic.php | 12 ++++++++++++ src/Models/Milestone.php | 12 ++++++++++++ src/Models/Project.php | 12 ++++++++++++ src/Models/Release.php | 12 ++++++++++++ src/Models/Roadmap.php | 12 ++++++++++++ src/Models/Sprint.php | 14 +++++++++++++- src/Models/Ticket.php | 14 +++++++++++++- tests/Feature/Models/Board/ModelTest.php | 5 +++++ tests/Feature/Models/Epic/ModelTest.php | 5 +++++ tests/Feature/Models/Milestone/ModelTest.php | 5 +++++ tests/Feature/Models/Project/ModelTest.php | 5 +++++ tests/Feature/Models/Release/ModelTest.php | 5 +++++ tests/Feature/Models/Roadmap/ModelTest.php | 5 +++++ tests/Feature/Models/Sprint/ModelTest.php | 5 +++++ tests/Feature/Models/Ticket/ModelTest.php | 5 +++++ tests/Unit/Models/Board/ModelTest.php | 1 + tests/Unit/Models/Epic/ModelTest.php | 1 + tests/Unit/Models/Milestone/ModelTest.php | 1 + tests/Unit/Models/Project/ModelTest.php | 1 + tests/Unit/Models/Release/ModelTest.php | 1 + tests/Unit/Models/Roadmap/ModelTest.php | 1 + tests/Unit/Models/Sprint/ModelTest.php | 1 + tests/Unit/Models/Ticket/ModelTest.php | 1 + 24 files changed, 146 insertions(+), 2 deletions(-) diff --git a/src/Models/Board.php b/src/Models/Board.php index d984637..60a3568 100644 --- a/src/Models/Board.php +++ b/src/Models/Board.php @@ -480,6 +480,18 @@ public function milestone(): HasOne ); } + /** + * The note of the board. + */ + public function note(): HasOne + { + return $this->hasOne( + Note::class, + 'id', + 'note_id' + ); + } + /** * The project of the board. */ diff --git a/src/Models/Epic.php b/src/Models/Epic.php index fd7bbfe..e73a50b 100644 --- a/src/Models/Epic.php +++ b/src/Models/Epic.php @@ -480,6 +480,18 @@ public function milestone(): HasOne ); } + /** + * The note of the epic. + */ + public function note(): HasOne + { + return $this->hasOne( + Note::class, + 'id', + 'note_id' + ); + } + /** * The project of the epic. */ diff --git a/src/Models/Milestone.php b/src/Models/Milestone.php index 38e6f07..d94a395 100644 --- a/src/Models/Milestone.php +++ b/src/Models/Milestone.php @@ -474,6 +474,18 @@ public function matrix(): HasOne ); } + /** + * The note of the milestone. + */ + public function note(): HasOne + { + return $this->hasOne( + Note::class, + 'id', + 'note_id' + ); + } + /** * The project of the milestone. */ diff --git a/src/Models/Project.php b/src/Models/Project.php index 22f8125..cb5f63e 100644 --- a/src/Models/Project.php +++ b/src/Models/Project.php @@ -482,6 +482,18 @@ public function milestone(): HasOne ); } + /** + * The note of the project. + */ + public function note(): HasOne + { + return $this->hasOne( + Note::class, + 'id', + 'note_id' + ); + } + /** * The release of the project. */ diff --git a/src/Models/Release.php b/src/Models/Release.php index f142a94..591833b 100644 --- a/src/Models/Release.php +++ b/src/Models/Release.php @@ -468,6 +468,18 @@ public function milestone(): HasOne ); } + /** + * The note of the release. + */ + public function note(): HasOne + { + return $this->hasOne( + Note::class, + 'id', + 'note_id' + ); + } + /** * The project of the release. */ diff --git a/src/Models/Roadmap.php b/src/Models/Roadmap.php index 2c96974..76bd300 100644 --- a/src/Models/Roadmap.php +++ b/src/Models/Roadmap.php @@ -469,6 +469,18 @@ public function milestone(): HasOne ); } + /** + * The note of the roadmap. + */ + public function note(): HasOne + { + return $this->hasOne( + Note::class, + 'id', + 'note_id' + ); + } + /** * The project of the roadmap. */ diff --git a/src/Models/Sprint.php b/src/Models/Sprint.php index 92bc958..a661c0b 100644 --- a/src/Models/Sprint.php +++ b/src/Models/Sprint.php @@ -469,7 +469,7 @@ public function flow(): HasOne } /** - * The matrix of the board. + * The matrix of the sprint. */ public function matrix(): HasOne { @@ -480,6 +480,18 @@ public function matrix(): HasOne ); } + /** + * The note of the sprint. + */ + public function note(): HasOne + { + return $this->hasOne( + Note::class, + 'id', + 'note_id' + ); + } + /** * The milestone of the sprint. */ diff --git a/src/Models/Ticket.php b/src/Models/Ticket.php index 7f7b1e1..3624809 100644 --- a/src/Models/Ticket.php +++ b/src/Models/Ticket.php @@ -472,8 +472,8 @@ protected function casts(): array 'introduction' => 'string', 'content' => 'string', 'summary' => 'string', - 'key' => 'string', 'handler' => 'string', + 'key' => 'string', 'code' => 'integer', 'key_code_hash' => 'string', 'priority' => 'string', @@ -612,6 +612,18 @@ public function milestone(): HasOne ); } + /** + * The note of the ticket. + */ + public function note(): HasOne + { + return $this->hasOne( + Note::class, + 'id', + 'note_id' + ); + } + /** * The project of the ticket. */ diff --git a/tests/Feature/Models/Board/ModelTest.php b/tests/Feature/Models/Board/ModelTest.php index 143c578..e1a7618 100644 --- a/tests/Feature/Models/Board/ModelTest.php +++ b/tests/Feature/Models/Board/ModelTest.php @@ -63,6 +63,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Milestone::class, ], + 'note' => [ + 'key' => 'note_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Note::class, + ], 'project' => [ 'key' => 'project_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Epic/ModelTest.php b/tests/Feature/Models/Epic/ModelTest.php index 7dfee11..4d3346c 100644 --- a/tests/Feature/Models/Epic/ModelTest.php +++ b/tests/Feature/Models/Epic/ModelTest.php @@ -63,6 +63,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Milestone::class, ], + 'note' => [ + 'key' => 'note_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Note::class, + ], 'project' => [ 'key' => 'project_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Milestone/ModelTest.php b/tests/Feature/Models/Milestone/ModelTest.php index c178c4b..9bd333b 100644 --- a/tests/Feature/Models/Milestone/ModelTest.php +++ b/tests/Feature/Models/Milestone/ModelTest.php @@ -63,6 +63,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Matrix::class, ], + 'note' => [ + 'key' => 'note_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Note::class, + ], 'project' => [ 'key' => 'project_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Project/ModelTest.php b/tests/Feature/Models/Project/ModelTest.php index c8dbbfb..f83eeec 100644 --- a/tests/Feature/Models/Project/ModelTest.php +++ b/tests/Feature/Models/Project/ModelTest.php @@ -63,6 +63,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Matrix::class, ], + 'note' => [ + 'key' => 'note_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Note::class, + ], 'milestone' => [ 'key' => 'milestone_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Release/ModelTest.php b/tests/Feature/Models/Release/ModelTest.php index a8c98a0..5485f4d 100644 --- a/tests/Feature/Models/Release/ModelTest.php +++ b/tests/Feature/Models/Release/ModelTest.php @@ -68,6 +68,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Milestone::class, ], + 'note' => [ + 'key' => 'note_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Note::class, + ], 'project' => [ 'key' => 'project_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Roadmap/ModelTest.php b/tests/Feature/Models/Roadmap/ModelTest.php index 10c7ae0..60532e8 100644 --- a/tests/Feature/Models/Roadmap/ModelTest.php +++ b/tests/Feature/Models/Roadmap/ModelTest.php @@ -68,6 +68,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Milestone::class, ], + 'note' => [ + 'key' => 'note_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Note::class, + ], 'project' => [ 'key' => 'project_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Sprint/ModelTest.php b/tests/Feature/Models/Sprint/ModelTest.php index f2c15a5..55eebb4 100644 --- a/tests/Feature/Models/Sprint/ModelTest.php +++ b/tests/Feature/Models/Sprint/ModelTest.php @@ -63,6 +63,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Matrix::class, ], + 'note' => [ + 'key' => 'note_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Note::class, + ], 'milestone' => [ 'key' => 'milestone_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Ticket/ModelTest.php b/tests/Feature/Models/Ticket/ModelTest.php index aa658a6..5d5feac 100644 --- a/tests/Feature/Models/Ticket/ModelTest.php +++ b/tests/Feature/Models/Ticket/ModelTest.php @@ -78,6 +78,11 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Milestone::class, ], + 'note' => [ + 'key' => 'note_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Note::class, + ], 'project' => [ 'key' => 'project_id', 'rule' => 'create', diff --git a/tests/Unit/Models/Board/ModelTest.php b/tests/Unit/Models/Board/ModelTest.php index 7fc2788..1146972 100644 --- a/tests/Unit/Models/Board/ModelTest.php +++ b/tests/Unit/Models/Board/ModelTest.php @@ -27,6 +27,7 @@ class ModelTest extends ModelCase 'flow', 'matrix', 'milestone', + 'note', 'project', 'release', 'roadmap', diff --git a/tests/Unit/Models/Epic/ModelTest.php b/tests/Unit/Models/Epic/ModelTest.php index 44721a9..110c202 100644 --- a/tests/Unit/Models/Epic/ModelTest.php +++ b/tests/Unit/Models/Epic/ModelTest.php @@ -27,6 +27,7 @@ class ModelTest extends ModelCase 'flow', 'matrix', 'milestone', + 'note', 'project', 'release', 'roadmap', diff --git a/tests/Unit/Models/Milestone/ModelTest.php b/tests/Unit/Models/Milestone/ModelTest.php index ebbd548..8f63584 100644 --- a/tests/Unit/Models/Milestone/ModelTest.php +++ b/tests/Unit/Models/Milestone/ModelTest.php @@ -27,6 +27,7 @@ class ModelTest extends ModelCase 'epic', 'flow', 'matrix', + 'note', 'project', 'release', 'roadmap', diff --git a/tests/Unit/Models/Project/ModelTest.php b/tests/Unit/Models/Project/ModelTest.php index da62875..9490866 100644 --- a/tests/Unit/Models/Project/ModelTest.php +++ b/tests/Unit/Models/Project/ModelTest.php @@ -28,6 +28,7 @@ class ModelTest extends ModelCase 'flow', 'matrix', 'milestone', + 'note', 'release', 'roadmap', 'source', diff --git a/tests/Unit/Models/Release/ModelTest.php b/tests/Unit/Models/Release/ModelTest.php index ecf8524..eeac6cc 100644 --- a/tests/Unit/Models/Release/ModelTest.php +++ b/tests/Unit/Models/Release/ModelTest.php @@ -28,6 +28,7 @@ class ModelTest extends ModelCase 'flow', 'matrix', 'milestone', + 'note', 'project', 'roadmap', 'source', diff --git a/tests/Unit/Models/Roadmap/ModelTest.php b/tests/Unit/Models/Roadmap/ModelTest.php index c2549a3..51a7c77 100644 --- a/tests/Unit/Models/Roadmap/ModelTest.php +++ b/tests/Unit/Models/Roadmap/ModelTest.php @@ -28,6 +28,7 @@ class ModelTest extends ModelCase 'flow', 'matrix', 'milestone', + 'note', 'project', 'release', 'source', diff --git a/tests/Unit/Models/Sprint/ModelTest.php b/tests/Unit/Models/Sprint/ModelTest.php index 1fd0594..9ce389d 100644 --- a/tests/Unit/Models/Sprint/ModelTest.php +++ b/tests/Unit/Models/Sprint/ModelTest.php @@ -28,6 +28,7 @@ class ModelTest extends ModelCase 'flow', 'matrix', 'milestone', + 'note', 'project', 'release', 'roadmap', diff --git a/tests/Unit/Models/Ticket/ModelTest.php b/tests/Unit/Models/Ticket/ModelTest.php index f2667f6..60049f3 100644 --- a/tests/Unit/Models/Ticket/ModelTest.php +++ b/tests/Unit/Models/Ticket/ModelTest.php @@ -30,6 +30,7 @@ class ModelTest extends ModelCase 'flow', 'matrix', 'milestone', + 'note', 'project', 'release', 'reportedBy', From dfeedd80668b043642913649c0446e1fe164f3d4 Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Mon, 29 Apr 2024 21:20:28 -0700 Subject: [PATCH 12/18] GH-19 --- src/Models/Milestone.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Models/Milestone.php b/src/Models/Milestone.php index d94a395..cd55dc5 100644 --- a/src/Models/Milestone.php +++ b/src/Models/Milestone.php @@ -154,9 +154,11 @@ class Milestone extends Model 'canceled_at' => null, 'closed_at' => null, 'embargo_at' => null, + 'fixed_at' => null, 'postponed_at' => null, 'published_at' => null, 'released_at' => null, + 'resolved_at' => null, 'resumed_at' => null, 'suspended_at' => null, 'gids' => 0, @@ -255,9 +257,11 @@ class Milestone extends Model 'canceled_at', 'closed_at', 'embargo_at', + 'fixed_at', 'postponed_at', 'published_at', 'released_at', + 'resolved_at', 'resumed_at', 'suspended_at', 'gids', @@ -342,10 +346,12 @@ protected function casts(): array 'planned_end_at' => 'datetime', 'canceled_at' => 'datetime', 'closed_at' => 'datetime', + 'fixed_at' => 'datetime', 'embargo_at' => 'datetime', 'postponed_at' => 'datetime', 'published_at' => 'datetime', 'released_at' => 'datetime', + 'resolved_at' => 'datetime', 'resumed_at' => 'datetime', 'suspended_at' => 'datetime', 'gids' => 'integer', From 126fc5d80062029e301259665c5f003c82fcc4c5 Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Mon, 29 Apr 2024 21:53:43 -0700 Subject: [PATCH 13/18] GH-19 --- ..._01_02_100001_create_matrix_projects_table.php | 1 - src/Models/Project.php | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/database/migrations/2020_01_02_100001_create_matrix_projects_table.php b/database/migrations/2020_01_02_100001_create_matrix_projects_table.php index ed6b18e..777ce3b 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_projects_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_projects_table.php @@ -107,7 +107,6 @@ public function up(): void $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); $table->boolean('cron')->default(0)->index(); - $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); diff --git a/src/Models/Project.php b/src/Models/Project.php index cb5f63e..4765092 100644 --- a/src/Models/Project.php +++ b/src/Models/Project.php @@ -76,7 +76,6 @@ * @property bool $closed * @property bool $completed * @property bool $cron - * @property bool $duplicate * @property bool $fixed * @property bool $flagged * @property bool $internal @@ -159,6 +158,7 @@ class Project extends Model 'postponed_at' => null, 'published_at' => null, 'released_at' => null, + 'resolved_at' => null, 'resumed_at' => null, 'suspended_at' => null, 'gids' => 0, @@ -188,13 +188,17 @@ class Project extends Model 'closed' => false, 'completed' => false, 'cron' => false, + 'fixed' => false, 'flagged' => false, 'internal' => false, 'locked' => false, 'pending' => false, 'planned' => false, 'problem' => false, + 'published' => false, 'released' => false, + 'resolved' => false, + 'retired' => false, 'suspended' => false, 'unknown' => false, 'label' => '', @@ -258,6 +262,7 @@ class Project extends Model 'postponed_at', 'published_at', 'released_at', + 'resolved_at', 'resumed_at', 'suspended_at', 'gids', @@ -293,7 +298,10 @@ class Project extends Model 'pending', 'planned', 'problem', + 'published', 'released', + 'resolved', + 'retired', 'suspended', 'unknown', 'label', @@ -344,6 +352,7 @@ protected function casts(): array 'postponed_at' => 'datetime', 'published_at' => 'datetime', 'released_at' => 'datetime', + 'resolved_at' => 'datetime', 'resumed_at' => 'datetime', 'suspended_at' => 'datetime', 'gids' => 'integer', @@ -373,13 +382,17 @@ protected function casts(): array 'closed' => 'boolean', 'completed' => 'boolean', 'cron' => 'boolean', + 'fixed' => 'boolean', 'flagged' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', 'pending' => 'boolean', 'planned' => 'boolean', 'problem' => 'boolean', + 'published' => 'boolean', 'released' => 'boolean', + 'resolved' => 'boolean', + 'retired' => 'boolean', 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', From f7963450f8c5bab839d7e39e156ded2485ca7794 Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Tue, 30 Apr 2024 10:47:33 -0700 Subject: [PATCH 14/18] GH-19 --- ...02_100001_create_matrix_releases_table.php | 5 +++++ ...02_100001_create_matrix_roadmaps_table.php | 1 - ..._02_100001_create_matrix_sources_table.php | 2 +- ..._02_100001_create_matrix_sprints_table.php | 2 +- ..._02_100001_create_matrix_tickets_table.php | 2 +- ...02_100001_create_matrix_versions_table.php | 2 +- src/Models/Release.php | 19 +++++++++++++++++++ src/Models/Roadmap.php | 1 - src/Models/Source.php | 18 ++++++++++++++++++ 9 files changed, 46 insertions(+), 6 deletions(-) diff --git a/database/migrations/2020_01_02_100001_create_matrix_releases_table.php b/database/migrations/2020_01_02_100001_create_matrix_releases_table.php index c47197d..12bc7ec 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_releases_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_releases_table.php @@ -62,9 +62,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(); @@ -106,6 +108,7 @@ public function up(): void $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); $table->boolean('cron')->default(0)->index(); + $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); $table->boolean('locked')->default(0); @@ -114,6 +117,8 @@ public function up(): void $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); + $table->boolean('retired')->default(0); + $table->boolean('resolved')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); diff --git a/database/migrations/2020_01_02_100001_create_matrix_roadmaps_table.php b/database/migrations/2020_01_02_100001_create_matrix_roadmaps_table.php index 62f479a..f4aedb3 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_roadmaps_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_roadmaps_table.php @@ -114,7 +114,6 @@ public function up(): void $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); - $table->boolean('resolved')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); diff --git a/database/migrations/2020_01_02_100001_create_matrix_sources_table.php b/database/migrations/2020_01_02_100001_create_matrix_sources_table.php index f9a54ce..c2282d0 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_sources_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_sources_table.php @@ -106,8 +106,8 @@ public function up(): void $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); - $table->boolean('retired')->default(0); $table->boolean('resolved')->default(0); + $table->boolean('retired')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); diff --git a/database/migrations/2020_01_02_100001_create_matrix_sprints_table.php b/database/migrations/2020_01_02_100001_create_matrix_sprints_table.php index 3936cc0..e365d22 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_sprints_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_sprints_table.php @@ -118,8 +118,8 @@ public function up(): void $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); - $table->boolean('retired')->default(0); $table->boolean('resolved')->default(0); + $table->boolean('retired')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); diff --git a/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php b/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php index 5352dfd..041301e 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_tickets_table.php @@ -124,8 +124,8 @@ public function up(): void $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); - $table->boolean('retired')->default(0); $table->boolean('resolved')->default(0); + $table->boolean('retired')->default(0); $table->boolean('special')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); diff --git a/database/migrations/2020_01_02_100001_create_matrix_versions_table.php b/database/migrations/2020_01_02_100001_create_matrix_versions_table.php index a4637b7..502b576 100644 --- a/database/migrations/2020_01_02_100001_create_matrix_versions_table.php +++ b/database/migrations/2020_01_02_100001_create_matrix_versions_table.php @@ -108,8 +108,8 @@ public function up(): void $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); - $table->boolean('retired')->default(0); $table->boolean('resolved')->default(0); + $table->boolean('retired')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); diff --git a/src/Models/Release.php b/src/Models/Release.php index 591833b..e913522 100644 --- a/src/Models/Release.php +++ b/src/Models/Release.php @@ -43,9 +43,11 @@ * @property ?Carbon $canceled_at * @property ?Carbon $closed_at * @property ?Carbon $embargo_at + * @property ?Carbon $fixed_at * @property ?Carbon $postponed_at * @property ?Carbon $published_at * @property ?Carbon $released_at + * @property ?Carbon $resolved_at * @property ?Carbon $resumed_at * @property ?Carbon $suspended_at * @property int $gids @@ -76,6 +78,7 @@ * @property bool $completed * @property bool $cron * @property bool $flagged + * @property bool $fixed * @property bool $internal * @property bool $locked * @property bool $pending @@ -83,6 +86,8 @@ * @property bool $problem * @property bool $published * @property bool $released + * @property bool $resolved + * @property bool $retired * @property bool $suspended * @property bool $unknown * @property string $label @@ -148,9 +153,11 @@ class Release extends Model 'canceled_at' => null, 'closed_at' => null, 'embargo_at' => null, + 'fixed_at' => null, 'postponed_at' => null, 'published_at' => null, 'released_at' => null, + 'resolved_at' => null, 'resumed_at' => null, 'suspended_at' => null, 'gids' => 0, @@ -181,6 +188,7 @@ class Release extends Model 'completed' => false, 'cron' => false, 'flagged' => false, + 'fixed' => false, 'internal' => false, 'locked' => false, 'pending' => false, @@ -188,6 +196,8 @@ class Release extends Model 'problem' => false, 'published' => false, 'released' => false, + 'resolved' => false, + 'retired' => false, 'suspended' => false, 'unknown' => false, 'label' => '', @@ -245,9 +255,11 @@ class Release extends Model 'canceled_at', 'closed_at', 'embargo_at', + 'fixed_at', 'postponed_at', 'published_at', 'released_at', + 'resolved_at', 'resumed_at', 'suspended_at', 'gids', @@ -278,6 +290,7 @@ class Release extends Model 'completed', 'cron', 'flagged', + 'fixed', 'internal', 'locked', 'pending', @@ -285,6 +298,7 @@ class Release extends Model 'problem', 'published', 'released', + 'retired', 'suspended', 'unknown', 'label', @@ -329,9 +343,11 @@ protected function casts(): array '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', 'gids' => 'integer', @@ -362,6 +378,7 @@ protected function casts(): array 'completed' => 'boolean', 'cron' => 'boolean', 'flagged' => 'boolean', + 'fixed' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', 'pending' => 'boolean', @@ -369,6 +386,8 @@ protected function casts(): array 'problem' => 'boolean', 'published' => 'boolean', 'released' => 'boolean', + 'resolved' => 'boolean', + 'retired' => 'boolean', 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', diff --git a/src/Models/Roadmap.php b/src/Models/Roadmap.php index 76bd300..f0558f1 100644 --- a/src/Models/Roadmap.php +++ b/src/Models/Roadmap.php @@ -83,7 +83,6 @@ * @property bool $problem * @property bool $published * @property bool $released - * @property bool $resolved * @property bool $suspended * @property bool $unknown * @property string $label diff --git a/src/Models/Source.php b/src/Models/Source.php index e8b92c8..d0e85c5 100644 --- a/src/Models/Source.php +++ b/src/Models/Source.php @@ -126,10 +126,12 @@ class Source extends Model 'canceled_at' => null, 'closed_at' => null, 'embargo_at' => null, + 'fixed_at' => null, 'postponed_at' => null, 'published_at' => null, 'released_at' => null, 'resumed_at' => null, + 'resolved_at' => null, 'suspended_at' => null, 'gids' => 0, 'po' => 0, @@ -158,6 +160,8 @@ class Source extends Model 'closed' => false, 'completed' => false, 'cron' => false, + 'duplicate' => false, + 'fixed' => false, 'flagged' => false, 'internal' => false, 'locked' => false, @@ -166,6 +170,8 @@ class Source extends Model 'problem' => false, 'published' => false, 'released' => false, + 'retired' => false, + 'resolved' => false, 'suspended' => false, 'unknown' => false, 'label' => '', @@ -207,10 +213,12 @@ class Source extends Model 'canceled_at', 'closed_at', 'embargo_at', + 'fixed_at', 'postponed_at', 'published_at', 'released_at', 'resumed_at', + 'resolved_at', 'suspended_at', 'gids', 'po', @@ -239,6 +247,8 @@ class Source extends Model 'closed', 'completed', 'cron', + 'duplicate', + 'fixed', 'flagged', 'internal', 'locked', @@ -247,6 +257,8 @@ class Source extends Model 'problem', 'published', 'released', + 'resolved', + 'retired', 'suspended', 'unknown', 'label', @@ -287,10 +299,12 @@ protected function casts(): array 'canceled_at' => 'datetime', 'closed_at' => 'datetime', 'embargo_at' => 'datetime', + 'fixed_at' => 'datetime', 'postponed_at' => 'datetime', 'published_at' => 'datetime', 'released_at' => 'datetime', 'resumed_at' => 'datetime', + 'resolved_at' => 'datetime', 'suspended_at' => 'datetime', 'gids' => 'integer', 'po' => 'integer', @@ -319,6 +333,8 @@ protected function casts(): array 'closed' => 'boolean', 'completed' => 'boolean', 'cron' => 'boolean', + 'duplicate' => 'boolean', + 'fixed' => 'boolean', 'flagged' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', @@ -327,6 +343,8 @@ protected function casts(): array 'problem' => 'boolean', 'published' => 'boolean', 'released' => 'boolean', + 'resolved' => 'boolean', + 'retired' => 'boolean', 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', From 2fb6688e7fa4197086484ceae74ce377e5146810 Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Tue, 30 Apr 2024 11:07:59 -0700 Subject: [PATCH 15/18] GH-19 --- src/Models/Ticket.php | 3 ++ src/Models/Version.php | 91 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/src/Models/Ticket.php b/src/Models/Ticket.php index 3624809..8027562 100644 --- a/src/Models/Ticket.php +++ b/src/Models/Ticket.php @@ -225,6 +225,7 @@ class Ticket extends Model 'locked' => false, 'pending' => false, 'planned' => false, + 'prioritized' => false, 'problem' => false, 'published' => false, 'released' => false, @@ -351,6 +352,7 @@ class Ticket extends Model 'locked', 'pending', 'planned', + 'prioritized', 'problem', 'published', 'released', @@ -456,6 +458,7 @@ protected function casts(): array 'locked' => 'boolean', 'pending' => 'boolean', 'planned' => 'boolean', + 'prioritized' => 'boolean', 'problem' => 'boolean', 'published' => 'boolean', 'released' => 'boolean', diff --git a/src/Models/Version.php b/src/Models/Version.php index 476301d..d0ce95e 100644 --- a/src/Models/Version.php +++ b/src/Models/Version.php @@ -116,9 +116,29 @@ class Version extends Model 'parent_id' => null, 'version_type' => null, 'matrix_id' => null, + 'project_id' => null, + 'roadmap_id' => null, + 'source_id' => null, + 'tag_id' => null, + 'team_id' => null, + 'ticket_id' => null, 'created_at' => null, 'updated_at' => null, 'deleted_at' => null, + 'start_at' => null, + 'planned_start_at' => null, + 'end_at' => null, + 'planned_end_at' => null, + 'canceled_at' => null, + 'closed_at' => null, + 'embargo_at' => null, + 'fixed_at' => null, + 'postponed_at' => null, + 'published_at' => null, + 'released_at' => null, + 'resumed_at' => null, + 'resolved_at' => null, + 'suspended_at' => null, 'gids' => 0, 'po' => 0, 'pg' => 0, @@ -142,10 +162,21 @@ class Version extends Model 'latitude' => null, 'longitude' => null, 'active' => true, + 'canceled' => false, + 'closed' => false, + 'completed' => false, + 'fixed' => false, 'flagged' => false, 'internal' => false, 'locked' => false, + 'pending' => false, + 'planned' => false, + 'problem' => false, + 'published' => false, + 'released' => false, + 'resolved' => false, 'retired' => false, + 'suspended' => false, 'unknown' => false, 'label' => '', 'title' => '', @@ -177,6 +208,26 @@ class Version extends Model 'parent_id', 'version_type', 'matrix_id', + 'project_id', + 'roadmap_id', + 'source_id', + 'tag_id', + 'team_id', + 'ticket_id', + 'start_at', + 'planned_start_at', + 'end_at', + 'planned_end_at', + 'canceled_at', + 'closed_at', + 'embargo_at', + 'fixed_at', + 'postponed_at', + 'published_at', + 'released_at', + 'resumed_at', + 'resolved_at', + 'suspended_at', 'gids', 'po', 'pg', @@ -200,10 +251,23 @@ class Version extends Model 'latitude', 'longitude', 'active', + 'canceled', + 'closed', + 'completed', + 'cron', + 'duplicate', + 'fixed', 'flagged', 'internal', 'locked', + 'pending', + 'planned', + 'problem', + 'published', + 'released', 'retired', + 'resolved', + 'suspended', 'unknown', 'label', 'title', @@ -236,6 +300,20 @@ protected function casts(): array 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', + 'start_at' => 'datetime', + 'planned_start_at' => 'datetime', + 'end_at' => 'datetime', + 'planned_end_at' => 'datetime', + 'canceled_at' => 'datetime', + 'closed_at' => 'datetime', + 'embargo_at' => 'datetime', + 'fixed_at' => 'datetime', + 'postponed_at' => 'datetime', + 'published_at' => 'datetime', + 'released_at' => 'datetime', + 'resumed_at' => 'datetime', + 'resolved_at' => 'datetime', + 'suspended_at' => 'datetime', 'gids' => 'integer', 'po' => 'integer', 'pg' => 'integer', @@ -259,10 +337,23 @@ protected function casts(): array 'latitude' => 'float', 'longitude' => 'float', 'active' => 'boolean', + 'canceled' => 'boolean', + 'closed' => 'boolean', + 'completed' => 'boolean', + 'cron' => 'boolean', + 'duplicate' => 'boolean', + 'fixed' => 'boolean', 'flagged' => 'boolean', 'internal' => 'boolean', 'locked' => 'boolean', + 'pending' => 'boolean', + 'planned' => 'boolean', + 'problem' => 'boolean', + 'published' => 'boolean', + 'released' => 'boolean', 'retired' => 'boolean', + 'resolved' => 'boolean', + 'suspended' => 'boolean', 'unknown' => 'boolean', 'label' => 'string', 'title' => 'string', From 4abd7bee98311a2319b9733487395c0818c0665e Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Tue, 30 Apr 2024 17:28:59 -0700 Subject: [PATCH 16/18] GH-19 --- tests/Feature/Models/Backlog/ModelTest.php | 19 ++++++++++++++----- tests/Unit/Models/Backlog/ModelTest.php | 6 ++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/tests/Feature/Models/Backlog/ModelTest.php b/tests/Feature/Models/Backlog/ModelTest.php index ddaccc3..e2060bd 100644 --- a/tests/Feature/Models/Backlog/ModelTest.php +++ b/tests/Feature/Models/Backlog/ModelTest.php @@ -18,13 +18,22 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; /** - * @var array> Test hasMany relationships. + * @var array> Test has many relationships. */ protected array $hasMany = [ - 'sprints' => ['key' => 'backlog_id', 'modelClass' => \Playground\Matrix\Models\Sprint::class], - 'tickets' => ['key' => 'backlog_id', 'modelClass' => \Playground\Matrix\Models\Ticket::class], + 'sprints' => [ + 'key' => 'backlog_id', + 'modelClass' => \Playground\Matrix\Models\Sprint::class, + ], + 'tickets' => [ + 'key' => 'backlog_id', + 'modelClass' => \Playground\Matrix\Models\Ticket::class, + ], ]; + /** + * @var array> Test has one relationships. + */ protected array $hasOne = [ 'creator' => [ 'key' => 'created_by_id', @@ -33,12 +42,12 @@ class ModelTest extends ModelCase ], 'modifier' => [ 'key' => 'modified_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'owner' => [ 'key' => 'owned_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'parent' => [ diff --git a/tests/Unit/Models/Backlog/ModelTest.php b/tests/Unit/Models/Backlog/ModelTest.php index 97bc745..b102483 100644 --- a/tests/Unit/Models/Backlog/ModelTest.php +++ b/tests/Unit/Models/Backlog/ModelTest.php @@ -17,11 +17,17 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has many relationships. + */ protected array $hasMany = [ 'sprints', 'tickets', ]; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', From 2b20f4b3252b45680d374551a8f8486cdc5932c2 Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Tue, 30 Apr 2024 18:46:17 -0700 Subject: [PATCH 17/18] GH-19 --- tests/Feature/Models/Epic/ModelTest.php | 7 +++++-- tests/Feature/Models/Milestone/ModelTest.php | 7 +++++-- tests/Feature/Models/Note/ModelTest.php | 7 +++++-- tests/Feature/Models/Project/ModelTest.php | 17 ++++++++++------- tests/Feature/Models/Release/ModelTest.php | 7 +++++-- tests/Feature/Models/Sprint/ModelTest.php | 7 +++++-- tests/Feature/Models/Team/ModelTest.php | 7 +++++-- 7 files changed, 40 insertions(+), 19 deletions(-) diff --git a/tests/Feature/Models/Epic/ModelTest.php b/tests/Feature/Models/Epic/ModelTest.php index 4d3346c..b2fbb6a 100644 --- a/tests/Feature/Models/Epic/ModelTest.php +++ b/tests/Feature/Models/Epic/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array> Test has one relationships. + */ protected array $hasOne = [ 'creator' => [ 'key' => 'created_by_id', @@ -25,12 +28,12 @@ class ModelTest extends ModelCase ], 'modifier' => [ 'key' => 'modified_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'owner' => [ 'key' => 'owned_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'parent' => [ diff --git a/tests/Feature/Models/Milestone/ModelTest.php b/tests/Feature/Models/Milestone/ModelTest.php index 9bd333b..a99b50b 100644 --- a/tests/Feature/Models/Milestone/ModelTest.php +++ b/tests/Feature/Models/Milestone/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array> Test has one relationships. + */ protected array $hasOne = [ 'creator' => [ 'key' => 'created_by_id', @@ -25,12 +28,12 @@ class ModelTest extends ModelCase ], 'modifier' => [ 'key' => 'modified_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'owner' => [ 'key' => 'owned_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'parent' => [ diff --git a/tests/Feature/Models/Note/ModelTest.php b/tests/Feature/Models/Note/ModelTest.php index c71c37b..41fe39a 100644 --- a/tests/Feature/Models/Note/ModelTest.php +++ b/tests/Feature/Models/Note/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array> Test has one relationships. + */ protected array $hasOne = [ 'creator' => [ 'key' => 'created_by_id', @@ -25,12 +28,12 @@ class ModelTest extends ModelCase ], 'modifier' => [ 'key' => 'modified_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'owner' => [ 'key' => 'owned_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'parent' => [ diff --git a/tests/Feature/Models/Project/ModelTest.php b/tests/Feature/Models/Project/ModelTest.php index f83eeec..17f4e86 100644 --- a/tests/Feature/Models/Project/ModelTest.php +++ b/tests/Feature/Models/Project/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array> Test has one relationships. + */ protected array $hasOne = [ 'creator' => [ 'key' => 'created_by_id', @@ -25,12 +28,12 @@ class ModelTest extends ModelCase ], 'modifier' => [ 'key' => 'modified_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'owner' => [ 'key' => 'owned_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'parent' => [ @@ -63,16 +66,16 @@ class ModelTest extends ModelCase 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Matrix::class, ], - 'note' => [ - 'key' => 'note_id', - 'rule' => 'create', - 'modelClass' => \Playground\Matrix\Models\Note::class, - ], 'milestone' => [ 'key' => 'milestone_id', 'rule' => 'create', 'modelClass' => \Playground\Matrix\Models\Milestone::class, ], + 'note' => [ + 'key' => 'note_id', + 'rule' => 'create', + 'modelClass' => \Playground\Matrix\Models\Note::class, + ], 'release' => [ 'key' => 'release_id', 'rule' => 'create', diff --git a/tests/Feature/Models/Release/ModelTest.php b/tests/Feature/Models/Release/ModelTest.php index 5485f4d..ad03eef 100644 --- a/tests/Feature/Models/Release/ModelTest.php +++ b/tests/Feature/Models/Release/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array> Test has one relationships. + */ protected array $hasOne = [ 'creator' => [ 'key' => 'created_by_id', @@ -25,12 +28,12 @@ class ModelTest extends ModelCase ], 'modifier' => [ 'key' => 'modified_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'owner' => [ 'key' => 'owned_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'parent' => [ diff --git a/tests/Feature/Models/Sprint/ModelTest.php b/tests/Feature/Models/Sprint/ModelTest.php index 55eebb4..0b6c5e9 100644 --- a/tests/Feature/Models/Sprint/ModelTest.php +++ b/tests/Feature/Models/Sprint/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array> Test has one relationships. + */ protected array $hasOne = [ 'creator' => [ 'key' => 'created_by_id', @@ -25,12 +28,12 @@ class ModelTest extends ModelCase ], 'modifier' => [ 'key' => 'modified_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'owner' => [ 'key' => 'owned_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'parent' => [ diff --git a/tests/Feature/Models/Team/ModelTest.php b/tests/Feature/Models/Team/ModelTest.php index 8f0f1d9..ace3451 100644 --- a/tests/Feature/Models/Team/ModelTest.php +++ b/tests/Feature/Models/Team/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array> Test has one relationships. + */ protected array $hasOne = [ 'creator' => [ 'key' => 'created_by_id', @@ -25,12 +28,12 @@ class ModelTest extends ModelCase ], 'modifier' => [ 'key' => 'modified_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'owner' => [ 'key' => 'owned_by_id', - 'rule' => 'create', + 'rule' => 'first', 'modelClass' => \Playground\Models\User::class, ], 'parent' => [ From 8b02b73e6dea294b94b84c5d505fb578883d309e Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Tue, 30 Apr 2024 20:02:11 -0700 Subject: [PATCH 18/18] GH-19 --- tests/Unit/Models/Board/ModelTest.php | 3 +++ tests/Unit/Models/Epic/ModelTest.php | 3 +++ tests/Unit/Models/Flow/ModelTest.php | 3 +++ tests/Unit/Models/Matrix/ModelTest.php | 3 +++ tests/Unit/Models/Milestone/ModelTest.php | 3 +++ tests/Unit/Models/Note/ModelTest.php | 3 +++ tests/Unit/Models/Project/ModelTest.php | 3 +++ tests/Unit/Models/Release/ModelTest.php | 3 +++ tests/Unit/Models/Roadmap/ModelTest.php | 3 +++ tests/Unit/Models/Source/ModelTest.php | 3 +++ tests/Unit/Models/Sprint/ModelTest.php | 3 +++ tests/Unit/Models/Tag/ModelTest.php | 3 +++ tests/Unit/Models/Team/ModelTest.php | 3 +++ tests/Unit/Models/Ticket/ModelTest.php | 3 +++ tests/Unit/Models/Version/ModelTest.php | 3 +++ 15 files changed, 45 insertions(+) diff --git a/tests/Unit/Models/Board/ModelTest.php b/tests/Unit/Models/Board/ModelTest.php index 1146972..3762f8b 100644 --- a/tests/Unit/Models/Board/ModelTest.php +++ b/tests/Unit/Models/Board/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Epic/ModelTest.php b/tests/Unit/Models/Epic/ModelTest.php index 110c202..86c1ca5 100644 --- a/tests/Unit/Models/Epic/ModelTest.php +++ b/tests/Unit/Models/Epic/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Flow/ModelTest.php b/tests/Unit/Models/Flow/ModelTest.php index a6eca0f..53fe816 100644 --- a/tests/Unit/Models/Flow/ModelTest.php +++ b/tests/Unit/Models/Flow/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Matrix/ModelTest.php b/tests/Unit/Models/Matrix/ModelTest.php index d4f9d4b..e7eed71 100644 --- a/tests/Unit/Models/Matrix/ModelTest.php +++ b/tests/Unit/Models/Matrix/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Milestone/ModelTest.php b/tests/Unit/Models/Milestone/ModelTest.php index 8f63584..5b47037 100644 --- a/tests/Unit/Models/Milestone/ModelTest.php +++ b/tests/Unit/Models/Milestone/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Note/ModelTest.php b/tests/Unit/Models/Note/ModelTest.php index ad97ac0..c42b936 100644 --- a/tests/Unit/Models/Note/ModelTest.php +++ b/tests/Unit/Models/Note/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Project/ModelTest.php b/tests/Unit/Models/Project/ModelTest.php index 9490866..de55075 100644 --- a/tests/Unit/Models/Project/ModelTest.php +++ b/tests/Unit/Models/Project/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Release/ModelTest.php b/tests/Unit/Models/Release/ModelTest.php index eeac6cc..a934325 100644 --- a/tests/Unit/Models/Release/ModelTest.php +++ b/tests/Unit/Models/Release/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Roadmap/ModelTest.php b/tests/Unit/Models/Roadmap/ModelTest.php index 51a7c77..4bd3436 100644 --- a/tests/Unit/Models/Roadmap/ModelTest.php +++ b/tests/Unit/Models/Roadmap/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Source/ModelTest.php b/tests/Unit/Models/Source/ModelTest.php index b3613e3..d715c11 100644 --- a/tests/Unit/Models/Source/ModelTest.php +++ b/tests/Unit/Models/Source/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Sprint/ModelTest.php b/tests/Unit/Models/Sprint/ModelTest.php index 9ce389d..c68efd2 100644 --- a/tests/Unit/Models/Sprint/ModelTest.php +++ b/tests/Unit/Models/Sprint/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Tag/ModelTest.php b/tests/Unit/Models/Tag/ModelTest.php index 78ccb71..198c758 100644 --- a/tests/Unit/Models/Tag/ModelTest.php +++ b/tests/Unit/Models/Tag/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Team/ModelTest.php b/tests/Unit/Models/Team/ModelTest.php index e56f1c0..19038bd 100644 --- a/tests/Unit/Models/Team/ModelTest.php +++ b/tests/Unit/Models/Team/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Ticket/ModelTest.php b/tests/Unit/Models/Ticket/ModelTest.php index 60049f3..b597e9e 100644 --- a/tests/Unit/Models/Ticket/ModelTest.php +++ b/tests/Unit/Models/Ticket/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier', diff --git a/tests/Unit/Models/Version/ModelTest.php b/tests/Unit/Models/Version/ModelTest.php index 2a6544e..66c9c99 100644 --- a/tests/Unit/Models/Version/ModelTest.php +++ b/tests/Unit/Models/Version/ModelTest.php @@ -17,6 +17,9 @@ class ModelTest extends ModelCase protected bool $hasRelationships = true; + /** + * @var array Test has one relationships. + */ protected array $hasOne = [ 'creator', 'modifier',