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