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:
+9
View File
@@ -690,6 +690,13 @@ components:
type: number
timezone:
type: string
PostCreateResponse:
type: object
properties:
pages:
type: number
post:
$ref: "#/components/schemas/PostResponse"
PostListResponse:
type: object
properties:
@@ -711,6 +718,8 @@ components:
properties:
content:
type: string
limit:
type: number
securitySchemes:
BasicAuth:
type: apiKey
File diff suppressed because one or more lines are too long