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()
|
||||
{
|
||||
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)
|
||||
|
|
|
@ -47,10 +47,32 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
images:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Image'
|
||||
params:
|
||||
type: array
|
||||
items:
|
||||
$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,
|
||||
"title": "A thing happening somewhere",
|
||||
|
@ -62,18 +84,11 @@ paths:
|
|||
"id": 2,
|
||||
"title": "The fox jumping over a cat",
|
||||
"type": 1,
|
||||
"icon": {
|
||||
"id": 1,
|
||||
"original_name": "fox_jump.jpeg",
|
||||
"sha256": "SHA256"
|
||||
},
|
||||
"icon_gray": {
|
||||
"id": 2,
|
||||
"original_name": "fox_jump.gray.jpeg",
|
||||
"sha256": "SHA256"
|
||||
"icon_id": 1,
|
||||
"icon_gray_id": 2,
|
||||
}
|
||||
],
|
||||
}
|
||||
]
|
||||
components:
|
||||
schemas:
|
||||
Image:
|
||||
|
|
Loading…
Reference in New Issue