Skip to content

Commit

Permalink
Merge branch 'main' of github.com-rx:rxcod9/joy-voyager-api into main
Browse files Browse the repository at this point in the history
  • Loading branch information
rxcod9 committed Jan 22, 2023
2 parents 2eb7381 + 7b42b63 commit abb9f56
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 42 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.2.33 - 2023-01-17

v1.2.33

## v1.2.32 - 2022-12-29

v1.2.32
Expand Down
76 changes: 38 additions & 38 deletions src/Console/Commands/GenerateDocsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ protected function generateVoyagerDocsJson()

// store base API Description
$openapi = new OpenApi([
'openapi' => '3.0.2',
'info' => [
'openapi' => '3.0.2',
'info' => [
'title' => config('app.name', 'Joy Voyager Api'),
'description' => 'Joy VoyagerApi module adds REST Api end points to Voyager with Passport and Swagger support https://github.com/rxcod9/joy-voyager-api.',
'version' => '1.0.0',
],
'servers' => [
'servers' => [
new Server([
'url' => config('l5-swagger.defaults.constants.L5_SWAGGER_CONST_HOST'),
'description' => 'Primary API Server',
Expand Down Expand Up @@ -152,7 +152,7 @@ protected function indexOperation($dataType): Operation
$browseName = 'Voyager' . Str::studly($dataType->name) . 'BrowseResource';

return new Operation([
'tags' => array_filter([
'tags' => array_filter([
$dataType->slug
]),
'summary' => $name . ' index',
Expand All @@ -165,7 +165,7 @@ protected function indexOperation($dataType): Operation
'application/json' => [
'schema' => [
'properties' => [
'data' => [
'data' => [
'type' => 'array',
'items' => [
'$ref' => '#/components/schemas/' . $browseName,
Expand All @@ -174,11 +174,11 @@ protected function indexOperation($dataType): Operation
'links' => [
'$ref' => '#/components/schemas/Links',
],
'meta' => [
'meta' => [
'$ref' => '#/components/schemas/Meta',
],
],
'type' => 'object',
'type' => 'object',
],
],
],
Expand All @@ -190,7 +190,7 @@ protected function indexOperation($dataType): Operation
'description' => 'Forbidden',
],
],
'security' => [
'security' => [
[
'token' => [],
],
Expand All @@ -207,13 +207,13 @@ protected function createOperation($dataType): Operation
$browseName = 'Voyager' . Str::studly($dataType->name) . 'CreateResource';

return new Operation([
'tags' => array_filter([
'tags' => array_filter([
$dataType->slug
]),
'summary' => $name . ' create',
'operationId' => Str::snake($name) . '_create',
// 'parameters' => $this->createParameters($dataType),
'responses' => [
'responses' => [
200 => [
'description' => 'Success',
'content' => [
Expand All @@ -222,7 +222,7 @@ protected function createOperation($dataType): Operation
'properties' => [
'data' => [],
],
'type' => 'object',
'type' => 'object',
],
],
],
Expand All @@ -234,7 +234,7 @@ protected function createOperation($dataType): Operation
'description' => 'Forbidden',
],
],
'security' => [
'security' => [
[
'token' => [],
],
Expand Down Expand Up @@ -338,7 +338,7 @@ protected function showOperation($dataType): Operation
];

return new Operation([
'tags' => array_filter([
'tags' => array_filter([
$dataType->slug
]),
'summary' => $name . ' show',
Expand All @@ -355,7 +355,7 @@ protected function showOperation($dataType): Operation
'$ref' => '#/components/schemas/' . $readName,
],
],
'type' => 'object',
'type' => 'object',
],
],
],
Expand All @@ -367,7 +367,7 @@ protected function showOperation($dataType): Operation
'description' => 'Forbidden',
],
],
'security' => [
'security' => [
[
'token' => [],
],
Expand All @@ -394,7 +394,7 @@ protected function editOperation($dataType): Operation
];

return new Operation([
'tags' => array_filter([
'tags' => array_filter([
$dataType->slug
]),
'summary' => $name . ' edit',
Expand All @@ -411,7 +411,7 @@ protected function editOperation($dataType): Operation
'$ref' => '#/components/schemas/' . $editName,
],
],
'type' => 'object',
'type' => 'object',
],
],
],
Expand All @@ -423,7 +423,7 @@ protected function editOperation($dataType): Operation
'description' => 'Forbidden',
],
],
'security' => [
'security' => [
[
'token' => [],
],
Expand All @@ -442,15 +442,15 @@ protected function storeOperation($dataType): Operation
$storeName = 'Voyager' . Str::studly($dataType->name) . 'StoreRequest';

return new Operation([
'tags' => array_filter([
'tags' => array_filter([
$dataType->slug
]),
'summary' => $name . ' store',
'operationId' => Str::snake($name) . '_store',
'requestBody' => [
'$ref' => '#/components/requestBodies/' . $storeName,
],
'responses' => [
'responses' => [
200 => [
'description' => 'Success',
'content' => [
Expand All @@ -461,7 +461,7 @@ protected function storeOperation($dataType): Operation
'$ref' => '#/components/schemas/' . $readName,
],
],
'type' => 'object',
'type' => 'object',
],
],
],
Expand All @@ -473,7 +473,7 @@ protected function storeOperation($dataType): Operation
'description' => 'Forbidden',
],
],
'security' => [
'security' => [
[
'token' => [],
],
Expand Down Expand Up @@ -501,7 +501,7 @@ protected function updateOperation($dataType): Operation
];

return new Operation([
'tags' => array_filter([
'tags' => array_filter([
$dataType->slug
]),
'summary' => $name . ' update',
Expand All @@ -510,7 +510,7 @@ protected function updateOperation($dataType): Operation
'requestBody' => [
'$ref' => '#/components/requestBodies/' . $updateName,
],
'responses' => [
'responses' => [
200 => [
'description' => 'Success',
'content' => [
Expand All @@ -521,7 +521,7 @@ protected function updateOperation($dataType): Operation
'$ref' => '#/components/schemas/' . $readName,
],
],
'type' => 'object',
'type' => 'object',
],
],
],
Expand All @@ -533,7 +533,7 @@ protected function updateOperation($dataType): Operation
'description' => 'Forbidden',
],
],
'security' => [
'security' => [
[
'token' => [],
],
Expand Down Expand Up @@ -585,7 +585,7 @@ protected function singleUpdateOperation($dataType): Operation
];

return new Operation([
'tags' => array_filter([
'tags' => array_filter([
$dataType->slug
]),
'summary' => $name . ' single update',
Expand All @@ -594,7 +594,7 @@ protected function singleUpdateOperation($dataType): Operation
'requestBody' => [
'$ref' => '#/components/requestBodies/' . $singleUpdateName,
],
'responses' => [
'responses' => [
200 => [
'description' => 'Success',
'content' => [
Expand All @@ -605,7 +605,7 @@ protected function singleUpdateOperation($dataType): Operation
'$ref' => '#/components/schemas/' . $readName,
],
],
'type' => 'object',
'type' => 'object',
],
],
],
Expand All @@ -617,7 +617,7 @@ protected function singleUpdateOperation($dataType): Operation
'description' => 'Forbidden',
],
],
'security' => [
'security' => [
[
'token' => [],
],
Expand All @@ -644,7 +644,7 @@ protected function deleteOperation($dataType): Operation
];

return new Operation([
'tags' => array_filter([
'tags' => array_filter([
$dataType->slug
]),
'summary' => $name . ' delete',
Expand All @@ -661,7 +661,7 @@ protected function deleteOperation($dataType): Operation
'type' => 'string',
],
],
'type' => 'object',
'type' => 'object',
],
],
],
Expand All @@ -673,7 +673,7 @@ protected function deleteOperation($dataType): Operation
'description' => 'Forbidden',
],
],
'security' => [
'security' => [
[
'token' => [],
],
Expand All @@ -700,7 +700,7 @@ protected function restoreOperation($dataType): Operation
];

return new Operation([
'tags' => array_filter([
'tags' => array_filter([
$dataType->slug
]),
'summary' => $name . ' restore',
Expand All @@ -717,7 +717,7 @@ protected function restoreOperation($dataType): Operation
'type' => 'string',
],
],
'type' => 'object',
'type' => 'object',
],
],
],
Expand All @@ -729,7 +729,7 @@ protected function restoreOperation($dataType): Operation
'description' => 'Forbidden',
],
],
'security' => [
'security' => [
[
'token' => [],
],
Expand Down Expand Up @@ -784,7 +784,7 @@ protected function relationOperation($dataType): Operation

return new Operation([
// 'get' => [
'tags' => array_filter([
'tags' => array_filter([
$dataType->slug
]),
'summary' => $name . ' relation',
Expand All @@ -804,7 +804,7 @@ protected function relationOperation($dataType): Operation
'description' => 'Forbidden',
],
],
'security' => [
'security' => [
[
'token' => [],
],
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Traits/IndexAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function index(Request $request)
$meta = [
'showCheckboxColumn' => $showCheckboxColumn,
// 'recordsTotal' => $unfilteredCount,
'recordsFiltered' => (
'recordsFiltered' => (
$dataTypeContent instanceof LengthAwarePaginator
? $dataTypeContent->total()
: (
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Traits/SingleUpdateAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function singleUpdate(Request $request, $id)
return $resource::make($data)
->additional(
[
'message' => __('voyager::generic.successfully_updated')
'message' => __('voyager::generic.successfully_updated')
. " {$dataType->getTranslatedAttribute('display_name_singular')}",
'alert-type' => 'success',
'canBrowse' => auth()->user()->can(
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Traits/StoreAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function store(Request $request)
return $resource::make($data)
->additional(
[
'message' => __('voyager::generic.successfully_added_new')
'message' => __('voyager::generic.successfully_added_new')
. " {$dataType->getTranslatedAttribute('display_name_singular')}",
'alert-type' => 'success',
'canBrowse' => auth()->user()->can(
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Traits/UpdateAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function update(Request $request, $id)
return $resource::make($data)
->additional(
[
'message' => __('voyager::generic.successfully_updated')
'message' => __('voyager::generic.successfully_updated')
. " {$dataType->getTranslatedAttribute('display_name_singular')}",
'alert-type' => 'success',
'canBrowse' => auth()->user()->can(
Expand Down

0 comments on commit abb9f56

Please sign in to comment.