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',