User List
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Api\Users;
|
||||
|
||||
use Khofmann\Api\Api;
|
||||
use Khofmann\Models\User\User;
|
||||
use Khofmann\Response\Response;
|
||||
|
||||
class Users extends Api
|
||||
{
|
||||
public function get()
|
||||
{
|
||||
Response::json(User::list());
|
||||
}
|
||||
}
|
||||
+75
-2
@@ -158,6 +158,57 @@ paths:
|
||||
value: { "message": "User not found" }
|
||||
tags:
|
||||
- Register
|
||||
/users:
|
||||
get:
|
||||
summary: List users
|
||||
description: List all users. <br>
|
||||
Requires logged in user to have admin permissions.
|
||||
security:
|
||||
- BasicAuth: []
|
||||
responses:
|
||||
200:
|
||||
description: Success
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/UserListResponse"
|
||||
examples:
|
||||
Success:
|
||||
value:
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"username": "Admin",
|
||||
"status": 1,
|
||||
"email": "marvin@zedat.fu-berlin.de",
|
||||
"image": "669d41fbdb56b.png",
|
||||
"isAdmin": true,
|
||||
"memberSince":
|
||||
{
|
||||
"date": "2024-07-22 14:02:49.000000",
|
||||
"timezone_type": 3,
|
||||
"timezone": "Europe/Berlin",
|
||||
},
|
||||
"postCount": 3,
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"username": "Max",
|
||||
"status": 1,
|
||||
"email": "max@moritz.net",
|
||||
"image": "profilbilder/max.svg",
|
||||
"isAdmin": false,
|
||||
"memberSince":
|
||||
{
|
||||
"date": "2024-07-22 03:07:41.000000",
|
||||
"timezone_type": 3,
|
||||
"timezone": "Europe/Berlin",
|
||||
},
|
||||
"postCount": 2,
|
||||
},
|
||||
]
|
||||
tags:
|
||||
- User
|
||||
/user{id}:
|
||||
get:
|
||||
summary: Get user
|
||||
@@ -187,8 +238,15 @@ paths:
|
||||
"username": "Admin",
|
||||
"status": 1,
|
||||
"email": "marvin@zedat.fu-berlin.de",
|
||||
"image": "profilbilder\\/admin.svg",
|
||||
"image": "669d41fbdb56b.png",
|
||||
"isAdmin": true,
|
||||
"memberSince":
|
||||
{
|
||||
"date": "2024-07-22 14:02:49.000000",
|
||||
"timezone_type": 3,
|
||||
"timezone": "Europe/Berlin",
|
||||
},
|
||||
"postCount": 3,
|
||||
}
|
||||
404:
|
||||
description: User not found
|
||||
@@ -328,6 +386,18 @@ components:
|
||||
nullable: true
|
||||
isAdmin:
|
||||
type: boolean
|
||||
memberSince:
|
||||
type: object
|
||||
properties:
|
||||
date:
|
||||
type: string
|
||||
format: date-time
|
||||
timezone_type:
|
||||
type: number
|
||||
timezone:
|
||||
type: string
|
||||
postCount:
|
||||
type: number
|
||||
UserUpdateRequest:
|
||||
type: object
|
||||
properties:
|
||||
@@ -359,12 +429,15 @@ components:
|
||||
code:
|
||||
type: string
|
||||
format: uuid4
|
||||
UserListResponse:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/UserResponse"
|
||||
securitySchemes:
|
||||
BasicAuth:
|
||||
type: apiKey
|
||||
name: token
|
||||
in: header
|
||||
format: uuid4
|
||||
tags:
|
||||
- name: Login/Logout
|
||||
- name: Register
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user