feat: dist/ pridan do repa pro server deploy
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
70
dist/api/admin/bank-accounts.php
vendored
Normal file
70
dist/api/admin/bank-accounts.php
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* BOHA Automation - Bank Accounts API
|
||||
*
|
||||
* GET /api/admin/bank-accounts.php - Seznam bankovnich uctu
|
||||
* POST /api/admin/bank-accounts.php - Vytvoreni uctu
|
||||
* PUT /api/admin/bank-accounts.php?id=X - Uprava uctu
|
||||
* DELETE /api/admin/bank-accounts.php?id=X - Smazani uctu
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once dirname(__DIR__) . '/config.php';
|
||||
require_once dirname(__DIR__) . '/includes/JWTAuth.php';
|
||||
require_once dirname(__DIR__) . '/includes/AuditLog.php';
|
||||
require_once __DIR__ . '/handlers/bank-accounts-handlers.php';
|
||||
|
||||
setCorsHeaders();
|
||||
setSecurityHeaders();
|
||||
setNoCacheHeaders();
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
$authData = JWTAuth::requireAuth();
|
||||
AuditLog::setUser($authData['user_id'], $authData['user']['username'] ?? 'unknown');
|
||||
|
||||
$method = $_SERVER['REQUEST_METHOD'];
|
||||
$id = isset($_GET['id']) ? (int) $_GET['id'] : null;
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
|
||||
switch ($method) {
|
||||
case 'GET':
|
||||
requirePermission($authData, 'offers.settings');
|
||||
handleGetBankAccountList($pdo);
|
||||
break;
|
||||
|
||||
case 'POST':
|
||||
requirePermission($authData, 'offers.settings');
|
||||
handleCreateBankAccount($pdo);
|
||||
break;
|
||||
|
||||
case 'PUT':
|
||||
requirePermission($authData, 'offers.settings');
|
||||
if (!$id) {
|
||||
errorResponse('ID účtu je povinné');
|
||||
}
|
||||
handleUpdateBankAccount($pdo, $id);
|
||||
break;
|
||||
|
||||
case 'DELETE':
|
||||
requirePermission($authData, 'offers.settings');
|
||||
if (!$id) {
|
||||
errorResponse('ID účtu je povinné');
|
||||
}
|
||||
handleDeleteBankAccount($pdo, $id);
|
||||
break;
|
||||
|
||||
default:
|
||||
errorResponse('Metoda není povolena', 405);
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
error_log('Bank Accounts API error: ' . $e->getMessage());
|
||||
if (DEBUG_MODE) {
|
||||
errorResponse('Chyba databáze: ' . $e->getMessage(), 500);
|
||||
} else {
|
||||
errorResponse('Chyba databáze', 500);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user