Skip to content
4 changes: 2 additions & 2 deletions src/Console/Commands/OpenApiCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function exec(): void
return;
}

if (request()->routeGroupExists('openapi', $module) && $this->fs->exists($modulePath . DS . 'resources' . DS . 'openApi' . DS . 'spec.json')) {
if (request()->routeGroupExists('openapi', $module) && $this->fs->exists($modulePath . DS . 'resources' . DS . 'openapi' . DS . 'spec.json')) {
$this->error('The Open API specifications already installed for `' . ucfirst($module) . '` module');
return;
}
Expand Down Expand Up @@ -198,7 +198,7 @@ private function openapiRoutes(string $module): string

$route->get("spec", function (): Quantum\Http\Response {
$fs = Quantum\Storage\Factories\FileSystemFactory::get();
return response()->json($fs->getJson(modules_dir() . "' . DS . $module . DS . 'resources' . DS . 'openapi' . DS . 'spec.json"));
return response()->json($fs->getJson(modules_dir() . DS . "' . $module . '" . DS . "resources" . DS . "openapi" . DS . "spec.json"));
Comment thread
coderabbitai[bot] marked this conversation as resolved.
});
});' . PHP_EOL;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?php

/**
* Quantum PHP Framework
*
* An open source software development framework for PHP
*
* @package Quantum
* @author Arman Ag. <arman.ag@softberg.org>
* @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
* @link http://quantum.softberg.org/
* @since 3.0.0
*/

namespace {{MODULE_NAMESPACE}}\Controllers\OpenApi;

use Quantum\Http\Request;

/**
* Class OpenApiAccountController
* @package Modules\Api
*/
abstract class OpenApiAccountController extends OpenApiController
{
/**
* Update user info action
* @OA\Put(
* path="/api/account-settings/update",
* tags={"Account"},
* summary="Update user info",
* operationId="updateAccount",
* security={{"bearer_token": {}}},
* @OA\RequestBody(
* required=true,
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* required={"firstname", "lastname"},
* @OA\Property(property="firstname", type="string"),
* @OA\Property(property="lastname", type="string"),
* example={"firstname": "Jon", "lastname": "Smit"}
* )
* )
* ),
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(
* example={"status": "success", "message": "Updated successfully"}
* )
* ),
* @OA\Response(response=401, description="Unauthorized Request"),
* @OA\Response(response=422, description="Unprocessable Entity"),
* @OA\Response(response=429, description="Too Many Requests"),
* @OA\Response(response=500, description="Internal Server Error")
* )
*/
abstract public function update(Request $request);

/**
* Update password action
* @OA\Put(
* path="/api/account-settings/update-password",
* tags={"Account"},
* summary="Update password",
* operationId="updatePassword",
* security={{"bearer_token": {}}},
* @OA\RequestBody(
* required=true,
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* required={"current_password", "new_password", "confirm_password"},
* @OA\Property(property="current_password", type="string"),
* @OA\Property(property="new_password", type="string"),
* @OA\Property(property="confirm_password", type="string"),
* example={"current_password": "oldPassword", "new_password": "newPassword", "confirm_password": "newPassword"}
* )
* )
* ),
* @OA\Response(
* response=200,
* description="Success",
* @OA\JsonContent(
* example={"status": "success", "message": "Updated successfully"}
* )
* ),
* @OA\Response(response=401, description="Unauthorized Request"),
* @OA\Response(response=422, description="Unprocessable Entity"),
* @OA\Response(response=429, description="Too Many Requests"),
* @OA\Response(response=500, description="Internal Server Error")
* )
*/
abstract public function updatePassword(Request $request);
}


Loading
Loading