diff --git a/exam/api/Users/Users.php b/exam/api/Users/Users.php index 1bf0512..de61baa 100644 --- a/exam/api/Users/Users.php +++ b/exam/api/Users/Users.php @@ -42,12 +42,12 @@ class Users extends Api // Fetch all inputs. $username = Input::patch("username"); $password = Input::patch("password"); - $image = Input::file("image"); + $email = Input::patch("email"); // Try and update user. // Throw errors according to situation. try { - Response::json(User::getByID($id)->update($username, $password, $image)); + Response::json(User::getByID($id)->update($username, $password, $email)); } catch (Exception $err) { switch ($err->getMessage()) { case "NotFound": @@ -65,12 +65,12 @@ class Users extends Api $token = Request::token(); $username = Input::patch("username"); $password = Input::patch("password"); - $image = Input::file("image"); + $email = Input::patch("email"); // Try and update user. // Throw errors according to situation. try { - Response::json(User::getByToken($token)->update($username, $password, $image)); + Response::json(User::getByToken($token)->update($username, $password, $email)); } catch (Exception $err) { switch ($err->getMessage()) { case "NotFound": diff --git a/exam/api/docs/api.yaml b/exam/api/docs/api.yaml index ddde78e..52f0dd6 100644 --- a/exam/api/docs/api.yaml +++ b/exam/api/docs/api.yaml @@ -254,7 +254,12 @@ paths: $ref: "#/components/schemas/FailedUpdateResponse" examples: Failed: - value: { "code": "FailedUpdate", "fields": ["content"] } + value: + { + "code": "FailedUpdate", + "fields": ["content"], + "reasons": ["string"], + } tags: - Post delete: @@ -481,7 +486,8 @@ paths: value: { "code": "FailedUpdate", - "fields": ["username", "password", "image"], + "fields": ["username", "password", "email"], + "reasons": ["string", "string", "string"], } tags: - User @@ -572,6 +578,10 @@ components: type: array items: type: string + reasons: + type: array + items: + type: string ErrorResponse: type: object properties: @@ -629,9 +639,8 @@ components: type: string password: type: string - image: + email: type: string - format: binary RegisterRequest: type: object required: diff --git a/exam/api/docs/index.html b/exam/api/docs/index.html index fa46510..c6b185c 100644 --- a/exam/api/docs/index.html +++ b/exam/api/docs/index.html @@ -490,13 +490,13 @@ data-styled.g137[id="sc-kvXgyf"]{content:"fBvPoH,"}/*!sc*/ " class="sc-euGpHm sc-exayXG fwfkcU kqJXdD">
Update user with ID.
Use special ID self to update logged in user.
Requires logged in user to have admin permissions for any ID other than self.
| id required | integer <int14> User ID - |
| username | string |
| password | string |
| image | string <binary> |
{- "username": "string",
- "password": "string",
- "email": "string"
} {- "id": 0,
- "username": "string",
- "status": 0,
- "email": "string",
- "image": "string",
- "isAdmin": true,
- "memberSince":
{- "date": "2019-08-24T14:15:22Z",
- "timezone_type": 0,
- "timezone": "string"
}, - "postCount": 0
}Delete user with ID.
| id required | integer <int14> User ID @@ -506,7 +506,7 @@ data-styled.g137[id="sc-kvXgyf"]{content:"fBvPoH,"}/*!sc*/ " class="sc-euGpHm sc-exayXG fwfkcU kqJXdD sc-dHrNzZ dRdjww">User not found. Response samples
Content type application/json Copy |