Skip to content

Commit 6aa5924

Browse files
authored
Scribe Annotations (#130)
1 parent d7a6f1b commit 6aa5924

24 files changed

+343
-43
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"autoload-dev": {
5454
"psr-4": {
5555
"Cachet\\Tests\\": "tests",
56+
"Cachet\\Database\\Factories\\": "database/factories",
5657
"Workbench\\App\\": "workbench/app/",
5758
"Workbench\\Database\\Factories\\": "workbench/database/factories/",
5859
"Workbench\\Database\\Seeders\\": "workbench/database/seeders/"

database/factories/ScheduleComponentFactory.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44

55
use Cachet\Enums\ComponentStatusEnum;
66
use Cachet\Models\Component;
7-
use Cachet\Models\Incident;
87
use Cachet\Models\Schedule;
98
use Cachet\Models\ScheduleComponent;
109
use Illuminate\Database\Eloquent\Factories\Factory;
1110

1211
/**
13-
* @extends Factory<Incident>
12+
* @extends Factory<ScheduleComponent>
1413
*/
1514
class ScheduleComponentFactory extends Factory
1615
{

src/Http/Controllers/Api/ComponentController.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@
1313
use Illuminate\Routing\Controller;
1414
use Spatie\QueryBuilder\QueryBuilder;
1515

16+
/**
17+
* @group Components
18+
*/
1619
class ComponentController extends Controller
1720
{
1821
/**
19-
* List Components.
22+
* List Components
23+
*
24+
* @apiResourceCollection \Cachet\Http\Resources\Component
25+
* @apiResourceModel \Cachet\Models\Component
2026
*/
2127
public function index()
2228
{
@@ -30,7 +36,11 @@ public function index()
3036
}
3137

3238
/**
33-
* Create Component.
39+
* Create Component
40+
*
41+
* @apiResource \Cachet\Http\Resources\Component
42+
* @apiResourceModel \Cachet\Models\Component
43+
* @authenticated
3444
*/
3545
public function store(CreateComponentRequest $request, CreateComponent $createComponentAction)
3646
{
@@ -40,7 +50,10 @@ public function store(CreateComponentRequest $request, CreateComponent $createCo
4050
}
4151

4252
/**
43-
* Get Component.
53+
* Get Component
54+
*
55+
* @apiResource \Cachet\Http\Resources\Component
56+
* @apiResourceModel \Cachet\Models\Component
4457
*/
4558
public function show(Component $component)
4659
{
@@ -50,7 +63,11 @@ public function show(Component $component)
5063
}
5164

5265
/**
53-
* Update Component.
66+
* Update Component
67+
*
68+
* @apiResource \Cachet\Http\Resources\Component
69+
* @apiResourceModel \Cachet\Models\Component
70+
* @authenticated
5471
*/
5572
public function update(UpdateComponentRequest $request, Component $component, UpdateComponent $updateComponentAction)
5673
{
@@ -60,7 +77,10 @@ public function update(UpdateComponentRequest $request, Component $component, Up
6077
}
6178

6279
/**
63-
* Delete Component.
80+
* Delete Component
81+
*
82+
* @response 204
83+
* @authenticated
6484
*/
6585
public function destroy(Component $component, DeleteComponent $deleteComponentAction)
6686
{

src/Http/Controllers/Api/ComponentGroupController.php

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@
1313
use Illuminate\Routing\Controller;
1414
use Spatie\QueryBuilder\QueryBuilder;
1515

16+
/**
17+
* @group Component Groups
18+
*/
1619
class ComponentGroupController extends Controller
1720
{
1821
/**
19-
* List Component Groups.
22+
* List Component Groups
23+
*
24+
* @apiResource \Cachet\Http\Resources\ComponentGroup
25+
* @apiResourceModel \Cachet\Models\ComponentGroup
2026
*/
2127
public function index()
2228
{
@@ -29,7 +35,11 @@ public function index()
2935
}
3036

3137
/**
32-
* Create Component Group.
38+
* Create Component Group
39+
*
40+
* @apiResource \Cachet\Http\Resources\ComponentGroup
41+
* @apiResourceModel \Cachet\Models\ComponentGroup
42+
* @authenticated
3343
*/
3444
public function store(CreateComponentGroupRequest $request, CreateComponentGroup $createComponentGroupAction)
3545
{
@@ -41,7 +51,10 @@ public function store(CreateComponentGroupRequest $request, CreateComponentGroup
4151
}
4252

4353
/**
44-
* Get Component Group.
54+
* Get Component Group
55+
*
56+
* @apiResource \Cachet\Http\Resources\ComponentGroup
57+
* @apiResourceModel \Cachet\Models\ComponentGroup
4558
*/
4659
public function show(ComponentGroup $componentGroup)
4760
{
@@ -52,6 +65,10 @@ public function show(ComponentGroup $componentGroup)
5265

5366
/**
5467
* Update Component Group
68+
*
69+
* @apiResource \Cachet\Http\Resources\ComponentGroup
70+
* @apiResourceModel \Cachet\Models\ComponentGroup
71+
* @authenticated
5572
*/
5673
public function update(UpdateComponentGroupRequest $request, ComponentGroup $componentGroup, UpdateComponentGroup $updateComponentGroupAction)
5774
{
@@ -63,7 +80,11 @@ public function update(UpdateComponentGroupRequest $request, ComponentGroup $com
6380
}
6481

6582
/**
66-
* Delete Component Group.
83+
* Delete Component Group
84+
*
85+
* @apiResource \Cachet\Http\Resources\ComponentGroup
86+
* @apiResourceModel \Cachet\Models\ComponentGroup
87+
* @authenticated
6788
*/
6889
public function destroy(ComponentGroup $componentGroup, DeleteComponentGroup $deleteComponentGroupAction)
6990
{

src/Http/Controllers/Api/GeneralController.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,31 @@
66
use Illuminate\Http\JsonResponse;
77
use Illuminate\Routing\Controller;
88

9+
/**
10+
* @group Cachet
11+
*/
912
class GeneralController extends Controller
1013
{
1114
/**
12-
* Ping the API.
15+
* Test the API
16+
*
17+
* @response {
18+
* "data": "Pong!"
19+
* }
1320
*/
1421
public function ping(): JsonResponse
1522
{
1623
return response()->json(['data' => 'Pong!']);
1724
}
1825

1926
/**
20-
* Get the Cachet version.
27+
* Get Version
28+
*
29+
* @response {
30+
* "data": {
31+
* "version": "3.x-dev"
32+
* }
33+
* }
2134
*/
2235
public function version(): JsonResponse
2336
{

src/Http/Controllers/Api/IncidentController.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@
1414
use Illuminate\Routing\Controller;
1515
use Spatie\QueryBuilder\QueryBuilder;
1616

17+
/**
18+
* @group Incidents
19+
*/
1720
class IncidentController extends Controller
1821
{
1922
/**
20-
* List Incidents.
23+
* List Incidents
24+
*
25+
* @apiResourceCollection \Cachet\Http\Resources\Incident
26+
* @apiResourceModel \Cachet\Models\Incident
2127
*/
2228
public function index()
2329
{
@@ -34,7 +40,11 @@ public function index()
3440
}
3541

3642
/**
37-
* Create Incident.
43+
* Create Incident
44+
*
45+
* @apiResource \Cachet\Http\Resources\Incident
46+
* @apiResourceModel \Cachet\Models\Incident
47+
* @authenticated
3848
*/
3949
public function store(CreateIncidentRequest $request, CreateIncident $createIncidentAction)
4050
{
@@ -44,7 +54,10 @@ public function store(CreateIncidentRequest $request, CreateIncident $createInci
4454
}
4555

4656
/**
47-
* Get Incident.
57+
* Get Incident
58+
*
59+
* @apiResource \Cachet\Http\Resources\Incident
60+
* @apiResourceModel \Cachet\Models\Incident
4861
*/
4962
public function show(Incident $incident)
5063
{
@@ -54,7 +67,11 @@ public function show(Incident $incident)
5467
}
5568

5669
/**
57-
* Update Incident.
70+
* Update Incident
71+
*
72+
* @apiResource \Cachet\Http\Resources\Incident
73+
* @apiResourceModel \Cachet\Models\Incident
74+
* @authenticated
5875
*/
5976
public function update(UpdateIncidentRequest $request, Incident $incident, UpdateIncident $updateIncidentAction)
6077
{
@@ -64,7 +81,10 @@ public function update(UpdateIncidentRequest $request, Incident $incident, Updat
6481
}
6582

6683
/**
67-
* Delete Incident.
84+
* Delete Incident
85+
*
86+
* @response 204
87+
* @authenticated
6888
*/
6989
public function destroy(Incident $incident, DeleteIncident $deleteIncidentAction)
7090
{

src/Http/Controllers/Api/IncidentTemplateController.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@
1313
use Illuminate\Routing\Controller;
1414
use Spatie\QueryBuilder\QueryBuilder;
1515

16+
/**
17+
* @group Incident Templates
18+
*/
1619
class IncidentTemplateController extends Controller
1720
{
1821
/**
19-
* List Incident Templates.
22+
* List Incident Templates
23+
*
24+
* @apiResourceCollection \Cachet\Http\Resources\IncidentTemplate
25+
* @apiResourceModel \Cachet\Models\IncidentTemplate
2026
*/
2127
public function index()
2228
{
@@ -29,7 +35,11 @@ public function index()
2935
}
3036

3137
/**
32-
* Create Incident Template.
38+
* Create Incident Template
39+
*
40+
* @apiResource \Cachet\Http\Resources\IncidentTemplate
41+
* @apiResourceModel \Cachet\Models\IncidentTemplate
42+
* @authenticated
3343
*/
3444
public function store(CreateIncidentTemplateRequest $request)
3545
{
@@ -39,7 +49,10 @@ public function store(CreateIncidentTemplateRequest $request)
3949
}
4050

4151
/**
42-
* Get Incident Template.
52+
* Get Incident Template
53+
*
54+
* @apiResource \Cachet\Http\Resources\IncidentTemplate
55+
* @apiResourceModel \Cachet\Models\IncidentTemplate
4356
*/
4457
public function show(IncidentTemplate $incidentTemplate)
4558
{
@@ -49,7 +62,11 @@ public function show(IncidentTemplate $incidentTemplate)
4962
}
5063

5164
/**
52-
* Update Incident Template.
65+
* Update Incident Template
66+
*
67+
* @apiResource \Cachet\Http\Resources\IncidentTemplate
68+
* @apiResourceModel \Cachet\Models\IncidentTemplate
69+
* @authenticated
5370
*/
5471
public function update(UpdateIncidentTemplateRequest $request, IncidentTemplate $incidentTemplate)
5572
{
@@ -59,7 +76,10 @@ public function update(UpdateIncidentTemplateRequest $request, IncidentTemplate
5976
}
6077

6178
/**
62-
* Delete Incident Template.
79+
* Delete Incident Template
80+
*
81+
* @response 204
82+
* @authenticated
6383
*/
6484
public function destroy(IncidentTemplate $incidentTemplate)
6585
{

src/Http/Controllers/Api/IncidentUpdateController.php

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@
1414
use Illuminate\Routing\Controller;
1515
use Spatie\QueryBuilder\QueryBuilder;
1616

17+
/**
18+
* @group Incident Updates
19+
*/
1720
class IncidentUpdateController extends Controller
1821
{
1922
/**
20-
* List Incident Updates.
23+
* List Incident Updates
24+
*
25+
* @apiResourceCollection \Cachet\Http\Resources\IncidentUpdate
26+
* @apiResourceModel \Cachet\Models\IncidentUpdate
2127
*/
2228
public function index(Incident $incident)
2329
{
@@ -31,7 +37,11 @@ public function index(Incident $incident)
3137
}
3238

3339
/**
34-
* Create Incident Update.
40+
* Create Incident Update
41+
*
42+
* @apiResource \Cachet\Http\Resources\IncidentUpdate
43+
* @apiResourceModel \Cachet\Models\IncidentUpdate
44+
* @authenticated
3545
*/
3646
public function store(CreateIncidentUpdateRequest $request, Incident $incident, CreateIncidentUpdate $createIncidentUpdateAction)
3747
{
@@ -41,7 +51,10 @@ public function store(CreateIncidentUpdateRequest $request, Incident $incident,
4151
}
4252

4353
/**
44-
* Get Incident Update.
54+
* Get Incident Update
55+
*
56+
* @apiResource \Cachet\Http\Resources\IncidentUpdate
57+
* @apiResourceModel \Cachet\Models\IncidentUpdate
4558
*/
4659
public function show(Incident $incident, IncidentUpdate $incidentUpdate)
4760
{
@@ -51,7 +64,11 @@ public function show(Incident $incident, IncidentUpdate $incidentUpdate)
5164
}
5265

5366
/**
54-
* Update Incident Update.
67+
* Update Incident Update
68+
*
69+
* @apiResource \Cachet\Http\Resources\IncidentUpdate
70+
* @apiResourceModel \Cachet\Models\IncidentUpdate
71+
* @authenticated
5572
*/
5673
public function update(UpdateIncidentUpdateRequest $request, Incident $incident, IncidentUpdate $incidentUpdate, UpdateIncidentUpdate $updateIncidentUpdateAction)
5774
{
@@ -61,7 +78,10 @@ public function update(UpdateIncidentUpdateRequest $request, Incident $incident,
6178
}
6279

6380
/**
64-
* Delete Incident Update.
81+
* Delete Incident Update
82+
*
83+
* @response 204
84+
* @authenticated
6585
*/
6686
public function destroy(Incident $incident, IncidentUpdate $incidentUpdate, DeleteIncidentUpdate $deleteIncidentUpdateAction)
6787
{

0 commit comments

Comments
 (0)