37 lines
994 B
PHP
37 lines
994 B
PHP
<?php
|
|
// phpcs:disable PEAR.Commenting.FileComment,PEAR.Commenting.ClassComment
|
|
|
|
/**
|
|
* Update board column definitions.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
$boardService = include __DIR__ . '/_bootstrap.php';
|
|
|
|
use IronKanban\Support\Http;
|
|
use IronKanban\Support\HttpHalt;
|
|
|
|
try {
|
|
Http::requireMethod('POST');
|
|
Http::verifyCsrf();
|
|
$input = Http::input();
|
|
|
|
$boardService->assertRevision((string) $input['projectId'], isset($input['revision']) ? (string) $input['revision'] : null);
|
|
|
|
Http::json(
|
|
[
|
|
'success' => true,
|
|
'state' => $boardService->updateBoard(
|
|
(string) $input['projectId'],
|
|
is_array($input['columns'] ?? null) ? $input['columns'] : [],
|
|
isset($input['deletedColumnId']) ? (string) $input['deletedColumnId'] : null
|
|
),
|
|
]
|
|
);
|
|
} catch (HttpHalt $halt) {
|
|
return;
|
|
} catch (Throwable $exception) {
|
|
Http::error($exception->getMessage(), $exception->getMessage() === 'conflict' ? 409 : 500);
|
|
}
|