feat: add read-only Social Accounts API
Add GET /api/accounts (list with optional ?network= and ?type= filters) and
GET /api/accounts/{socialAccount} (show) endpoints. Include plain-text password
field for AI agent consumption.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
20c33f1c23
commit
5c24b6fbe0
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\SocialAccountResource;
|
||||
use App\Models\SocialAccount;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SocialAccountController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = SocialAccount::query();
|
||||
|
||||
if ($request->filled('network')) {
|
||||
$query->where('network', $request->string('network'));
|
||||
}
|
||||
|
||||
if ($request->filled('type')) {
|
||||
$query->where('type', $request->string('type'));
|
||||
}
|
||||
|
||||
return SocialAccountResource::collection($query->orderBy('username')->get());
|
||||
}
|
||||
|
||||
public function show(SocialAccount $socialAccount)
|
||||
{
|
||||
return new SocialAccountResource($socialAccount);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user