feat(api): add AI text-to-deck generation, wallet deposit structure, and profile/notification endpoints
Fills the gaps between the admin panel screens and the backend: a full free-text + slide-count + language -> AI-generated presentation flow with new slide-cloning logic in TemplateFillService, a "my presentations" list endpoint, a swappable payment-gateway structure for wallet top-ups (fake driver for now), and avatar upload / public-profile toggle / account deletion / password change / notification preference endpoints. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
57
app/Http/Requests/Api/GenerateAiPresentationRequest.php
Normal file
57
app/Http/Requests/Api/GenerateAiPresentationRequest.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api;
|
||||
|
||||
use App\Models\Template;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
class GenerateAiPresentationRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'language' => ['required', 'string', 'in:fa,en,ar'],
|
||||
'slide_count' => ['required', 'integer', 'min:3', 'max:30'],
|
||||
'text' => ['required', 'string', 'min:20'],
|
||||
];
|
||||
}
|
||||
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(function (Validator $validator): void {
|
||||
/** @var Template $template */
|
||||
$template = $this->route('template');
|
||||
|
||||
if (! $template->is_ai_enabled) {
|
||||
$validator->errors()->add('template', 'این قالب برای ساخت پاورپوینت با هوش مصنوعی فعال نیست.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'title.required' => 'عنوان پاورپوینت الزامی است.',
|
||||
'language.required' => 'زبان ارائه الزامی است.',
|
||||
'language.in' => 'زبان انتخابشده پشتیبانی نمیشود.',
|
||||
'slide_count.required' => 'تعداد اسلاید الزامی است.',
|
||||
'slide_count.min' => 'تعداد اسلاید باید حداقل :min باشد.',
|
||||
'slide_count.max' => 'تعداد اسلاید باید حداکثر :max باشد.',
|
||||
'text.required' => 'متن ورودی الزامی است.',
|
||||
'text.min' => 'متن ورودی باید حداقل :min کاراکتر باشد.',
|
||||
];
|
||||
}
|
||||
}
|
||||
35
app/Http/Requests/Api/InitiateDepositRequest.php
Normal file
35
app/Http/Requests/Api/InitiateDepositRequest.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class InitiateDepositRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'amount' => ['required', 'integer', 'min:10000'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'amount.required' => 'مبلغ شارژ الزامی است.',
|
||||
'amount.integer' => 'مبلغ باید عدد باشد.',
|
||||
'amount.min' => 'حداقل مبلغ شارژ :min تومان است.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateNotificationPreferencesRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'comment_on_presentation' => ['sometimes', 'boolean'],
|
||||
'form_reply' => ['sometimes', 'boolean'],
|
||||
'new_follower' => ['sometimes', 'boolean'],
|
||||
'news_announcements' => ['sometimes', 'boolean'],
|
||||
'weekly_product_updates' => ['sometimes', 'boolean'],
|
||||
'weekly_blog_digest' => ['sometimes', 'boolean'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user