Files
2026-07-27 21:04:07 +03:00

23 lines
663 B
PHP

<?php
require __DIR__ . '/_bootstrap.php';
/**
* @OA\Get(
* path="/owners.php",
* tags={"Owners"},
* summary="My owners",
* security={{"bearerAuth":{}}},
* @OA\Response(response=200, description="OK", @OA\JsonContent(
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/Owner"))
* )),
* @OA\Response(response=401, ref="#/components/responses/Unauthorized")
* )
*/
require_method('GET');
$user = require_auth($pdo);
$stmt = $pdo->prepare('SELECT * FROM property_owners WHERE user_id = ? ORDER BY owner_id DESC');
$stmt->execute([$user['id']]);
json_data(array_map('present_owner', $stmt->fetchAll()));