diff --git a/.gitignore b/.gitignore
index 1121fa3..0ff52df 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,4 +12,4 @@ public/docs/*
composer.phar
.phpunit.result.cache
/storage/api-docs
-build
\ No newline at end of file
+.build
\ No newline at end of file
diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php
index 280a208..04b7642 100644
--- a/app/Exceptions/Handler.php
+++ b/app/Exceptions/Handler.php
@@ -7,9 +7,12 @@
use Illuminate\Database\QueryException;
use Illuminate\Validation\ValidationException;
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
+use Laravel\Passport\Exceptions\OAuthServerException as LaravelOAuthServerException;
+use League\OAuth2\Server\Exception\OAuthServerException as LeagueOAuthServerException;
use Spatie\Permission\Exceptions\RoleAlreadyExists;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Throwable;
class Handler extends ExceptionHandler
@@ -24,6 +27,8 @@ class Handler extends ExceptionHandler
HttpException::class,
ModelNotFoundException::class,
ValidationException::class,
+ LeagueOAuthServerException::class,
+ LaravelOAuthServerException::class,
];
/**
@@ -52,7 +57,13 @@ public function report(Throwable $exception)
*/
public function render($request, Throwable $exception)
{
- if ($exception instanceof RoleAlreadyExists) {
+ if (method_exists($exception, 'getStatusCode') && blank($exception->getMessage())) {
+ if ($exception->getStatusCode() == Response::HTTP_NOT_FOUND) {
+ $exception = new NotFoundHttpException('404 Not Found', $exception);
+ } else {
+ $exception = new HttpException($exception->getStatusCode(), 'Error '.$exception->getStatusCode());
+ }
+ } elseif ($exception instanceof RoleAlreadyExists) {
$exception = new HttpException(
Response::HTTP_UNPROCESSABLE_ENTITY,
$exception->getMessage(),
diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index a4f8489..ef8052e 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -30,7 +30,7 @@ class Controller extends BaseController
* @OA\Post(
* path="/oauth/token",
* summary="Generate access token",
- * tags={"Authorization"},
+ * tags={"Authentication"},
* @OA\RequestBody(
* @OA\MediaType(
* mediaType="application/json",
@@ -106,6 +106,10 @@ class Controller extends BaseController
* )
*
* @OA\Tag(
+ * name="Authentication",
+ * description="API Endpoints of Authentication"
+ * )
+ * @OA\Tag(
* name="Authorization",
* description="API Endpoints of Authorization"
* )
@@ -113,7 +117,19 @@ class Controller extends BaseController
* name="Localizations",
* description="API Endpoints of Localizations"
* )
+ * @OA\Tag(
+ * name="Access",
+ * description="API Endpoints of Access"
+ * )
*
+ * @OA\Schema(
+ * schema="Error",
+ * required={"message"},
+ * @OA\Property(
+ * property="message",
+ * type="string"
+ * )
+ * ),
*/
diff --git a/app/Http/Controllers/V1/Backend/Auth/Authorization/AuthorizationController.php b/app/Http/Controllers/V1/Backend/Auth/Authorization/AuthorizationController.php
index 95ec2dc..9e3dced 100644
--- a/app/Http/Controllers/V1/Backend/Auth/Authorization/AuthorizationController.php
+++ b/app/Http/Controllers/V1/Backend/Auth/Authorization/AuthorizationController.php
@@ -1,10 +1,4 @@
- * Date: 12/26/18
- * Time: 4:43 PM
- */
namespace App\Http\Controllers\V1\Backend\Auth\Authorization;
@@ -16,22 +10,11 @@
use App\Transformers\Auth\UserTransformer;
use Illuminate\Http\Request;
-/**
- * Class AuthorizationController
- *
- * @package App\Http\Controllers\V1\Backend\Auth\Authorization
- */
class AuthorizationController extends Controller
{
protected UserRepository $userRepository;
protected RoleRepository $roleRepository;
- /**
- * AuthorizationController constructor.
- *
- * @param \App\Repositories\Auth\User\UserRepository $userRepository
- * @param \App\Repositories\Auth\Role\RoleRepository $roleRepository
- */
public function __construct(UserRepository $userRepository, RoleRepository $roleRepository)
{
$this->middleware('permission:'.config('setting.permission.permission_names.manage_authorization'));
@@ -47,17 +30,29 @@ public function __construct(UserRepository $userRepository, RoleRepository $role
* summary="Assign role to user",
* tags={"Authorization"},
* security={{"passport":{}}},
+ * @OA\Parameter(
+ * name="include",
+ * in="query",
+ * required=false,
+ * @OA\Schema(
+ * type="array",
+ * @OA\Items(
+ * type="string",
+ * enum = {"roles", "permissions"},
+ * )
+ * )
+ * ),
* @OA\RequestBody(
* @OA\MediaType(
* mediaType="application/json",
* @OA\Schema(
* @OA\Property(
- * description="User hashed id",
+ * description="User key",
* property="user_id",
* type="int",
* ),
* @OA\Property(
- * description="Role hashed id",
+ * description="Role key",
* property="role_id",
* type="int",
* ),
@@ -68,41 +63,21 @@ public function __construct(UserRepository $userRepository, RoleRepository $role
* )
* )
* ),
- * @OA\Response(
- * response="200",
- * description="ok",
- * content={
- * @OA\MediaType(
- * mediaType="application/json",
- * @OA\Schema(
- * @OA\Property(
- * property="access_token",
- * type="string",
- * description="JWT access token"
- * ),
- * @OA\Property(
- * property="token_type",
- * type="string",
- * description="Token type"
- * ),
- * @OA\Property(
- * property="expires_in",
- * type="integer",
- * description="Token expiration in miliseconds",
- * @OA\Items
- * ),
- * example={
- * "access_token": "eyJ0eXAiOiJKV1QiLCJhbGc...",
- * "token_type": "bearer",
- * "expires_in": 3600
- * }
- * )
- * )
- * }
+ * @OA\Response(
+ * response=200,
+ * description="OK",
+ * @OA\JsonContent(
+ * type="array",
+ * @OA\Items(ref="#/components/schemas/UserTransformer")
+ * ),
* ),
* @OA\Response(
* response="401",
- * description="Unauthorized"
+ * description="Unauthorized",
+ * @OA\JsonContent(
+ * type="array",
+ * @OA\Items(ref="#/components/schemas/Error")
+ * ),
* ),
* )
*
@@ -136,11 +111,50 @@ public function assignRoleToUser(Request $request)
}
/**
+ * @OA\Delete(
+ * path="/auth/authorizations/revoke-role-from-user",
+ * summary="Revoke role from user",
+ * tags={"Authorization"},
+ * security={{"passport":{}}},
+ * @OA\RequestBody(
+ * @OA\MediaType(
+ * mediaType="application/json",
+ * @OA\Schema(
+ * @OA\Property(
+ * description="User key",
+ * property="user_id",
+ * type="int",
+ * ),
+ * @OA\Property(
+ * description="Role keyd",
+ * property="role_id",
+ * type="int",
+ * ),
+ * example={
+ * "user_id": "user-at-usercom",
+ * "role_id": 1
+ * }
+ * )
+ * )
+ * ),
+ * @OA\Response(
+ * response=204,
+ * description="The resource was revoked successfully.",
+ * ),
+ * @OA\Response(
+ * response="401",
+ * description="Unauthorized",
+ * @OA\JsonContent(
+ * type="array",
+ * @OA\Items(ref="#/components/schemas/Error")
+ * ),
+ * ),
+ * )
* @param \Illuminate\Http\Request $request
*
- * @return \Spatie\Fractal\Fractal
+ * @return \Illuminate\Http\Response|\Laravel\Lumen\Http\ResponseFactory
* @throws \Illuminate\Validation\ValidationException
- * @api {post} /auth/authorizations/revoke-role-from-user Revoke role form user
+ * @api {delete} /auth/authorizations/revoke-role-from-user Revoke role form user
* @apiName revoke-role-from-user
* @apiGroup Authorization
* @apiVersion 1.0.0
@@ -162,11 +176,65 @@ public function revokeRoleFormUser(Request $request)
$this->userRepository->removeRole($attributes['user_id'], $attributes['role_id']);
- $user = $this->userRepository->findByRouteKeyName($attributes['user_id']);
- return $this->fractal($user, new UserTransformer());
+ return response('', 204);
}
/**
+ * @OA\Post(
+ * path="/auth/authorizations/assign-permission-to-user",
+ * summary="Assign permission to user",
+ * tags={"Authorization"},
+ * security={{"passport":{}}},
+ * @OA\Parameter(
+ * name="include",
+ * in="query",
+ * required=false,
+ * @OA\Schema(
+ * type="array",
+ * @OA\Items(
+ * type="string",
+ * enum = {"roles", "permissions"},
+ * )
+ * )
+ * ),
+ * @OA\RequestBody(
+ * @OA\MediaType(
+ * mediaType="application/json",
+ * @OA\Schema(
+ * @OA\Property(
+ * description="User key",
+ * property="user_id",
+ * type="int",
+ * ),
+ * @OA\Property(
+ * description="Permission key",
+ * property="permission_id",
+ * type="int",
+ * ),
+ * example={
+ * "user_id": "user-at-usercom",
+ * "permission_id": 1
+ * }
+ * )
+ * )
+ * ),
+ * @OA\Response(
+ * response=200,
+ * description="OK",
+ * @OA\JsonContent(
+ * type="array",
+ * @OA\Items(ref="#/components/schemas/UserTransformer")
+ * ),
+ * ),
+ * @OA\Response(
+ * response="401",
+ * description="Unauthorized",
+ * @OA\JsonContent(
+ * type="array",
+ * @OA\Items(ref="#/components/schemas/Error")
+ * ),
+ * ),
+ * )
* @param \Illuminate\Http\Request $request
*
* @return \Spatie\Fractal\Fractal
@@ -197,11 +265,50 @@ public function assignPermissionToUser(Request $request)
}
/**
+ * @OA\Delete(
+ * path="/auth/authorizations/revoke-permission-from-user",
+ * summary="Revoke permission from user",
+ * tags={"Authorization"},
+ * security={{"passport":{}}},
+ * @OA\RequestBody(
+ * @OA\MediaType(
+ * mediaType="application/json",
+ * @OA\Schema(
+ * @OA\Property(
+ * description="User key",
+ * property="user_id",
+ * type="int",
+ * ),
+ * @OA\Property(
+ * description="Permission key",
+ * property="permission_id",
+ * type="int",
+ * ),
+ * example={
+ * "user_id": "user-at-usercom",
+ * "permission_id": 1
+ * }
+ * )
+ * )
+ * ),
+ * @OA\Response(
+ * response=204,
+ * description="The resource was revoked successfully.",
+ * ),
+ * @OA\Response(
+ * response="401",
+ * description="Unauthorized",
+ * @OA\JsonContent(
+ * type="array",
+ * @OA\Items(ref="#/components/schemas/Error")
+ * ),
+ * ),
+ * )
* @param \Illuminate\Http\Request $request
*
- * @return \Spatie\Fractal\Fractal
+ * @return \Illuminate\Http\Response|\Laravel\Lumen\Http\ResponseFactory
* @throws \Illuminate\Validation\ValidationException
- * @api {post} /auth/authorizations/revoke-permission-from-user Revoke permission from user
+ * @api {delete} /auth/authorizations/revoke-permission-from-user Revoke permission from user
* @apiName revoke-permission-from-user
* @apiGroup Authorization
* @apiVersion 1.0.0
@@ -223,10 +330,65 @@ public function revokePermissionFromUser(Request $request)
$this->userRepository->revokePermissionTo($attributes['user_id'], $attributes['permission_id']);
- return $this->fractal($this->userRepository->findByRouteKeyName($attributes['user_id']), new UserTransformer());
+ return response('', 204);
}
/**
+ * @OA\Post(
+ * path="/auth/authorizations/attach-permission-to-role",
+ * summary="Attach permission to role",
+ * tags={"Authorization"},
+ * security={{"passport":{}}},
+ * @OA\Parameter(
+ * name="include",
+ * in="query",
+ * required=false,
+ * @OA\Schema(
+ * type="array",
+ * @OA\Items(
+ * type="string",
+ * enum = {"roles", "permissions"},
+ * )
+ * )
+ * ),
+ * @OA\RequestBody(
+ * @OA\MediaType(
+ * mediaType="application/json",
+ * @OA\Schema(
+ * @OA\Property(
+ * description="Role key",
+ * property="role_id",
+ * type="int",
+ * ),
+ * @OA\Property(
+ * description="Permission key",
+ * property="permission_id",
+ * type="int",
+ * ),
+ * example={
+ * "role_id": 1,
+ * "permission_id": 1
+ * }
+ * )
+ * )
+ * ),
+ * @OA\Response(
+ * response=200,
+ * description="OK",
+ * @OA\JsonContent(
+ * type="array",
+ * @OA\Items(ref="#/components/schemas/UserTransformer")
+ * ),
+ * ),
+ * @OA\Response(
+ * response="401",
+ * description="Unauthorized",
+ * @OA\JsonContent(
+ * type="array",
+ * @OA\Items(ref="#/components/schemas/Error")
+ * ),
+ * ),
+ * )
* @param \Illuminate\Http\Request $request
*
* @return \Spatie\Fractal\Fractal
@@ -257,11 +419,50 @@ public function attachPermissionToRole(Request $request)
}
/**
+ * @OA\Delete(
+ * path="/auth/authorizations/revoke-permission-from-role",
+ * summary="Revoke permission from role",
+ * tags={"Authorization"},
+ * security={{"passport":{}}},
+ * @OA\RequestBody(
+ * @OA\MediaType(
+ * mediaType="application/json",
+ * @OA\Schema(
+ * @OA\Property(
+ * description="Role key",
+ * property="role_id",
+ * type="int",
+ * ),
+ * @OA\Property(
+ * description="Permission key",
+ * property="permission_id",
+ * type="int",
+ * ),
+ * example={
+ * "role_id": 1,
+ * "permission_id": 1
+ * }
+ * )
+ * )
+ * ),
+ * @OA\Response(
+ * response=204,
+ * description="The resource was revoked successfully.",
+ * ),
+ * @OA\Response(
+ * response="401",
+ * description="Unauthorized",
+ * @OA\JsonContent(
+ * type="array",
+ * @OA\Items(ref="#/components/schemas/Error")
+ * ),
+ * ),
+ * )
* @param \Illuminate\Http\Request $request
*
- * @return \Spatie\Fractal\Fractal
+ * @return \Illuminate\Http\Response|\Laravel\Lumen\Http\ResponseFactory
* @throws \Illuminate\Validation\ValidationException
- * @api {post} /auth/authorizations/revoke-permission-from-role Revoke permission from role
+ * @api {delete} /auth/authorizations/revoke-permission-from-role Revoke permission from role
* @apiName revoke-permission-from-role
* @apiGroup Authorization
* @apiVersion 1.0.0
@@ -283,7 +484,7 @@ public function revokePermissionFromRole(Request $request)
$this->roleRepository->revokePermissionTo($attributes['role_id'], $attributes['permission_id']);
- return $this->fractal($this->roleRepository->findByRouteKeyName($attributes['role_id']), new RoleTransformer());
+ return response('', 204);
}
diff --git a/app/Http/Controllers/V1/Backend/Auth/Permission/PermissionController.php b/app/Http/Controllers/V1/Backend/Auth/Permission/PermissionController.php
index d0b7802..3e929ee 100644
--- a/app/Http/Controllers/V1/Backend/Auth/Permission/PermissionController.php
+++ b/app/Http/Controllers/V1/Backend/Auth/Permission/PermissionController.php
@@ -1,10 +1,4 @@
- * Date: 12/16/18
- * Time: 11:25 AM
- */
namespace App\Http\Controllers\V1\Backend\Auth\Permission;
@@ -14,49 +8,10 @@
use Illuminate\Http\Request;
use Prettus\Repository\Criteria\RequestCriteria;
-/**
- * Class PermissionController
- *
- * @package App\Http\Controllers\V1\Backend\Auth\Permission
- */
class PermissionController extends Controller
{
protected PermissionRepository $permissionRepository;
- /**
- *
- * @OA\Get(
- * path="/samplesss/{category}/things",
- * operationId="/samplesss/category/things",
- * tags={"yourtag"},
- * @OA\Parameter(
- * name="category",
- * in="path",
- * description="The category parameter in path",
- * required=true,
- * @OA\Schema(type="string")
- * ),
- * @OA\Parameter(
- * name="criteria",
- * in="query",
- * description="Some optional other parameter",
- * required=false,
- * @OA\Schema(type="string")
- * ),
- * @OA\Response(
- * response="200",
- * description="Returns some sample category things",
- * @OA\JsonContent()
- * ),
- * @OA\Response(
- * response="400",
- * description="Error: Bad request. When required parameters were not supplied.",
- * ),
- * )
- * PermissionController constructor.
- *
- * @param \App\Repositories\Auth\Permission\PermissionRepository $permissionRepository
- */
public function __construct(PermissionRepository $permissionRepository)
{
$permissions = $permissionRepository->makeModel()::PERMISSIONS;
diff --git a/app/Http/Controllers/V1/Backend/Auth/Role/RoleController.php b/app/Http/Controllers/V1/Backend/Auth/Role/RoleController.php
index 8ce7088..a661342 100644
--- a/app/Http/Controllers/V1/Backend/Auth/Role/RoleController.php
+++ b/app/Http/Controllers/V1/Backend/Auth/Role/RoleController.php
@@ -1,10 +1,4 @@
- * Date: 12/16/18
- * Time: 11:25 AM
- */
namespace App\Http\Controllers\V1\Backend\Auth\Role;
@@ -14,50 +8,10 @@
use Illuminate\Http\Request;
use Prettus\Repository\Criteria\RequestCriteria;
-/**
- * Class RoleController
- *
- * @package App\Http\Controllers\V1\Backend\Auth\Role
- */
class RoleController extends Controller
{
protected RoleRepository $roleRepository;
- /**
- *
- * @OA\Get(
- * path="/sampsdfle/{category}/things",
- * operationId="/sdf/category/things",
- * tags={"yourtag"},
- * @OA\Parameter(
- * name="category",
- * in="path",
- * description="The category parameter in path",
- * required=true,
- * @OA\Schema(type="string")
- * ),
- * @OA\Parameter(
- * name="criteria",
- * in="query",
- * description="Some optional other parameter",
- * required=false,
- * @OA\Schema(type="string")
- * ),
- * @OA\Response(
- * response="200",
- * description="Returns some sample category things",
- * @OA\JsonContent()
- * ),
- * @OA\Response(
- * response="400",
- * description="Error: Bad request. When required parameters were not supplied.",
- * ),
- * )
- *
- * RoleController constructor.
- *
- * @param \App\Repositories\Auth\Role\RoleRepository $roleRepository
- */
public function __construct(RoleRepository $roleRepository)
{
$permissions = $roleRepository->makeModel()::PERMISSIONS;
diff --git a/app/Http/Controllers/V1/Backend/Auth/User/UserController.php b/app/Http/Controllers/V1/Backend/Auth/User/UserController.php
index d1568fe..4cf1d15 100644
--- a/app/Http/Controllers/V1/Backend/Auth/User/UserController.php
+++ b/app/Http/Controllers/V1/Backend/Auth/User/UserController.php
@@ -8,20 +8,10 @@
use Illuminate\Http\Request;
use Prettus\Repository\Criteria\RequestCriteria;
-/**
- * Class UserController
- *
- * @package App\Http\Controllers\V1\Backend\Auth\User
- */
class UserController extends Controller
{
protected UserRepository $userRepository;
- /**
- * UserController constructor.
- *
- * @param \App\Repositories\Auth\User\UserRepository $userRepository
- */
public function __construct(UserRepository $userRepository)
{
$permissions = $userRepository->makeModel()::PERMISSIONS;
@@ -112,34 +102,6 @@ public function store(Request $request)
}
/**
- * @OA\Get(
- * path="/sampzzle/{category}/things",
- * operationId="/samxxxple/category/things",
- * tags={"yourtag"},
- * @OA\Parameter(
- * name="category",
- * in="path",
- * description="The category parameter in path",
- * required=true,
- * @OA\Schema(type="string")
- * ),
- * @OA\Parameter(
- * name="criteria",
- * in="query",
- * description="Some optional other parameter",
- * required=false,
- * @OA\Schema(type="string")
- * ),
- * @OA\Response(
- * response="200",
- * description="Returns some sample category things",
- * @OA\JsonContent()
- * ),
- * @OA\Response(
- * response="400",
- * description="Error: Bad request. When required parameters were not supplied.",
- * ),
- * )
*
* @param \Illuminate\Http\Request $request
* @param string $id
diff --git a/app/Http/Controllers/V1/Backend/Auth/User/UserDeleteController.php b/app/Http/Controllers/V1/Backend/Auth/User/UserDeleteController.php
index 440b102..0bfcc91 100644
--- a/app/Http/Controllers/V1/Backend/Auth/User/UserDeleteController.php
+++ b/app/Http/Controllers/V1/Backend/Auth/User/UserDeleteController.php
@@ -1,10 +1,4 @@
- * Date: 12/2/18
- * Time: 4:08 PM
- */
namespace App\Http\Controllers\V1\Backend\Auth\User;
@@ -15,49 +9,10 @@
use Illuminate\Http\Request;
use Prettus\Repository\Criteria\RequestCriteria;
-/**
- * Class UserDeleteController
- *
- * @package App\Http\Controllers\V1\Backend\Auth\User
- */
class UserDeleteController extends Controller
{
protected UserRepository $userRepository;
- /**
- * @OA\Get(
- * path="/sampxccle/{category}/things",
- * operationId="/sambvbvple/category/things",
- * tags={"yourtag"},
- * @OA\Parameter(
- * name="category",
- * in="path",
- * description="The category parameter in path",
- * required=true,
- * @OA\Schema(type="string")
- * ),
- * @OA\Parameter(
- * name="criteria",
- * in="query",
- * description="Some optional other parameter",
- * required=false,
- * @OA\Schema(type="string")
- * ),
- * @OA\Response(
- * response="200",
- * description="Returns some sample category things",
- * @OA\JsonContent()
- * ),
- * @OA\Response(
- * response="400",
- * description="Error: Bad request. When required parameters were not supplied.",
- * ),
- * )
- *
- * UserDeleteController constructor.
- *
- * @param \App\Repositories\Auth\User\UserRepository $userRepository
- */
public function __construct(UserRepository $userRepository)
{
$permissions = $userRepository->makeModel()::PERMISSIONS;
diff --git a/app/Http/Controllers/V1/Frontend/User/UserAccessController.php b/app/Http/Controllers/V1/Frontend/User/UserAccessController.php
index 2da3a19..05ab3a9 100644
--- a/app/Http/Controllers/V1/Frontend/User/UserAccessController.php
+++ b/app/Http/Controllers/V1/Frontend/User/UserAccessController.php
@@ -1,27 +1,16 @@
- * Date: 12/2/18
- * Time: 4:52 PM
- */
namespace App\Http\Controllers\V1\Frontend\User;
use App\Http\Controllers\Controller;
use App\Transformers\Auth\UserTransformer;
-/**
- * Class UserAccessController
- *
- * @package App\Http\Controllers\V1\Backend\Auth\User
- */
class UserAccessController extends Controller
{
/**
* @OA\Get(
* path="/profile",
- * tags={"Authorization"},
+ * tags={"Access"},
* summary="Get current logged in user profile",
* security={{"passport":{}}},
* @OA\Response(
diff --git a/app/Http/Controllers/V1/LocalizationController.php b/app/Http/Controllers/V1/LocalizationController.php
index 2dc8902..ac84718 100644
--- a/app/Http/Controllers/V1/LocalizationController.php
+++ b/app/Http/Controllers/V1/LocalizationController.php
@@ -1,10 +1,4 @@
- * Date: 2/3/19
- * Time: 5:22 AM
- */
namespace App\Http\Controllers\V1;
@@ -12,11 +6,6 @@
use App\Transformers\LocalizationTransformer;
use App\Values\Localizations\Localization;
-/**
- * Class LocalizationController
- *
- * @package App\Http\Controllers\V1
- */
class LocalizationController extends Controller
{
/**
diff --git a/app/Transformers/Auth/UserTransformer.php b/app/Transformers/Auth/UserTransformer.php
index 44852b7..72d6903 100644
--- a/app/Transformers/Auth/UserTransformer.php
+++ b/app/Transformers/Auth/UserTransformer.php
@@ -11,6 +11,34 @@
use App\Models\Auth\User\User;
use App\Transformers\BaseTransformer;
+/**
+ * @OA\Schema(
+ * schema="UserTransformer",
+ * type="object",
+ * properties={
+ * @OA\Property(property="id", type="string"),
+ * @OA\Property(property="attributes", type="object", properties={
+ *
+ * @OA\Property(property="first_name", type="string"),
+ * @OA\Property(property="last_name", type="string"),
+ * @OA\Property(property="email", type="string"),
+ * @OA\Property(property="created_at", type="string"),
+ * @OA\Property(property="created_at_readable", type="string"),
+ * @OA\Property(property="updated_at", type="string"),
+ * @OA\Property(property="updated_at_readable", type="string")
+ *
+ * }),
+ * @OA\Property(property="relationships", type="array", @OA\Items({
+ *
+ * })),
+ * @OA\Property(property="meta", type="array", @OA\Items({
+ *
+ * @OA\Property(property="include", type="array", @OA\Items({
+ * })),
+ * })),
+ * }
+ * )
+ */
class UserTransformer extends BaseTransformer
{
/**
diff --git a/config/swagger-lume.php b/config/swagger-lume.php
index ebf06e2..2ae2d50 100644
--- a/config/swagger-lume.php
+++ b/config/swagger-lume.php
@@ -72,7 +72,10 @@
| Absolute path to directory containing the swagger annotations are stored.
|--------------------------------------------------------------------------
*/
- 'annotations' => __DIR__.'/../app/Http/Controllers',//base_path('app'),
+ 'annotations' => [
+ __DIR__.'/../app/Http/Controllers',
+ __DIR__.'/../app/Transformers',
+ ],//base_path('app'),
/*
|--------------------------------------------------------------------------
diff --git a/phpunit.xml b/phpunit.xml
index ed42269..bdcfde9 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -10,9 +10,9 @@