Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Except swagger file
!storage/api-docs/api-docs.json

/node_modules
/public/hot
/public/storage
/public/vendor
/storage/*.key
/vendor
.vapor/
storage/
storage/**/*
!storage/api-docs/
!storage/api-docs/api-docs.json
.env
.env.backup
.phpunit.result.cache
Expand All @@ -14,4 +19,4 @@ Homestead.yaml
npm-debug.log
yarn-error.log
helm-chart/secrets.yml
.idea/*
.idea/*
130 changes: 128 additions & 2 deletions app/Http/Controllers/ApplicationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
use Illuminate\Support\Facades\Log;
use League\Fractal\Manager;

/**
* @OA\Tag(
* name="Aplications",
* description="Operations about Aplications"
* )
*/
class ApplicationController extends Controller
{
/**
Expand Down Expand Up @@ -54,6 +60,29 @@ public function __construct(
* @param Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/
/**
* @OA\Get(
* path="/apps",
* tags={"Applications"},
* summary="Get all applications for a user",
* operationId="getAllForUser",
* @OA\Parameter(
* name="userId",
* in="query",
* required=true,
* description="ID of the user to fetch applications for",
* @OA\Schema(type="string")
* ),
* @OA\Response(
* response=200,
* description="Successful response",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="data", type="array", @OA\Items(type="object"))
* )
* )
* )
*/
public function getAllForUser(Request $request)
{
$this->validate($this->request, [
Expand Down Expand Up @@ -86,6 +115,29 @@ public function getAllForUser(Request $request)
* @param int $id
* @return \Symfony\Component\HttpFoundation\Response
*/
/**
* @OA\Get(
* path="/apps/{id}",
* tags={"Applications"},
* summary="Get an application by ID",
* operationId="getApplicationById",
* @OA\Parameter(
* name="id",
* in="path",
* required=true,
* description="ID of the application to retrieve",
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(
* response=200,
* description="Successful response",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="data", type="array", @OA\Items(type="object"))
* )
* )
* )
*/
public function getById($id)
{
try {
Expand Down Expand Up @@ -119,6 +171,32 @@ public function getById($id)
* @param Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/
/**
* @OA\Post(
* path="/apps",
* tags={"Applications"},
* summary="Create a new application",
* operationId="createApplication",
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* required={"name", "userId"},
* @OA\Property(property="name", type="string", example="My Application", description="Name of the application"),
* @OA\Property(property="description", type="string", example="A description of the application", description="Description of the application (optional)"),
* @OA\Property(property="userId", type="string", example="user123", description="ID of the user creating the application"),
* @OA\Property(property="estimatedUsers", type="integer", example=100, description="Estimated number of users (optional)")
* )
* ),
* @OA\Response(
* response=200,
* description="Successful response",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="data", type="array", @OA\Items(type="object"))
* )
* )
* )
*/
public function create(Request $request)
{
$this->validate($this->request, [
Expand Down Expand Up @@ -152,6 +230,35 @@ public function create(Request $request)
return response()->json($response->toArray(), 201);
}

/**
* @OA\Patch(
* path="/apps/{id}",
* tags={"Applications"},
* summary="Update an application by ID",
* operationId="updateApplication",
* @OA\Parameter(
* name="id",
* in="path",
* required=true,
* description="ID of the application to update",
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\RequestBody(
* required=true,
* @OA\JsonContent(
* @OA\Property(property="estimatedUsers", type="integer", example=100, description="Estimated number of users (optional)")
* )
* ),
* @OA\Response(
* response=200,
* description="Successful response",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="data", type="array", @OA\Items(type="object"))
* )
* )
* )
*/
public function update(Request $request, $id)
{
$this->validate($this->request, [
Expand Down Expand Up @@ -182,8 +289,27 @@ public function update(Request $request, $id)
}

/**
* @param int $id
* @return \Symfony\Component\HttpFoundation\Response
* @OA\Delete(
* path="/apps/{id}",
* tags={"Applications"},
* summary="Delete an application by ID",
* operationId="deleteApplication",
* @OA\Parameter(
* name="id",
* in="path",
* required=true,
* description="ID of the application to delete",
* @OA\Schema(type="integer", format="int64")
* ),
* @OA\Response(
* response=200,
* description="Successful response",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="data", type="array", @OA\Items(type="object"))
* )
* )
* )
*/
public function delete($id)
{
Expand Down
14 changes: 10 additions & 4 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

/**
* @OA\Info(
* title="Whatnow API",
* description="Whatnow API documentation",
* version="1.0.0",
* @OA\OpenApi(
* @OA\Info(
* title="Whatnow API",
* description="Whatnow API documentation",
* version="1.0.0",
* ),
* @OA\Server(
* url=L5_SWAGGER_CONST_HOST,
* description="API Base URL"
* )
* )
*/
class Controller extends BaseController
Expand Down
37 changes: 37 additions & 0 deletions app/Http/Controllers/FileUploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,45 @@
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;

/**
* @OA\Tag(
* name="Files",
* description="Operations about Files"
* )
*/
class FileUploadController extends Controller
{
/**
* @OA\Post(
* path="/upload",
* tags={"Whatnow"},
* summary="Upload a file",
* operationId="uploadFile",
* @OA\RequestBody(
* required=true,
* @OA\MediaType(
* mediaType="multipart/form-data",
* @OA\Schema(
* required={"file"},
* @OA\Property(
* property="file",
* type="string",
* format="binary",
* description="File to upload (allowed types: jpg, png; max size: 10MB)"
* )
* )
* )
* ),
* @OA\Response(
* response=200,
* description="Successful response",
* @OA\JsonContent(
* type="object",
* @OA\Property(property="data", type="array", @OA\Items(type="object"))
* )
* )
* )
*/
public function upload(Request $request)
{
try {
Expand Down
Loading
Loading