fix: unfuck list API
This commit is contained in:
parent
b85dd5ff13
commit
917abfc03c
|
@ -12,7 +12,10 @@ class ApiController extends \yii\rest\Controller
|
||||||
{
|
{
|
||||||
public function actionIndex()
|
public function actionIndex()
|
||||||
{
|
{
|
||||||
return Parameter::find()->with(['icon', 'iconGray'])->all();
|
return [
|
||||||
|
'images' => Image::find()->join('INNER JOIN', 'parameters', 'parameters.icon_id = image.id OR parameters.icon_gray_id = image.id')->all(),
|
||||||
|
'params' => Parameter::find()->all(),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionImage(Request $request, Response $response)
|
public function actionImage(Request $request, Response $response)
|
||||||
|
|
|
@ -47,10 +47,32 @@ paths:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
images:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Image'
|
||||||
|
params:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Parameter'
|
$ref: '#/components/schemas/Parameter'
|
||||||
example: [
|
example: {
|
||||||
|
"images": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"sha256": "0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"original_name": "filename.svg",
|
||||||
|
"mime": "image/svg+xml"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"sha256": "0000000000000000000000000000000000000000000000000000000000000001",
|
||||||
|
"original_name": "filename.svg",
|
||||||
|
"mime": "image/svg+xml"
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"params": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"title": "A thing happening somewhere",
|
"title": "A thing happening somewhere",
|
||||||
|
@ -62,18 +84,11 @@ paths:
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"title": "The fox jumping over a cat",
|
"title": "The fox jumping over a cat",
|
||||||
"type": 1,
|
"type": 1,
|
||||||
"icon": {
|
"icon_id": 1,
|
||||||
"id": 1,
|
"icon_gray_id": 2,
|
||||||
"original_name": "fox_jump.jpeg",
|
|
||||||
"sha256": "SHA256"
|
|
||||||
},
|
|
||||||
"icon_gray": {
|
|
||||||
"id": 2,
|
|
||||||
"original_name": "fox_jump.gray.jpeg",
|
|
||||||
"sha256": "SHA256"
|
|
||||||
}
|
}
|
||||||
|
],
|
||||||
}
|
}
|
||||||
]
|
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
Image:
|
Image:
|
||||||
|
|
Loading…
Reference in New Issue