mobile app api

This commit is contained in:
2026-07-27 21:04:07 +03:00
parent 9241e177ac
commit 6913024596
54 changed files with 5156 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
require __DIR__ . '/_bootstrap.php';
/**
* @OA\Get(
* path="/homes.php",
* tags={"Homes"},
* summary="My properties",
* security={{"bearerAuth":{}}},
* @OA\Response(response=200, description="OK", @OA\JsonContent(
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/Home"))
* )),
* @OA\Response(response=401, ref="#/components/responses/Unauthorized")
* )
*/
require_method('GET');
$user = require_auth($pdo);
$stmt = $pdo->prepare('SELECT * FROM home WHERE iduser = ? ORDER BY idhome DESC');
$stmt->execute([$user['id']]);
$rows = $stmt->fetchAll();
$counts = home_counts($pdo, array_column($rows, 'idhome'));
$homes = array_map(fn ($h) => present_home($h, true, $counts[(int) $h['idhome']] ?? null), $rows);
json_data($homes);