|
9 | 9 | use Illuminate\Support\Facades\Log; |
10 | 10 | use League\Fractal\Manager; |
11 | 11 |
|
| 12 | +/** |
| 13 | + * @OA\Tag( |
| 14 | + * name="Aplications", |
| 15 | + * description="Operations about Aplications" |
| 16 | + * ) |
| 17 | + */ |
12 | 18 | class ApplicationController extends Controller |
13 | 19 | { |
14 | 20 | /** |
@@ -54,6 +60,29 @@ public function __construct( |
54 | 60 | * @param Request $request |
55 | 61 | * @return \Symfony\Component\HttpFoundation\Response |
56 | 62 | */ |
| 63 | + /** |
| 64 | + * @OA\Get( |
| 65 | + * path="/apps", |
| 66 | + * tags={"Applications"}, |
| 67 | + * summary="Get all applications for a user", |
| 68 | + * operationId="getAllForUser", |
| 69 | + * @OA\Parameter( |
| 70 | + * name="userId", |
| 71 | + * in="query", |
| 72 | + * required=true, |
| 73 | + * description="ID of the user to fetch applications for", |
| 74 | + * @OA\Schema(type="string") |
| 75 | + * ), |
| 76 | + * @OA\Response( |
| 77 | + * response=200, |
| 78 | + * description="Successful response", |
| 79 | + * @OA\JsonContent( |
| 80 | + * type="object", |
| 81 | + * @OA\Property(property="data", type="array", @OA\Items(type="object")) |
| 82 | + * ) |
| 83 | + * ) |
| 84 | + * ) |
| 85 | + */ |
57 | 86 | public function getAllForUser(Request $request) |
58 | 87 | { |
59 | 88 | $this->validate($this->request, [ |
@@ -86,6 +115,29 @@ public function getAllForUser(Request $request) |
86 | 115 | * @param int $id |
87 | 116 | * @return \Symfony\Component\HttpFoundation\Response |
88 | 117 | */ |
| 118 | + /** |
| 119 | + * @OA\Get( |
| 120 | + * path="/apps/{id}", |
| 121 | + * tags={"Applications"}, |
| 122 | + * summary="Get an application by ID", |
| 123 | + * operationId="getApplicationById", |
| 124 | + * @OA\Parameter( |
| 125 | + * name="id", |
| 126 | + * in="path", |
| 127 | + * required=true, |
| 128 | + * description="ID of the application to retrieve", |
| 129 | + * @OA\Schema(type="integer", format="int64") |
| 130 | + * ), |
| 131 | + * @OA\Response( |
| 132 | + * response=200, |
| 133 | + * description="Successful response", |
| 134 | + * @OA\JsonContent( |
| 135 | + * type="object", |
| 136 | + * @OA\Property(property="data", type="array", @OA\Items(type="object")) |
| 137 | + * ) |
| 138 | + * ) |
| 139 | + * ) |
| 140 | + */ |
89 | 141 | public function getById($id) |
90 | 142 | { |
91 | 143 | try { |
@@ -119,6 +171,32 @@ public function getById($id) |
119 | 171 | * @param Request $request |
120 | 172 | * @return \Symfony\Component\HttpFoundation\Response |
121 | 173 | */ |
| 174 | + /** |
| 175 | + * @OA\Post( |
| 176 | + * path="/apps", |
| 177 | + * tags={"Applications"}, |
| 178 | + * summary="Create a new application", |
| 179 | + * operationId="createApplication", |
| 180 | + * @OA\RequestBody( |
| 181 | + * required=true, |
| 182 | + * @OA\JsonContent( |
| 183 | + * required={"name", "userId"}, |
| 184 | + * @OA\Property(property="name", type="string", example="My Application", description="Name of the application"), |
| 185 | + * @OA\Property(property="description", type="string", example="A description of the application", description="Description of the application (optional)"), |
| 186 | + * @OA\Property(property="userId", type="string", example="user123", description="ID of the user creating the application"), |
| 187 | + * @OA\Property(property="estimatedUsers", type="integer", example=100, description="Estimated number of users (optional)") |
| 188 | + * ) |
| 189 | + * ), |
| 190 | + * @OA\Response( |
| 191 | + * response=200, |
| 192 | + * description="Successful response", |
| 193 | + * @OA\JsonContent( |
| 194 | + * type="object", |
| 195 | + * @OA\Property(property="data", type="array", @OA\Items(type="object")) |
| 196 | + * ) |
| 197 | + * ) |
| 198 | + * ) |
| 199 | + */ |
122 | 200 | public function create(Request $request) |
123 | 201 | { |
124 | 202 | $this->validate($this->request, [ |
@@ -152,6 +230,35 @@ public function create(Request $request) |
152 | 230 | return response()->json($response->toArray(), 201); |
153 | 231 | } |
154 | 232 |
|
| 233 | + /** |
| 234 | + * @OA\Patch( |
| 235 | + * path="/apps/{id}", |
| 236 | + * tags={"Applications"}, |
| 237 | + * summary="Update an application by ID", |
| 238 | + * operationId="updateApplication", |
| 239 | + * @OA\Parameter( |
| 240 | + * name="id", |
| 241 | + * in="path", |
| 242 | + * required=true, |
| 243 | + * description="ID of the application to update", |
| 244 | + * @OA\Schema(type="integer", format="int64") |
| 245 | + * ), |
| 246 | + * @OA\RequestBody( |
| 247 | + * required=true, |
| 248 | + * @OA\JsonContent( |
| 249 | + * @OA\Property(property="estimatedUsers", type="integer", example=100, description="Estimated number of users (optional)") |
| 250 | + * ) |
| 251 | + * ), |
| 252 | + * @OA\Response( |
| 253 | + * response=200, |
| 254 | + * description="Successful response", |
| 255 | + * @OA\JsonContent( |
| 256 | + * type="object", |
| 257 | + * @OA\Property(property="data", type="array", @OA\Items(type="object")) |
| 258 | + * ) |
| 259 | + * ) |
| 260 | + * ) |
| 261 | + */ |
155 | 262 | public function update(Request $request, $id) |
156 | 263 | { |
157 | 264 | $this->validate($this->request, [ |
@@ -182,8 +289,27 @@ public function update(Request $request, $id) |
182 | 289 | } |
183 | 290 |
|
184 | 291 | /** |
185 | | - * @param int $id |
186 | | - * @return \Symfony\Component\HttpFoundation\Response |
| 292 | + * @OA\Delete( |
| 293 | + * path="/apps/{id}", |
| 294 | + * tags={"Applications"}, |
| 295 | + * summary="Delete an application by ID", |
| 296 | + * operationId="deleteApplication", |
| 297 | + * @OA\Parameter( |
| 298 | + * name="id", |
| 299 | + * in="path", |
| 300 | + * required=true, |
| 301 | + * description="ID of the application to delete", |
| 302 | + * @OA\Schema(type="integer", format="int64") |
| 303 | + * ), |
| 304 | + * @OA\Response( |
| 305 | + * response=200, |
| 306 | + * description="Successful response", |
| 307 | + * @OA\JsonContent( |
| 308 | + * type="object", |
| 309 | + * @OA\Property(property="data", type="array", @OA\Items(type="object")) |
| 310 | + * ) |
| 311 | + * ) |
| 312 | + * ) |
187 | 313 | */ |
188 | 314 | public function delete($id) |
189 | 315 | { |
|
0 commit comments