✨feature: Initial MVP
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
// phpcs:disable PEAR.Commenting.FileComment,PEAR.Commenting.ClassComment
|
||||
|
||||
/**
|
||||
* Create a new task.
|
||||
*/
|
||||
|
||||
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->createTask(
|
||||
(string) $input['projectId'],
|
||||
trim((string) ($input['title'] ?? 'Untitled Task')),
|
||||
(string) ($input['column'] ?? 'backlog'),
|
||||
(string) ($input['body'] ?? '')
|
||||
),
|
||||
]
|
||||
);
|
||||
} catch (HttpHalt $halt) {
|
||||
return;
|
||||
} catch (Throwable $exception) {
|
||||
Http::error($exception->getMessage(), $exception->getMessage() === 'conflict' ? 409 : 500);
|
||||
}
|
||||
Reference in New Issue
Block a user