23 lines
663 B
PHP
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()));
|