Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gammamatrix committed Apr 27, 2024
1 parent 764fadc commit 057450b
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 20 deletions.
4 changes: 2 additions & 2 deletions database/factories/EpicFactory.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

declare(strict_types=1);
/**
* Playground
*/

declare(strict_types=1);
namespace Database\Factories\Playground\Matrix\Models;

use Illuminate\Database\Eloquent\Factories\Factory;
Expand Down
29 changes: 17 additions & 12 deletions database/migrations/2020_01_02_100001_create_matrix_epics_table.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<?php

declare(strict_types=1);
/**
* Playground
*/

declare(strict_types=1);

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

/**
* \Playground\Matrix\Models\Epic
*/
return new class() extends Migration
{
/**
Expand All @@ -18,6 +21,7 @@
public function up(): void
{
Schema::create('matrix_epics', function (Blueprint $table) {

// Primary key

$table->uuid('id')->primary();
Expand Down Expand Up @@ -89,20 +93,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('duplicate')->default(0);
$table->boolean('fixed')->default(0);
$table->boolean('flagged')->default(0);
Expand All @@ -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('');
Expand Down
130 changes: 124 additions & 6 deletions src/Models/Epic.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,118 @@
<?php

declare(strict_types=1);
/**
* Playground
*/

declare(strict_types=1);
namespace Playground\Matrix\Models;

use Illuminate\Database\Eloquent\Relations\HasOne;
use Playground\Models\Model;

/**
* \Playground\Matrix\Models\Epic
*
* @property string $id
* @property ?scalar $created_by_id
* @property ?scalar $modified_by_id
* @property ?scalar $owned_by_id
* @property ?string $parent_id
* @property ?string $epic_type
* @property ?string $backlog_id
* @property ?string $board_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 $problem
* @property bool $published
* @property bool $released
* @property bool $retired
* @property bool $resolved
* @property bool $suspended
* @property bool $unknown
* @property bool $cron
* @property string $label
* @property string $title
* @property string $byline
* @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 Epic extends Model
{
Expand All @@ -30,6 +132,7 @@ class Epic extends Model
'backlog_id' => null,
'board_id' => null,
'flow_id' => null,
'matrix_id' => null,
'milestone_id' => null,
'note_id' => null,
'project_id' => null,
Expand All @@ -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,
Expand All @@ -69,7 +172,7 @@ class Epic extends Model
'status' => 0,
'rank' => 0,
'size' => 0,
'matrix' => '',
'matrix' => '{}',
'x' => null,
'y' => null,
'z' => null,
Expand All @@ -84,6 +187,7 @@ class Epic extends Model
'canceled' => false,
'closed' => false,
'completed' => false,
'cron' => false,
'duplicate' => false,
'fixed' => false,
'flagged' => false,
Expand Down Expand Up @@ -134,6 +238,7 @@ class Epic extends Model
'backlog_id',
'board_id',
'flow_id',
'matrix_id',
'milestone_id',
'note_id',
'project_id',
Expand Down Expand Up @@ -185,6 +290,7 @@ class Epic extends Model
'canceled',
'closed',
'completed',
'cron',
'duplicate',
'fixed',
'flagged',
Expand Down Expand Up @@ -217,7 +323,6 @@ class Epic extends Model
'board',
'flow',
'meta',
'notes',
'options',
'roadmap',
'sources',
Expand Down Expand Up @@ -260,7 +365,7 @@ protected function casts(): array
'status' => 'integer',
'rank' => 'integer',
'size' => 'integer',
'matrix' => 'string',
'matrix' => 'array',
'x' => 'integer',
'y' => 'integer',
'z' => 'integer',
Expand All @@ -275,6 +380,7 @@ protected function casts(): array
'canceled' => 'boolean',
'closed' => 'boolean',
'completed' => 'boolean',
'cron' => 'boolean',
'duplicate' => 'boolean',
'fixed' => 'boolean',
'flagged' => 'boolean',
Expand Down Expand Up @@ -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.
*/
Expand Down
5 changes: 5 additions & 0 deletions tests/Feature/Models/Epic/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Models/Backlog/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ModelTest extends ModelCase
'board',
'epic',
'flow',
'matrix',
'milestone',
'note',
'project',
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Models/Board/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ModelTest extends ModelCase
'backlog',
'epic',
'flow',
'matrix',
'milestone',
'project',
'release',
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Models/Epic/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ModelTest extends ModelCase
'backlog',
'board',
'flow',
'matrix',
'milestone',
'project',
'release',
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Models/Sprint/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ModelTest extends ModelCase
'board',
'epic',
'flow',
'matrix',
'milestone',
'project',
'release',
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Models/Ticket/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class ModelTest extends ModelCase
'completedBy',
'epic',
'flow',
'matrix',
'milestone',
'project',
'release',
Expand Down

0 comments on commit 057450b

Please sign in to comment.