Skip to content

Commit

Permalink
Scribe Annotations (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrooksuk authored Nov 24, 2024
1 parent d7a6f1b commit 6aa5924
Show file tree
Hide file tree
Showing 24 changed files with 343 additions and 43 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"autoload-dev": {
"psr-4": {
"Cachet\\Tests\\": "tests",
"Cachet\\Database\\Factories\\": "database/factories",
"Workbench\\App\\": "workbench/app/",
"Workbench\\Database\\Factories\\": "workbench/database/factories/",
"Workbench\\Database\\Seeders\\": "workbench/database/seeders/"
Expand Down
3 changes: 1 addition & 2 deletions database/factories/ScheduleComponentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

use Cachet\Enums\ComponentStatusEnum;
use Cachet\Models\Component;
use Cachet\Models\Incident;
use Cachet\Models\Schedule;
use Cachet\Models\ScheduleComponent;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
* @extends Factory<Incident>
* @extends Factory<ScheduleComponent>
*/
class ScheduleComponentFactory extends Factory
{
Expand Down
30 changes: 25 additions & 5 deletions src/Http/Controllers/Api/ComponentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@
use Illuminate\Routing\Controller;
use Spatie\QueryBuilder\QueryBuilder;

/**
* @group Components
*/
class ComponentController extends Controller
{
/**
* List Components.
* List Components
*
* @apiResourceCollection \Cachet\Http\Resources\Component
* @apiResourceModel \Cachet\Models\Component
*/
public function index()
{
Expand All @@ -30,7 +36,11 @@ public function index()
}

/**
* Create Component.
* Create Component
*
* @apiResource \Cachet\Http\Resources\Component
* @apiResourceModel \Cachet\Models\Component
* @authenticated
*/
public function store(CreateComponentRequest $request, CreateComponent $createComponentAction)
{
Expand All @@ -40,7 +50,10 @@ public function store(CreateComponentRequest $request, CreateComponent $createCo
}

/**
* Get Component.
* Get Component
*
* @apiResource \Cachet\Http\Resources\Component
* @apiResourceModel \Cachet\Models\Component
*/
public function show(Component $component)
{
Expand All @@ -50,7 +63,11 @@ public function show(Component $component)
}

/**
* Update Component.
* Update Component
*
* @apiResource \Cachet\Http\Resources\Component
* @apiResourceModel \Cachet\Models\Component
* @authenticated
*/
public function update(UpdateComponentRequest $request, Component $component, UpdateComponent $updateComponentAction)
{
Expand All @@ -60,7 +77,10 @@ public function update(UpdateComponentRequest $request, Component $component, Up
}

/**
* Delete Component.
* Delete Component
*
* @response 204
* @authenticated
*/
public function destroy(Component $component, DeleteComponent $deleteComponentAction)
{
Expand Down
29 changes: 25 additions & 4 deletions src/Http/Controllers/Api/ComponentGroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@
use Illuminate\Routing\Controller;
use Spatie\QueryBuilder\QueryBuilder;

/**
* @group Component Groups
*/
class ComponentGroupController extends Controller
{
/**
* List Component Groups.
* List Component Groups
*
* @apiResource \Cachet\Http\Resources\ComponentGroup
* @apiResourceModel \Cachet\Models\ComponentGroup
*/
public function index()
{
Expand All @@ -29,7 +35,11 @@ public function index()
}

/**
* Create Component Group.
* Create Component Group
*
* @apiResource \Cachet\Http\Resources\ComponentGroup
* @apiResourceModel \Cachet\Models\ComponentGroup
* @authenticated
*/
public function store(CreateComponentGroupRequest $request, CreateComponentGroup $createComponentGroupAction)
{
Expand All @@ -41,7 +51,10 @@ public function store(CreateComponentGroupRequest $request, CreateComponentGroup
}

/**
* Get Component Group.
* Get Component Group
*
* @apiResource \Cachet\Http\Resources\ComponentGroup
* @apiResourceModel \Cachet\Models\ComponentGroup
*/
public function show(ComponentGroup $componentGroup)
{
Expand All @@ -52,6 +65,10 @@ public function show(ComponentGroup $componentGroup)

/**
* Update Component Group
*
* @apiResource \Cachet\Http\Resources\ComponentGroup
* @apiResourceModel \Cachet\Models\ComponentGroup
* @authenticated
*/
public function update(UpdateComponentGroupRequest $request, ComponentGroup $componentGroup, UpdateComponentGroup $updateComponentGroupAction)
{
Expand All @@ -63,7 +80,11 @@ public function update(UpdateComponentGroupRequest $request, ComponentGroup $com
}

/**
* Delete Component Group.
* Delete Component Group
*
* @apiResource \Cachet\Http\Resources\ComponentGroup
* @apiResourceModel \Cachet\Models\ComponentGroup
* @authenticated
*/
public function destroy(ComponentGroup $componentGroup, DeleteComponentGroup $deleteComponentGroupAction)
{
Expand Down
17 changes: 15 additions & 2 deletions src/Http/Controllers/Api/GeneralController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,31 @@
use Illuminate\Http\JsonResponse;
use Illuminate\Routing\Controller;

/**
* @group Cachet
*/
class GeneralController extends Controller
{
/**
* Ping the API.
* Test the API
*
* @response {
* "data": "Pong!"
* }
*/
public function ping(): JsonResponse
{
return response()->json(['data' => 'Pong!']);
}

/**
* Get the Cachet version.
* Get Version
*
* @response {
* "data": {
* "version": "3.x-dev"
* }
* }
*/
public function version(): JsonResponse
{
Expand Down
30 changes: 25 additions & 5 deletions src/Http/Controllers/Api/IncidentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@
use Illuminate\Routing\Controller;
use Spatie\QueryBuilder\QueryBuilder;

/**
* @group Incidents
*/
class IncidentController extends Controller
{
/**
* List Incidents.
* List Incidents
*
* @apiResourceCollection \Cachet\Http\Resources\Incident
* @apiResourceModel \Cachet\Models\Incident
*/
public function index()
{
Expand All @@ -34,7 +40,11 @@ public function index()
}

/**
* Create Incident.
* Create Incident
*
* @apiResource \Cachet\Http\Resources\Incident
* @apiResourceModel \Cachet\Models\Incident
* @authenticated
*/
public function store(CreateIncidentRequest $request, CreateIncident $createIncidentAction)
{
Expand All @@ -44,7 +54,10 @@ public function store(CreateIncidentRequest $request, CreateIncident $createInci
}

/**
* Get Incident.
* Get Incident
*
* @apiResource \Cachet\Http\Resources\Incident
* @apiResourceModel \Cachet\Models\Incident
*/
public function show(Incident $incident)
{
Expand All @@ -54,7 +67,11 @@ public function show(Incident $incident)
}

/**
* Update Incident.
* Update Incident
*
* @apiResource \Cachet\Http\Resources\Incident
* @apiResourceModel \Cachet\Models\Incident
* @authenticated
*/
public function update(UpdateIncidentRequest $request, Incident $incident, UpdateIncident $updateIncidentAction)
{
Expand All @@ -64,7 +81,10 @@ public function update(UpdateIncidentRequest $request, Incident $incident, Updat
}

/**
* Delete Incident.
* Delete Incident
*
* @response 204
* @authenticated
*/
public function destroy(Incident $incident, DeleteIncident $deleteIncidentAction)
{
Expand Down
30 changes: 25 additions & 5 deletions src/Http/Controllers/Api/IncidentTemplateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@
use Illuminate\Routing\Controller;
use Spatie\QueryBuilder\QueryBuilder;

/**
* @group Incident Templates
*/
class IncidentTemplateController extends Controller
{
/**
* List Incident Templates.
* List Incident Templates
*
* @apiResourceCollection \Cachet\Http\Resources\IncidentTemplate
* @apiResourceModel \Cachet\Models\IncidentTemplate
*/
public function index()
{
Expand All @@ -29,7 +35,11 @@ public function index()
}

/**
* Create Incident Template.
* Create Incident Template
*
* @apiResource \Cachet\Http\Resources\IncidentTemplate
* @apiResourceModel \Cachet\Models\IncidentTemplate
* @authenticated
*/
public function store(CreateIncidentTemplateRequest $request)
{
Expand All @@ -39,7 +49,10 @@ public function store(CreateIncidentTemplateRequest $request)
}

/**
* Get Incident Template.
* Get Incident Template
*
* @apiResource \Cachet\Http\Resources\IncidentTemplate
* @apiResourceModel \Cachet\Models\IncidentTemplate
*/
public function show(IncidentTemplate $incidentTemplate)
{
Expand All @@ -49,7 +62,11 @@ public function show(IncidentTemplate $incidentTemplate)
}

/**
* Update Incident Template.
* Update Incident Template
*
* @apiResource \Cachet\Http\Resources\IncidentTemplate
* @apiResourceModel \Cachet\Models\IncidentTemplate
* @authenticated
*/
public function update(UpdateIncidentTemplateRequest $request, IncidentTemplate $incidentTemplate)
{
Expand All @@ -59,7 +76,10 @@ public function update(UpdateIncidentTemplateRequest $request, IncidentTemplate
}

/**
* Delete Incident Template.
* Delete Incident Template
*
* @response 204
* @authenticated
*/
public function destroy(IncidentTemplate $incidentTemplate)
{
Expand Down
30 changes: 25 additions & 5 deletions src/Http/Controllers/Api/IncidentUpdateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@
use Illuminate\Routing\Controller;
use Spatie\QueryBuilder\QueryBuilder;

/**
* @group Incident Updates
*/
class IncidentUpdateController extends Controller
{
/**
* List Incident Updates.
* List Incident Updates
*
* @apiResourceCollection \Cachet\Http\Resources\IncidentUpdate
* @apiResourceModel \Cachet\Models\IncidentUpdate
*/
public function index(Incident $incident)
{
Expand All @@ -31,7 +37,11 @@ public function index(Incident $incident)
}

/**
* Create Incident Update.
* Create Incident Update
*
* @apiResource \Cachet\Http\Resources\IncidentUpdate
* @apiResourceModel \Cachet\Models\IncidentUpdate
* @authenticated
*/
public function store(CreateIncidentUpdateRequest $request, Incident $incident, CreateIncidentUpdate $createIncidentUpdateAction)
{
Expand All @@ -41,7 +51,10 @@ public function store(CreateIncidentUpdateRequest $request, Incident $incident,
}

/**
* Get Incident Update.
* Get Incident Update
*
* @apiResource \Cachet\Http\Resources\IncidentUpdate
* @apiResourceModel \Cachet\Models\IncidentUpdate
*/
public function show(Incident $incident, IncidentUpdate $incidentUpdate)
{
Expand All @@ -51,7 +64,11 @@ public function show(Incident $incident, IncidentUpdate $incidentUpdate)
}

/**
* Update Incident Update.
* Update Incident Update
*
* @apiResource \Cachet\Http\Resources\IncidentUpdate
* @apiResourceModel \Cachet\Models\IncidentUpdate
* @authenticated
*/
public function update(UpdateIncidentUpdateRequest $request, Incident $incident, IncidentUpdate $incidentUpdate, UpdateIncidentUpdate $updateIncidentUpdateAction)
{
Expand All @@ -61,7 +78,10 @@ public function update(UpdateIncidentUpdateRequest $request, Incident $incident,
}

/**
* Delete Incident Update.
* Delete Incident Update
*
* @response 204
* @authenticated
*/
public function destroy(Incident $incident, IncidentUpdate $incidentUpdate, DeleteIncidentUpdate $deleteIncidentUpdateAction)
{
Expand Down
Loading

0 comments on commit 6aa5924

Please sign in to comment.