Initial commit: Flutter app + PHP/MySQL backend on Hostinger

Replaces Firebase with a self-hosted PHP/MySQL API served from
winded.prymsolutions.com. Includes full backend (schema, auth, events,
teams, brackets, suggestions, stats, media, file upload) and updated
Flutter repositories and domain models.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-14 20:13:57 -07:00
commit b239ae3e5f
208 changed files with 19187 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
<?php
require_once __DIR__ . '/../config/helpers.php';
cors();
$id = $_GET['id'] ?? '';
$method = $_SERVER['REQUEST_METHOD'];
$db = db();
if ($id === '') json_err('Missing id');
function load_bracket(PDO $db, string $id): ?array {
$stmt = $db->prepare('SELECT * FROM brackets WHERE id = ?');
$stmt->execute([$id]);
$row = $stmt->fetch();
if (!$row) return null;
$row['rounds'] = $row['rounds_json'] ? json_decode($row['rounds_json'], true) : [];
unset($row['rounds_json']);
return $row;
}
if ($method === 'GET') {
$b = load_bracket($db, $id);
if (!$b) json_err('Not found', 404);
json_ok($b);
}
if ($method === 'PUT') {
require_admin();
$body = body();
$fields = []; $params = [];
foreach (['name','event_id','status'] as $f) {
if (array_key_exists($f, $body)) { $fields[] = "$f = ?"; $params[] = $body[$f]; }
}
if (array_key_exists('rounds', $body)) {
$fields[] = 'rounds_json = ?';
$params[] = json_encode($body['rounds']);
}
if (empty($fields)) json_err('Nothing to update');
$params[] = $id;
$db->prepare('UPDATE brackets SET ' . implode(', ', $fields) . ' WHERE id = ?')->execute($params);
json_ok(load_bracket($db, $id));
}
if ($method === 'DELETE') {
require_admin();
$db->prepare('DELETE FROM brackets WHERE id = ?')->execute([$id]);
json_ok(['deleted' => true]);
}
json_err('Method not allowed', 405);