add set media fields
This commit is contained in:
parent
1ce7688d33
commit
fa8efd765f
10 changed files with 61 additions and 21 deletions
|
|
@ -25,13 +25,20 @@ class SetController
|
|||
}
|
||||
|
||||
/**
|
||||
* @return array{id: int, name: string}
|
||||
* @return array{
|
||||
* id: int,
|
||||
* name: string,
|
||||
* description: string,
|
||||
* iconImageUrl: string
|
||||
* }
|
||||
*/
|
||||
private function buildSetPayload(DomainSet $set): array
|
||||
{
|
||||
return [
|
||||
'id' => $set->getId(),
|
||||
'name' => $set->getName(),
|
||||
'description' => $set->getDescription(),
|
||||
'iconImageUrl' => $set->getIconImageUrl(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ class CreateSetDto
|
|||
{
|
||||
public function __construct(
|
||||
public string $name,
|
||||
public string $description,
|
||||
public string $iconImageUrl,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ class EloquentSetRepository implements SetRepository
|
|||
{
|
||||
$model = SetModel::create([
|
||||
'name' => $dto->name,
|
||||
'description' => $dto->description,
|
||||
'icon_image_url' => $dto->iconImageUrl,
|
||||
]);
|
||||
|
||||
return $this->toDomain($model);
|
||||
|
|
@ -36,6 +38,8 @@ class EloquentSetRepository implements SetRepository
|
|||
return new Set(
|
||||
id: $model->id,
|
||||
name: $model->name,
|
||||
description: $model->description,
|
||||
iconImageUrl: $model->icon_image_url,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ class Set
|
|||
public function __construct(
|
||||
private int $id,
|
||||
private string $name,
|
||||
private string $description,
|
||||
private string $iconImageUrl,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -19,4 +21,14 @@ class Set
|
|||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function getIconImageUrl(): string
|
||||
{
|
||||
return $this->iconImageUrl;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Model;
|
|||
/**
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $description
|
||||
* @property string $icon_image_url
|
||||
*
|
||||
* @method static Builder<static>|SetModel newModelQuery()
|
||||
* @method static Builder<static>|SetModel newQuery()
|
||||
|
|
@ -23,5 +25,5 @@ class SetModel extends Model
|
|||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = ['name'];
|
||||
protected $fillable = ['name', 'description', 'icon_image_url'];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue