Skip to content

Commit

Permalink
Merge pull request #212 from rrze-mmz/208-error-on-generating-smil-fi…
Browse files Browse the repository at this point in the history
…les-command

Add title validation rule
  • Loading branch information
stefanosgeo authored Jan 17, 2025
2 parents 140cb2e + f10ceb3 commit 655b913
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/Http/Requests/StoreClipRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function authorize(): bool
public function rules(): array
{
return [
'title' => ['required'],
'title' => ['required', 'string', 'max:255'],
'description' => ['string', 'nullable'],
'recording_date' => ['required', 'date'],
'organization_id' => ['required', 'integer'],
Expand Down
16 changes: 8 additions & 8 deletions app/Http/Requests/StoreCollectionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

class StoreCollectionRequest extends FormRequest
{
protected function prepareForValidation()
{
$this->merge([
'is_public' => $this->is_public === 'on',
]);
}

/**
* Determine if the user is authorized to make this request.
*
Expand All @@ -32,9 +25,16 @@ public function rules()
{
return [
'position' => ['required', 'integer'],
'title' => ['required', 'string'],
'title' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'max:1000'],
'is_public' => ['required', 'boolean'],
];
}

protected function prepareForValidation()
{
$this->merge([
'is_public' => $this->is_public === 'on',
]);
}
}
32 changes: 12 additions & 20 deletions app/Http/Requests/StoreDeviceRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,11 @@

class StoreDeviceRequest extends FormRequest
{
protected function prepareForValidation()
{
$this->merge([
'has_recording_func' => $this->has_recording_func === 'on',
'has_livestream_func' => $this->has_livestream_func === 'on',
'is_hybrid' => $this->is_hybrid === 'on',
'operational' => $this->operational === 'on',

]);
}

/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
public function authorize(): bool
{
return auth()->user()->isAdmin() || auth()->user()->isAssistant();
}

/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
Expand All @@ -51,4 +32,15 @@ public function rules(): array
'telephone_number' => ['digits_between:5,12', 'nullable'],
];
}

protected function prepareForValidation(): void
{
$this->merge([
'has_recording_func' => $this->has_recording_func === 'on',
'has_livestream_func' => $this->has_livestream_func === 'on',
'is_hybrid' => $this->is_hybrid === 'on',
'operational' => $this->operational === 'on',

]);
}
}
2 changes: 1 addition & 1 deletion app/Http/Requests/StoreSeriesRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function authorize(): bool
public function rules()
{
return [
'title' => ['required'],
'title' => ['required', 'string', 'max:255'],
'description' => ['string', 'nullable'],
'organization_id' => ['required', 'integer'],
'presenters' => ['array'],
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/UpdateClipRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function rules(): array
{

return [
'title' => ['required'],
'title' => ['required', 'string', 'max:255'],
'description' => ['string', 'nullable'],
'recording_date' => ['required', 'date'],
'organization_id' => ['required', 'integer'],
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/UpdateSeriesRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function authorize(): bool
public function rules()
{
return [
'title' => ['required'],
'title' => ['required', 'string', 'max:255'],
'description' => ['string', 'nullable'],
'organization_id' => ['required ', 'integer'],
'slug' => ['required'],
Expand Down

0 comments on commit 655b913

Please sign in to comment.