From 165182266a76a81ef0e754ceb90083bff809cd87 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 6 Oct 2019 23:24:15 +1100 Subject: [PATCH] OpenAPI --- app/Http/Controllers/AccountController.php | 70 +++++++++++++++++++ app/Http/Controllers/Auth/LoginController.php | 8 --- 2 files changed, 70 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 802f5f30d4f5..3aa001ecff62 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -62,6 +62,76 @@ class AccountController extends BaseController * * @param \App\Http\Requests\SignupRequest $request * @return \Illuminate\Http\Response + * + * @OA\Post( + * path="/api/v1/signup", + * operationId="postSignup", + * tags={"signup"}, + * summary="Attempts a new account signup", + * description="Attempts a new account signup and returns a CompanyUser object on success", + * @OA\Parameter(ref="#/components/parameters/X-Api-Secret"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\RequestBody( + * description="Signup credentials", + * required=true, + * @OA\MediaType( + * mediaType="application/json", + * @OA\Schema( + * type="object", + * @OA\Property( + * property="email", + * description="The user email address", + * type="string", + * ), + * @OA\Property( + * property="first_name", + * description="The signup users first name", + * type="string", + * ), + * @OA\Property( + * property="last_name", + * description="The signup users last name", + * type="string", + * ), + * @OA\Property( + * property="terms_of_service", + * description="The user accepted the terms of service", + * type="boolean", + * ), + * @OA\Property( + * property="privacy_policy", + * description="The user accepted the privacy policy", + * type="boolean", + * ), + * @OA\Property( + * property="password", + * example="1234567", + * description="The user password must meet minimum criteria ~ >6 characters", + * type="string" + * ) + * ) + * ) + * ), + * @OA\Response( + * response=200, + * description="The Company User response", + * @OA\Header(header="X-API-TOKEN", ref="#/components/headers/X-API-TOKEN"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * @OA\JsonContent(ref="#/components/schemas/CompanyUser"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) */ public function store(CreateAccountRequest $request) { diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 2616d6855231..c87e8efad506 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -153,14 +153,6 @@ class LoginController extends BaseController * ), * ) * - * @OA\Response( - * response=200, - * description="Successful Authentication", - * @OA\MediaType( - * mediaType="application/json", - * @OA\Schema(ref="#/components/schemas/Company"), - * ) - * ), */ public function apiLogin(Request $request)