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