Skip to content

Commit 1ca14f2

Browse files
authored
Merge pull request #138 from Facts-and-Files/feat/storyFieldList
feat: add fieldList parameter to story index response
2 parents e02b948 + 5fc41ec commit 1ca14f2

File tree

5 files changed

+27
-22
lines changed

5 files changed

+27
-22
lines changed

src/app/Http/Controllers/ResponseController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ protected function filterDataByFieldlist(
177177
$fieldlist[] = $queries['orderBy'] ?? $initialSortColumn;
178178
$fieldlist = array_merge($defaults, $fieldlist);
179179
$fieldlist = array_unique($fieldlist);
180-
$dataArray = $data->toArray()[0] ?: $data->toArray();
180+
$dataArray = $data->toArray()[0] ?? $data->toArray();
181181
$fieldsToRemove = array_filter(array_keys($dataArray), function($field) use ($fieldlist) {
182182
return !in_array($field, $fieldlist);
183183
});

src/app/Http/Controllers/StoryController.php

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public function index(Request $request): JsonResponse
2828

2929
$data = $this->getDataByRequest($request, $model, $queryColumns, $initialSortColumn);
3030

31+
$data = $this->filterDataByFieldlist($data, $request, ['StoryId'], $initialSortColumn);
32+
3133
if (!$data) {
3234
return $this->sendError('Invalid data', $request . ' not valid', 400);
3335
}
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
window.onload = function() {
2-
//<editor-fold desc="Changeable Configuration Block">
3-
4-
// the following lines will be replaced by docker/configurator, when it runs in a docker-container
5-
window.ui = SwaggerUIBundle({
6-
url: window.location.origin + "/v2/documentation/api-docs.yaml",
7-
dom_id: '#swagger-ui',
8-
// deepLinking: true,
9-
persistAuthorization: true,
10-
filter: true,
11-
presets: [
12-
SwaggerUIBundle.presets.apis,
13-
SwaggerUIStandalonePreset
14-
],
15-
plugins: [
16-
SwaggerUIBundle.plugins.DownloadUrl
17-
],
18-
layout: "StandaloneLayout"
19-
});
20-
21-
//</editor-fold>
2+
window.ui = SwaggerUIBundle({
3+
url: window.location.origin + "/v2/documentation/api-docs.yaml",
4+
dom_id: '#swagger-ui',
5+
docExpansion: 'none',
6+
deepLinking: true,
7+
persistAuthorization: true,
8+
filter: true,
9+
defaultModelsExpandDepth: 0,
10+
docExpansion: 'none',
11+
tagsSorter: 'alpha',
12+
presets: [
13+
SwaggerUIBundle.presets.apis,
14+
SwaggerUIStandalonePreset,
15+
],
16+
plugins: [
17+
// SwaggerUIBundle.plugins.DownloadUrl
18+
],
19+
layout: 'StandaloneLayout',
20+
});
2221
};

src/storage/api-docs/api-docs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
openapi: 3.1.1
22

33
info:
4-
version: 1.56.0
4+
version: 1.57.0
55
title: Transcribathon Platform API v2
66
description: This is the documentation of the Transcribathon API v2 used by [https:transcribathon.eu](https://transcribathon.eu/).<br />
77
For authorization you can use the the bearer token you are provided with.

src/storage/api-docs/stories-path.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ get:
3737
description: Determine the type of query for the parameter (DcTitle, RecordId). If set, a broad search ( LIKE %term%) is processed otherwise the exact term is searched for
3838
schema:
3939
type: boolean
40+
- in: query
41+
name: fieldlist
42+
description: Comma-separated list of fields that will be shown in the response
43+
type: string
4044
responses:
4145
200:
4246
description: Ok

0 commit comments

Comments
 (0)