Skip to content

Commit fe72c47

Browse files
author
Anton
authored
Merge pull request #19 from bluzphp/develop
Migrate to new Swagger
2 parents ea1e1d7 + a4b2afb commit fe72c47

File tree

12 files changed

+132
-147
lines changed

12 files changed

+132
-147
lines changed

application/models/Test/Row.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
* @property string $email
2121
* @property string $status enum('active','disable','delete')
2222
*
23-
* @SWG\Definition(definition="test", title="test", required={"id", "name", "email"})
24-
* @SWG\Property(property="id", type="integer")
25-
* @SWG\Property(property="name", type="string")
26-
* @SWG\Property(property="email", type="string")
27-
* @SWG\Property(property="status", type="string", enum={"active","disable","delete"})
23+
* @OA\Schema(schema="test", title="test", required={"id", "name", "email"})
24+
* @OA\Property(property="id", type="integer")
25+
* @OA\Property(property="name", type="string")
26+
* @OA\Property(property="email", type="string")
27+
* @OA\Property(property="status", type="string", enum={"active","disable","delete"})
2828
*/
2929
class Row extends \Bluz\Db\Row
3030
{

application/modules/test/api.php

Lines changed: 119 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -9,132 +9,140 @@
99
*/
1010

1111
/**
12-
* @SWG\Get(
13-
* path="/test/rest/",
14-
* tags={"test"},
15-
* method="GET",
16-
* operationId="getTestCollection",
17-
* summary="Collection of items",
18-
* @SWG\Parameter(ref="#/parameters/offset"),
19-
* @SWG\Parameter(ref="#/parameters/limit"),
20-
* @SWG\Response(response=200, description="Collection present"),
21-
* @SWG\Response(response=206, description="Collection present")
12+
* @OA\Get(
13+
* path="/test/rest/",
14+
* tags={"test"},
15+
* method="GET",
16+
* operationId="getTestCollection",
17+
* summary="Collection of items",
18+
* @OA\Parameter(ref="#/components/parameters/offset_in_query"),
19+
* @OA\Parameter(ref="#/components/parameters/limit_in_query"),
20+
* @OA\Response(
21+
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/test")),
22+
* response=200,
23+
* description="Collection"
24+
* ),
25+
* @OA\Response(
26+
* @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/test")),
27+
* response=206,
28+
* description="Collection (partial)"
29+
* )
2230
* )
2331
*
24-
* @SWG\Put(
25-
* path="/test/rest/",
26-
* tags={"test"},
27-
* operationId="updateTestCollection",
28-
* summary="Try to update Collection",
29-
* @SWG\Response(@SWG\Schema(ref="#/definitions/error"), response=501, description="Not Implemented")
32+
* @OA\Put(
33+
* path="/test/rest/",
34+
* tags={"test"},
35+
* operationId="updateTestCollection",
36+
* summary="Try to update Collection",
37+
* @OA\Response(@OA\JsonContent(ref="#/components/schemas/error"), response=501, description="Not Implemented")
3038
* )
3139
*
32-
* @SWG\Delete(
33-
* path="/test/rest/",
34-
* tags={"test"},
35-
* operationId="deleteTestCollection",
36-
* summary="Try to delete Collection",
37-
* @SWG\Response(@SWG\Schema(ref="#/definitions/error"), response=400, description="Not Found")
40+
* @OA\Delete(
41+
* path="/test/rest/",
42+
* tags={"test"},
43+
* operationId="deleteTestCollection",
44+
* summary="Try to delete Collection",
45+
* @OA\Response(@OA\JsonContent(ref="#/components/schemas/error"), response=400, description="Not Found")
3846
* )
3947
*/
4048

4149
/**
42-
* @SWG\Get(
43-
* path="/test/rest/{itemId}",
44-
* tags={"test"},
45-
* operationId="getTestById",
46-
* summary="Find item by ID",
47-
* @SWG\Parameter(
48-
* name="itemId",
49-
* in="path",
50-
* description="ID of item that needs to be fetched",
51-
* required=true,
52-
* type="integer"
53-
* ),
54-
* @SWG\Response(@SWG\Schema(ref="#/definitions/test"), response=200, description="Given item found"),
55-
* @SWG\Response(@SWG\Schema(ref="#/definitions/error"), response=404, description="Item not found")
50+
* @OA\Get(
51+
* path="/test/rest/{itemId}",
52+
* tags={"test"},
53+
* operationId="getTestById",
54+
* summary="Find item by ID",
55+
* @OA\Parameter(
56+
* name="itemId",
57+
* in="path",
58+
* description="ID of item that needs to be fetched",
59+
* required=true,
60+
* @OA\Schema(type="integer")
61+
* ),
62+
* @OA\Response(@OA\JsonContent(ref="#/components/schemas/test"), response=200, description="Given item found"),
63+
* @OA\Response(@OA\JsonContent(ref="#/components/schemas/error"), response=404, description="Item Not Found")
5664
* )
5765
*
58-
* @SWG\Post(
59-
* path="/test/rest/",
60-
* tags={"test"},
61-
* operationId="createTest",
62-
* summary="Create Item",
63-
* @SWG\Parameter(
64-
* name="name",
65-
* in="formData",
66-
* description="Name",
67-
* required=true,
68-
* type="string",
69-
* ),
70-
* @SWG\Parameter(
71-
* name="email",
72-
* in="formData",
73-
* description="Email",
74-
* required=true,
75-
* type="string",
76-
* ),
77-
* @SWG\Response(response=201, description="Item created, will return Location of created item"),
78-
* @SWG\Response(response=400, description="Validation errors")
66+
* @OA\Post(
67+
* path="/test/rest/",
68+
* tags={"test"},
69+
* operationId="createTest",
70+
* summary="Create Item",
71+
* @OA\Parameter(
72+
* name="name",
73+
* in="query",
74+
* description="Name",
75+
* required=true,
76+
* @OA\Schema(type="string")
77+
* ),
78+
* @OA\Parameter(
79+
* name="email",
80+
* in="query",
81+
* description="Email",
82+
* required=true,
83+
* @OA\Schema(type="string")
84+
* ),
85+
* @OA\Response(response=201, description="Item created, will return Location of created item"),
86+
* @OA\Response(@OA\JsonContent(ref="#/components/schemas/error"), response=400, description="Validation errors")
7987
* )
8088
*
81-
* @SWG\Post(
82-
* path="/test/rest/{itemId}",
83-
* tags={"test"},
84-
* operationId="createTestWithId",
85-
* summary="Try to create Item", *
86-
* @SWG\Parameter(
87-
* name="itemId",
88-
* in="path",
89-
* description="ID of item that needs to be removed",
90-
* required=true,
91-
* type="integer"
92-
* ),
93-
* @SWG\Response(@SWG\Schema(ref="#/definitions/error"), response=501, description="Not Implemented")
89+
* @OA\Post(
90+
* path="/test/rest/{itemId}",
91+
* tags={"test"},
92+
* operationId="createTestWithId",
93+
* summary="Try to create Item", *
94+
* @OA\Parameter(
95+
* name="itemId",
96+
* in="path",
97+
* description="ID of item that needs to be removed",
98+
* required=true,
99+
* @OA\Schema(type="integer")
100+
* ),
101+
* @OA\Response(@OA\JsonContent(ref="#/components/schemas/error"), response=501, description="Not Implemented")
94102
* )
95103
*
96-
* @SWG\Put(
97-
* path="/test/rest/{itemId}",
98-
* tags={"test"},
99-
* operationId="updateTest",
100-
* summary="Update Item",
101-
* @SWG\Parameter(
102-
* name="itemId",
103-
* in="path",
104-
* description="ID of item that needs to be updated",
105-
* required=true,
106-
* type="integer"
107-
* ),
108-
* @SWG\Parameter(
109-
* name="name",
110-
* in="formData",
111-
* description="Name",
112-
* required=false,
113-
* type="string",
114-
* ),
115-
* @SWG\Parameter(
116-
* name="email",
117-
* in="formData",
118-
* description="Email",
119-
* required=false,
120-
* type="string",
121-
* ),
122-
* @SWG\Response(@SWG\Schema(ref="#/definitions/error"), response=404, description="Item not found")
104+
* @OA\Put(
105+
* path="/test/rest/{itemId}",
106+
* tags={"test"},
107+
* operationId="updateTest",
108+
* summary="Update Item",
109+
* @OA\Parameter(
110+
* name="itemId",
111+
* in="path",
112+
* description="ID of item that needs to be updated",
113+
* required=true,
114+
* @OA\Schema(type="integer")
115+
* ),
116+
* @OA\Parameter(
117+
* name="name",
118+
* in="query",
119+
* description="Name",
120+
* required=false,
121+
* @OA\Schema(type="string")
122+
* ),
123+
* @OA\Parameter(
124+
* name="email",
125+
* in="query",
126+
* description="Email",
127+
* required=false,
128+
* @OA\Schema(type="string")
129+
* ),
130+
* @OA\Response(@OA\JsonContent(ref="#/components/schemas/error"), response=404, description="Item Not Found")
123131
* )
124132
*
125-
* @SWG\Delete(
126-
* path="/test/rest/{itemId}",
127-
* tags={"test"},
128-
* operationId="deleteTest",
129-
* summary="Delete Item",
130-
* @SWG\Parameter(
131-
* name="itemId",
132-
* in="path",
133-
* description="ID of item that needs to be removed",
134-
* required=true,
135-
* type="integer"
136-
* ),
137-
* @SWG\Response(response=204, description="Item removed"),
138-
* @SWG\Response(response=404, description="Item not found")
133+
* @OA\Delete(
134+
* path="/test/rest/{itemId}",
135+
* tags={"test"},
136+
* operationId="deleteTest",
137+
* summary="Delete Item",
138+
* @OA\Parameter(
139+
* name="itemId",
140+
* in="path",
141+
* description="ID of item that needs to be removed",
142+
* required=true,
143+
* @OA\Schema(type="integer")
144+
* ),
145+
* @OA\Response(@OA\JsonContent(ref="#/components/schemas/test"), response=204, description="Item removed"),
146+
* @OA\Response(@OA\JsonContent(ref="#/components/schemas/error"), response=404, description="Item Not Found")
139147
* )
140148
*/

application/modules/test/init.php

Lines changed: 0 additions & 22 deletions
This file was deleted.

application/modules/test/views/cache-controller.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Layout::breadCrumbs(
1212
);
1313
$url = $this->url('test', 'cache-controller', ['a' => random_int(1, 5)]);
1414

15-
$enabled = \Bluz\Proxy\Config::getData('cache', 'enabled');
15+
$enabled = \Bluz\Proxy\Config::get('cache', 'enabled');
1616

1717
if (!$enabled) :
1818
?>

application/modules/test/views/cache-data.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* @var Application\Users\Row $user
44
*/
5-
$enabled = \Bluz\Proxy\Config::getData('cache', 'enabled');
5+
$enabled = \Bluz\Proxy\Config::get('cache', 'enabled');
66

77
if (!$enabled) :
88
?>

application/modules/test/views/grid-sql.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ if (!$grid) {
4747
<td><?= $row['id'] ?></td>
4848
<td><?= $row['name'] ?></td>
4949
<td><?= $row['status'] ?></td>
50-
<td class="controls">
50+
<td class="controls d-flex justify-content-around">
5151
<a href="<?= $this->url('test', 'crud', ['id' => $row['id']]) ?>" class="btn btn-primary"
5252
data-ajax-dialog data-ajax-method="get">
5353
<i class="fa fa-pencil"></i>

application/modules/test/views/index.phtml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,7 @@ $this->headScript($this->baseUrl('js/test/config.js'));
258258
); ?>
259259
<div>
260260
<select class="form-control" name="formName"
261-
data-ajax-load
262-
data-ajax-source="/test/ajax-form"
261+
data-ajax-load="/test/ajax-form"
263262
data-ajax-target="#load">
264263
<option value="">Select Form</option>
265264
<option value="first-form">First</option>

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"description": "Bluz test module",
66
"require": {
77
"bluzphp/composer-plugin": "~2.1",
8-
"fzaninotto/faker": "~1.6"
8+
"fzaninotto/faker": "~1.8"
99
}
1010
}

public/js/test/config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
require.config({
22
paths: {
33
pager: './test/pager',
4-
text: './vendor/text',
5-
jsx: './vendor/jsx',
6-
JSXTransformer: './vendor/JSXTransformer',
4+
text: './../vendor/text/text',
5+
jsx: './../vendor/jsx/jsx',
6+
JSXTransformer: './../vendor/jsx/JSXTransformer',
77
// see more at https://cdnjs.com/
88
underscore: '//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore',
99
backbone: '//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.3.3/backbone',

0 commit comments

Comments
 (0)