feat(media): clean media api + create an entity per media type

This commit is contained in:
Yassine Doghri 2021-12-17 17:14:37 +00:00
commit fafaa7e689
46 changed files with 482 additions and 610 deletions

View file

@ -10,7 +10,6 @@ declare(strict_types=1);
namespace Modules\Admin\Controllers;
use App\Entities\Image;
use App\Entities\Person;
use App\Models\PersonModel;
use CodeIgniter\Exceptions\PageNotFoundException;
@ -78,6 +77,7 @@ class PersonController extends BaseController
}
$person = new Person([
'avatar' => $this->request->getFile('avatar'),
'full_name' => $this->request->getPost('full_name'),
'unique_name' => $this->request->getPost('unique_name'),
'information_url' => $this->request->getPost('information_url'),
@ -85,11 +85,6 @@ class PersonController extends BaseController
'updated_by' => user_id(),
]);
$avatarFile = $this->request->getFile('avatar');
if ($avatarFile !== null && $avatarFile->isValid()) {
$person->avatar = new Image($avatarFile);
}
$personModel = new PersonModel();
if (! $personModel->insert($person)) {