From 5e4f0e95b6941911495db0eaf7a5eafe248147bd Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Sun, 28 Apr 2024 11:29:58 -0700 Subject: [PATCH] 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',