API: Wrapped lists in data objects, specified datetime format
This commit is contained in:
parent
1505d0229d
commit
ca0a69b17d
|
@ -96,10 +96,14 @@ components:
|
|||
description: True if the news should be highlightet and shown on the dashboard
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
description: DateTime in ISO-8601 format
|
||||
example: 2023-05-13T13:37:42.000000Z
|
||||
updated_at:
|
||||
type: string
|
||||
nullable: true
|
||||
format: date-time
|
||||
description: DateTime in ISO-8601 format
|
||||
example: 2023-05-13T23:00:00.000000Z
|
||||
Room:
|
||||
type: object
|
||||
|
@ -124,9 +128,13 @@ components:
|
|||
example: You clean up the venue after the event, its fun, we promise!
|
||||
start:
|
||||
type: string
|
||||
format: date-time
|
||||
description: DateTime in ISO-8601 format
|
||||
example: 2023-05-13T14:00:00.000000Z
|
||||
end:
|
||||
type: string
|
||||
format: date-time
|
||||
description: DateTime in ISO-8601 format
|
||||
example: 2023-05-13T16:00:00.000000Z23
|
||||
entries:
|
||||
type: array
|
||||
|
@ -139,10 +147,14 @@ components:
|
|||
created_at:
|
||||
type: string
|
||||
nullable: true
|
||||
format: date-time
|
||||
description: DateTime in ISO-8601 format
|
||||
example: 2023-05-13T13:37:42.000000Z
|
||||
updated_at:
|
||||
type: string
|
||||
nullable: true
|
||||
format: date-time
|
||||
description: DateTime in ISO-8601 format
|
||||
example: 2023-05-13T23:00:00.000000Z
|
||||
ShiftEntry:
|
||||
type: object
|
||||
|
@ -211,6 +223,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/AngelType'
|
||||
|
@ -230,6 +245,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/News'
|
||||
|
@ -249,6 +267,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Room'
|
||||
|
@ -276,6 +297,9 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Shift'
|
||||
|
|
|
@ -64,7 +64,8 @@ class ApiController extends BaseController
|
|||
->orderByDesc('created_at')
|
||||
->get(['id', 'title', 'text', 'is_meeting', 'is_pinned', 'is_highlighted', 'created_at', 'updated_at']);
|
||||
|
||||
$data = ['data' => $news];
|
||||
return $this->response
|
||||
->withContent(json_encode($news));
|
||||
->withContent(json_encode($data));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,8 @@ class ApiControllerTest extends ControllerTest
|
|||
$this->assertJson($response->getContent());
|
||||
|
||||
$data = json_decode($response->getContent(), true);
|
||||
$this->assertCount(3, $data);
|
||||
$this->assertArrayHasKey('data', $data);
|
||||
$this->assertCount(3, $data['data']);
|
||||
}
|
||||
|
||||
public function setUp(): void
|
||||
|
|
Loading…
Reference in New Issue