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:
2026-08-29 01:36:17 +03:30
parent fe2090a5af
commit 46ae711a20
42 changed files with 1632 additions and 44 deletions

View File

@@ -3,7 +3,10 @@
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Requests\Api\UpdateNotificationPreferencesRequest;
use App\Http\Resources\NotificationPreferenceResource;
use App\Http\Resources\NotificationResource;
use App\Models\NotificationPreference;
use App\Services\NotificationService;
use App\Traits\ApiResponse;
use Illuminate\Http\JsonResponse;
@@ -86,4 +89,93 @@ class NotificationController extends Controller
return $this->success('همه نوتیفیکیشن‌ها خوانده شد.');
}
#[OA\Get(
path: '/notifications/preferences',
description: 'Get the authenticated user notification preferences',
summary: 'Show notification preferences',
security: [['sanctum' => []]],
tags: ['Notifications'],
responses: [
new OA\Response(
response: 200,
description: 'Notification preferences fetched successfully',
content: new OA\JsonContent(
properties: [
new OA\Property(property: 'message', type: 'string', example: 'تنظیمات اعلان‌ها با موفقیت دریافت شد.'),
new OA\Property(
property: 'data',
properties: [
new OA\Property(property: 'preferences', ref: '#/components/schemas/NotificationPreference'),
],
type: 'object'
),
]
)
),
new OA\Response(response: 401, description: 'Unauthenticated'),
]
)]
public function preferences(Request $request): JsonResponse
{
$preferences = $this->firstOrCreatePreferences($request);
return $this->success('تنظیمات اعلان‌ها با موفقیت دریافت شد.', [
'preferences' => new NotificationPreferenceResource($preferences),
]);
}
#[OA\Put(
path: '/notifications/preferences',
description: 'Update the authenticated user notification preferences',
summary: 'Update notification preferences',
security: [['sanctum' => []]],
tags: ['Notifications'],
requestBody: new OA\RequestBody(
required: true,
content: new OA\JsonContent(ref: '#/components/schemas/NotificationPreference')
),
responses: [
new OA\Response(
response: 200,
description: 'Notification preferences updated successfully',
content: new OA\JsonContent(
properties: [
new OA\Property(property: 'message', type: 'string', example: 'تنظیمات اعلان‌ها با موفقیت به‌روزرسانی شد.'),
new OA\Property(
property: 'data',
properties: [
new OA\Property(property: 'preferences', ref: '#/components/schemas/NotificationPreference'),
],
type: 'object'
),
]
)
),
new OA\Response(response: 401, description: 'Unauthenticated'),
new OA\Response(response: 422, description: 'Validation error'),
]
)]
public function updatePreferences(UpdateNotificationPreferencesRequest $request): JsonResponse
{
$preferences = $this->firstOrCreatePreferences($request);
$preferences->update($request->validated());
return $this->success('تنظیمات اعلان‌ها با موفقیت به‌روزرسانی شد.', [
'preferences' => new NotificationPreferenceResource($preferences->fresh()),
]);
}
private function firstOrCreatePreferences(Request $request): NotificationPreference
{
return $request->user()->notificationPreference()->firstOrCreate([], [
'comment_on_presentation' => true,
'form_reply' => false,
'new_follower' => false,
'news_announcements' => false,
'weekly_product_updates' => true,
'weekly_blog_digest' => false,
]);
}
}