-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ush 1587 - Add 3 new media types on the backend #5004
Changes from all commits
d470d1d
b1ad178
2727477
33e1ddf
84e167e
a8bf386
5f57128
4478b32
84c9c8f
17195d1
d0d6aaa
259092d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
class EmbiggenMimeType extends AbstractMigration | ||
{ | ||
public function change() | ||
{ | ||
$this->table('media') | ||
->changeColumn('mime', 'string', ['limit' => 128]) | ||
->update(); | ||
} | ||
|
||
public function down() | ||
{ | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ protected function isSupported(Command $command) | |
public function __invoke(Action $action) | ||
{ | ||
$this->isSupported($action); | ||
$this->validateFileData($action->getMediaEntity()); | ||
// $this->validateFileData($action->getMediaEntity()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think is good idea to stop all validations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am disabling this because it presents a hard upload limit which is in opposition to the frontend functionality. I will be creating a new ticket for changes to the backend to handle the frontend functionality, and in the interim have implemented validation on the frontend. |
||
return $this->media_repository->create($action->getMediaEntity()); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Ushahidi\Modules\V5\Http\Resources; | ||
|
||
use Illuminate\Http\Resources\Json\ResourceCollection; | ||
|
||
class MediaCollection extends ResourceCollection | ||
{ | ||
public static $wrap = 'results'; | ||
|
||
/** | ||
* The resource that this resource collects. | ||
* | ||
* @var string | ||
*/ | ||
public $collects = 'Ushahidi\Modules\V5\Http\Resources\MediaResource'; | ||
/** | ||
* Transform the resource collection into an array. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return array | ||
*/ | ||
public function toArray($request) | ||
{ | ||
return $this->collection; | ||
} | ||
|
||
public function count() | ||
{ | ||
return count($this->collection); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
namespace Ushahidi\Modules\V5\Http\Resources; | ||
|
||
use Illuminate\Http\Resources\Json\JsonResource as Resource; | ||
|
||
class MediaResource extends Resource | ||
{ | ||
|
||
use RequestCachedResource; | ||
|
||
public static $wrap = 'result'; | ||
|
||
/** | ||
* Transform the resource into an array. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @return array | ||
*/ | ||
public function toArray($request) | ||
{ | ||
return [ | ||
'id' => $this->id, | ||
'media_id' => $this->value, | ||
]; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exquisitely cromulent 🙌