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,33 +47,48 @@ paths:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: array
|
type: object
|
||||||
items:
|
properties:
|
||||||
$ref: '#/components/schemas/Parameter'
|
images:
|
||||||
example: [
|
type: array
|
||||||
{
|
items:
|
||||||
"id": 1,
|
$ref: '#/components/schemas/Image'
|
||||||
"title": "A thing happening somewhere",
|
params:
|
||||||
"type": 1,
|
type: array
|
||||||
"icon": null,
|
items:
|
||||||
"icon_gray": null
|
$ref: '#/components/schemas/Parameter'
|
||||||
},
|
example: {
|
||||||
{
|
"images": [
|
||||||
"id": 2,
|
{
|
||||||
"title": "The fox jumping over a cat",
|
|
||||||
"type": 1,
|
|
||||||
"icon": {
|
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"original_name": "fox_jump.jpeg",
|
"sha256": "0000000000000000000000000000000000000000000000000000000000000000",
|
||||||
"sha256": "SHA256"
|
"original_name": "filename.svg",
|
||||||
|
"mime": "image/svg+xml"
|
||||||
},
|
},
|
||||||
"icon_gray": {
|
{
|
||||||
|
"id": 1,
|
||||||
|
"sha256": "0000000000000000000000000000000000000000000000000000000000000001",
|
||||||
|
"original_name": "filename.svg",
|
||||||
|
"mime": "image/svg+xml"
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"params": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"title": "A thing happening somewhere",
|
||||||
|
"type": 1,
|
||||||
|
"icon": null,
|
||||||
|
"icon_gray": null
|
||||||
|
},
|
||||||
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"original_name": "fox_jump.gray.jpeg",
|
"title": "The fox jumping over a cat",
|
||||||
"sha256": "SHA256"
|
"type": 1,
|
||||||
|
"icon_id": 1,
|
||||||
|
"icon_gray_id": 2,
|
||||||
}
|
}
|
||||||
}
|
],
|
||||||
]
|
}
|
||||||
components:
|
components:
|
||||||
schemas:
|
schemas:
|
||||||
Image:
|
Image:
|
||||||
|
|
Loading…
Reference in New Issue