diff --git a/Admin/Install/db.json b/Admin/Install/db.json index 63ada08..09c918c 100644 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -24,10 +24,11 @@ "type": "TINYINT(1)", "null": false }, - "tag_created_by": { - "name": "tag_created_by", + "tag_owner": { + "name": "tag_owner", "type": "INT", - "null": false, + "null": true, + "default": null, "foreignTable": "account", "foreignKey": "account_id" } diff --git a/Controller/ApiController.php b/Controller/ApiController.php index d4cca86..5c89d55 100644 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -28,6 +28,10 @@ use phpOMS\Model\Message\FormValidation; * @license OMS License 1.0 * @link https://orange-management.org * @since 1.0.0 + * + * @todo Orange-Management/Modules#153 + * Create Module + * Create a badge module instead of letting modules create their own internal badge/tag system. */ final class ApiController extends Controller { diff --git a/Models/Tag.php b/Models/Tag.php index 7080ea3..37ac51b 100644 --- a/Models/Tag.php +++ b/Models/Tag.php @@ -56,7 +56,7 @@ class Tag implements ArrayableInterface, \JsonSerializable * @var int * @since 1.0.0 */ - protected $createdBy = 0; + protected $owner = 0; /** * Tag type. @@ -69,13 +69,13 @@ class Tag implements ArrayableInterface, \JsonSerializable /** * Get created by * - * @return int|\phpOMS\Account\Account + * @return null|int|\phpOMS\Account\Account * * @since 1.0.0 */ - public function getCreatedBy() + public function getOwner() { - return $this->createdBy; + return $this->owner; } /** @@ -87,9 +87,9 @@ class Tag implements ArrayableInterface, \JsonSerializable * * @since 1.0.0 */ - public function setCreatedBy($id) : void + public function setOwner($id) : void { - $this->createdBy = $id; + $this->owner = $id; } /** diff --git a/Models/TagMapper.php b/Models/TagMapper.php index 6bbd8b3..336efa0 100644 --- a/Models/TagMapper.php +++ b/Models/TagMapper.php @@ -15,6 +15,7 @@ declare(strict_types=1); namespace Modules\Tag\Models; use phpOMS\DataStorage\Database\DataMapperAbstract; +use Modules\Admin\Models\AccountMapper; /** * Tag mapper class. @@ -38,7 +39,7 @@ final class TagMapper extends DataMapperAbstract 'tag_color' => ['name' => 'tag_color', 'type' => 'string', 'internal' => 'color'], 'tag_type' => ['name' => 'tag_type', 'type' => 'int', 'internal' => 'type'], 'tag_color' => ['name' => 'tag_color', 'type' => 'string', 'internal' => 'color'], - 'tag_created_by' => ['name' => 'tag_created_by', 'type' => 'int', 'internal' => 'createdBy'], + 'tag_owner' => ['name' => 'tag_owner', 'type' => 'int', 'internal' => 'owner'], ]; /** @@ -48,9 +49,9 @@ final class TagMapper extends DataMapperAbstract * @since 1.0.0 */ protected static array $belongsTo = [ - 'createdBy' => [ + 'owner' => [ 'mapper' => AccountMapper::class, - 'src' => 'tag_created_by', + 'src' => 'tag_owner', ], ];