Phase 121 — SMSPLANET Conversation + Notifications:
- migration 20260512_000110 adds smsplanet conversation + notifications tables
- src/Modules/Sms (SmsConversationService, SmsMessageRepository, SmsplanetWebhookController)
- src/Modules/Notifications (Repository, Controller, ApiController)
- order SMS tab, notification center, sender mode, inbound webhook
- public notifications.js + layouts/app.php integration
Phase 122 — SMSPLANET Default SMS Footer:
- migration 20260512_000111 adds smsplanet_integration_settings.default_footer
- footer appended to test SMS and order SMS, validated against 918 char limit
- settings textarea + compact order SMS note when footer configured
Bundled (could not split per-phase without hunk staging):
- routes/web.php (also carries Phase 118 fakturownia redirects)
- DOCS/{ARCHITECTURE,DB_SCHEMA,TECH_CHANGELOG}.md (118 + 121 + 122 entries)
- .paul/codebase/{architecture,db_schema,tech_changelog}.md (118 + 121 + 122)
- .paul/STATE.md, ROADMAP.md, changelog/2026-05-12.md (UNIFY closure)
Co-Authored-By: Claude <noreply@anthropic.com>
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Notifications;
|
|
|
|
use App\Core\Http\Request;
|
|
use App\Core\Http\Response;
|
|
|
|
final class NotificationApiController
|
|
{
|
|
public function __construct(private readonly NotificationRepository $repository)
|
|
{
|
|
}
|
|
|
|
public function unread(Request $request): Response
|
|
{
|
|
return Response::json([
|
|
'ok' => true,
|
|
'count' => $this->repository->unreadCount(),
|
|
'items' => array_map(
|
|
static fn (array $row): array => [
|
|
'id' => (int) ($row['id'] ?? 0),
|
|
'type' => (string) ($row['type'] ?? ''),
|
|
'title' => (string) ($row['title'] ?? ''),
|
|
'body' => (string) ($row['body'] ?? ''),
|
|
'target_url' => (string) ($row['target_url'] ?? ''),
|
|
'created_at' => (string) ($row['created_at'] ?? ''),
|
|
],
|
|
$this->repository->recentUnread(10)
|
|
),
|
|
]);
|
|
}
|
|
|
|
public function markRead(Request $request): Response
|
|
{
|
|
$this->repository->markRead(max(0, (int) $request->input('id', 0)));
|
|
|
|
return Response::json(['ok' => true, 'count' => $this->repository->unreadCount()]);
|
|
}
|
|
}
|