Post Create/Edit

This commit is contained in:
2024-07-27 16:42:03 +02:00
parent 74fd55084f
commit 08731f8559
29 changed files with 632 additions and 161 deletions
+3 -1
View File
@@ -29,6 +29,8 @@ class Posts extends Api
// Fetch all required inputs.
// Throw 400 error if a required one is missing.
$content = Input::post("content");
// This one is optional
$limit = constrain(0, 30, intval(Input::post("l", 10)));
if (empty($content)) throw ApiError::missingField(["content"]);
// Get logged in user
@@ -36,7 +38,7 @@ class Posts extends Api
// Try to create a new post for logged in user.
try {
Response::json(Post::create($self, $content));
Response::json(Post::create($self, $content, $limit));
} catch (Exception $err) {
switch ($err->getMessage()) {
default: