Delete return pages
This commit is contained in:
@@ -30,7 +30,7 @@ class Posts extends Api
|
||||
// Throw 400 error if a required one is missing.
|
||||
$content = Input::post("content");
|
||||
// This one is optional
|
||||
$limit = constrain(0, 30, intval(Input::post("limit", 10)));
|
||||
$limit = constrain(0, 30, intval(Input::get("l", 10)));
|
||||
if (empty($content)) throw ApiError::missingField(["content"]);
|
||||
|
||||
// Get logged in user
|
||||
@@ -77,9 +77,11 @@ class Posts extends Api
|
||||
|
||||
public function delete($id): void
|
||||
{
|
||||
// Fetch ax(0, intval(Input::get("p", 0)));
|
||||
$limit = constrain(0, 30, intval(Input::get("l", 10)));
|
||||
// Try delete, 404 if post was not found.
|
||||
try {
|
||||
Response::json(Post::getByID($id)->delete());
|
||||
Response::json(Post::getByID($id)->delete($limit));
|
||||
} catch (Exception $err) {
|
||||
switch ($err->getMessage()) {
|
||||
case "NotFound":
|
||||
|
||||
@@ -281,7 +281,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/PostResponse"
|
||||
$ref: "#/components/schemas/PostDeleteResponse"
|
||||
404:
|
||||
description: Post not found.
|
||||
content:
|
||||
@@ -697,6 +697,8 @@ components:
|
||||
type: number
|
||||
post:
|
||||
$ref: "#/components/schemas/PostResponse"
|
||||
PostDeleteResponse:
|
||||
$ref: "#/components/schemas/PostCreateResponse"
|
||||
PostListResponse:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user