Add support API scaffold
This commit is contained in:
36
app/Http/Requests/Support/SupportGuestPolicyRequest.php
Normal file
36
app/Http/Requests/Support/SupportGuestPolicyRequest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Support;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportGuestPolicyRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'guest_downloads_enabled' => ['sometimes', 'boolean'],
|
||||
'guest_sharing_enabled' => ['sometimes', 'boolean'],
|
||||
'guest_upload_visibility' => ['sometimes', 'string'],
|
||||
'per_device_upload_limit' => ['sometimes', 'integer', 'min:0'],
|
||||
'join_token_failure_limit' => ['sometimes', 'integer', 'min:1'],
|
||||
'join_token_failure_decay_minutes' => ['sometimes', 'integer', 'min:1'],
|
||||
'join_token_access_limit' => ['sometimes', 'integer', 'min:0'],
|
||||
'join_token_access_decay_minutes' => ['sometimes', 'integer', 'min:1'],
|
||||
'join_token_download_limit' => ['sometimes', 'integer', 'min:0'],
|
||||
'join_token_download_decay_minutes' => ['sometimes', 'integer', 'min:1'],
|
||||
'join_token_ttl_hours' => ['sometimes', 'integer', 'min:0'],
|
||||
'share_link_ttl_hours' => ['sometimes', 'integer', 'min:1'],
|
||||
'guest_notification_ttl_hours' => ['nullable', 'integer', 'min:1'],
|
||||
];
|
||||
}
|
||||
}
|
||||
24
app/Http/Requests/Support/SupportResourceRequest.php
Normal file
24
app/Http/Requests/Support/SupportResourceRequest.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Support;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportResourceRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'data' => ['required', 'array'],
|
||||
];
|
||||
}
|
||||
}
|
||||
52
app/Http/Requests/Support/SupportTokenRequest.php
Normal file
52
app/Http/Requests/Support/SupportTokenRequest.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Support;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportTokenRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'login' => ['required', 'string'],
|
||||
'password' => ['required', 'string'],
|
||||
'abilities' => ['sometimes', 'array'],
|
||||
'abilities.*' => ['string'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{email?: string, username?: string, password: string, abilities?: array<int, string>}
|
||||
*/
|
||||
public function credentials(): array
|
||||
{
|
||||
$login = $this->string('login')->trim()->value();
|
||||
|
||||
$credentials = [
|
||||
'password' => $this->string('password')->value(),
|
||||
];
|
||||
|
||||
if (filter_var($login, FILTER_VALIDATE_EMAIL)) {
|
||||
$credentials['email'] = $login;
|
||||
} else {
|
||||
$credentials['username'] = $login;
|
||||
}
|
||||
|
||||
$abilities = $this->input('abilities');
|
||||
if (is_array($abilities) && $abilities !== []) {
|
||||
$credentials['abilities'] = array_values(array_filter($abilities, 'is_string'));
|
||||
}
|
||||
|
||||
return $credentials;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Support;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportWatermarkSettingsRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'asset' => ['sometimes', 'string'],
|
||||
'position' => ['sometimes', 'string'],
|
||||
'opacity' => ['sometimes', 'numeric', 'min:0', 'max:1'],
|
||||
'scale' => ['sometimes', 'numeric', 'min:0.05', 'max:1'],
|
||||
'padding' => ['sometimes', 'integer', 'min:0'],
|
||||
'offset_x' => ['sometimes', 'integer', 'min:-500', 'max:500'],
|
||||
'offset_y' => ['sometimes', 'integer', 'min:-500', 'max:500'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Support\Tenant;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportTenantAddPackageRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'package_id' => ['required', 'integer'],
|
||||
'expires_at' => ['nullable', 'date'],
|
||||
'reason' => ['nullable', 'string'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Support\Tenant;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportTenantScheduleDeletionRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'pending_deletion_at' => ['required', 'date', 'after:now'],
|
||||
'send_warning' => ['sometimes', 'boolean'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Support\Tenant;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportTenantSetGracePeriodRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'grace_period_ends_at' => ['required', 'date', 'after_or_equal:now'],
|
||||
'note' => ['nullable', 'string'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Support\Tenant;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportTenantUpdateLimitsRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'max_photos_per_event' => ['required', 'integer', 'min:0'],
|
||||
'max_storage_mb' => ['required', 'integer', 'min:0'],
|
||||
'note' => ['nullable', 'string'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Support\Tenant;
|
||||
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportTenantUpdateSubscriptionRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'subscription_expires_at' => ['nullable', 'date'],
|
||||
'note' => ['nullable', 'string'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user