Allow POST for day

cache
Varun Patil 2022-10-06 13:18:15 -07:00
parent b62e73735c
commit efd9232c94
2 changed files with 9 additions and 0 deletions

View File

@ -18,6 +18,7 @@ return [
// API
['name' => 'api#days', 'url' => '/api/days', 'verb' => 'GET'],
['name' => 'api#day', 'url' => '/api/days/{id}', 'verb' => 'GET'],
['name' => 'api#day', 'url' => '/api/days/{id}', 'verb' => 'POST'],
['name' => 'api#imageInfo', 'url' => '/api/info/{id}', 'verb' => 'GET'],
['name' => 'api#imageEdit', 'url' => '/api/edit/{id}', 'verb' => 'PATCH'],
['name' => 'api#archive', 'url' => '/api/archive/{id}', 'verb' => 'PATCH'],

View File

@ -183,6 +183,14 @@ class ApiController extends Controller {
}
$uid = $user->getUID();
// Check if post request
if ($this->request->getMethod() === 'POST') {
$id = $this->request->getParam('body_ids');
if (is_null($id)) {
return new JSONResponse([], Http::STATUS_BAD_REQUEST);
}
}
// Split at commas and convert all parts to int
$day_ids = array_map(function ($part) {
return intval($part);