Skip to content

Commit

Permalink
Merge pull request #84 from IT-Academy-BCN/feature/fake_profile_detai…
Browse files Browse the repository at this point in the history
…l_endpoint

Feature/fake_profile_detail_endpoint
  • Loading branch information
coxen34 authored Feb 25, 2024
2 parents b59bc87 + 2f28c2c commit 23fc350
Show file tree
Hide file tree
Showing 5 changed files with 222 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

namespace App\Annotations\OpenApi\controllersAnnotations\studentAnnotations;

class AnnotationsStudentDetail
{
/**
* @OA\Get(
* path="/student/detail/for-home",
* operationId="getStudentDetail",
* tags={"Student"},
* summary="Get Student Detail.",
* description="Get student detail registered. No authentication required",
*
* @OA\Response(
* response=200,
* description="",
*
* @OA\JsonContent(
* @OA\Property(
* type="array",
* property="data",
* @OA\Items(
* type="object",
* @OA\Property(property="student_id", type="integer", example=1),
* @OA\Property(
* property="profile_detail",
* type="object",
* @OA\Property(property="fullname", type="string", example="Juan Pérez"),
* @OA\Property(property="subtitle", type="string", example="Desarrollador Frontend"),
* @OA\Property(
* property="social_media",
* type="object",
* @OA\Property(
* property="linkedin",
* type="object",
* @OA\Property(property="url", type="string", example="https://es.linkedin.com/"),
* ),
* @OA\Property(
* property="github",
* type="object",
* @OA\Property(property="url", type="string", example="https://github.com/"),
* )
* ),
* @OA\Property(
* property="about",
* type="object",
* @OA\Property(property="description", type="string", example="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam a euismod elit. Nunc elit ante, vulputate sed maximus eu, posuere eu nibh. In eget lacus in mi pharetra volutpat a a justo. Fusce aliquet nibh nec accumsan facilisis. Suspendisse in tempor nibh, eu fermentum velit. Suspendisse cursus ultricies ipsum, eget tincidunt arcu pretium laoreet. Pellentesque eget egestas erat. Donec dapibus pharetra ultrices. Vivamus mollis sapien sed laoreet interdum."
* )
* ),
* @OA\Property(property="tags",type="array",@OA\Items(ref="#/components/schemas/Tag"))
* )
*
* )
* )
* )
* ),
*
*
* @OA\Schema(
* schema="Tag",
* type="object",
* @OA\Property(property="id", type="integer", example=1),
* @OA\Property(property="name", type="string", example="JavaScript"),
* example={"id": 1, "name": "JavaScript"}
* )
* )
*/
public function __invoke()
{
}
}
15 changes: 15 additions & 0 deletions app/Http/Controllers/api/StudentDetailController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Http\Controllers\api;

use App\Http\Controllers\Controller;

class StudentDetailController extends Controller
{
public function __invoke()
{
$data = file_get_contents(base_path('database/data/studentDetail.json'));

return response()->json(json_decode($data, true));
}
}
40 changes: 40 additions & 0 deletions database/data/studentDetail.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[
{
"student_id": 1,
"profile_detail": {
"fullname": "Juan Pérez",
"subtitle": "Desarrollador Frontend",
"social_media": {
"linkedin": {
"url": "https://es.linkedin.com/"
},
"github": {
"url": "https://github.com/"

}
},
"about": {
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam a euismod elit. Nunc elit ante, vulputate sed maximus eu, posuere eu nibh. In eget lacus in mi pharetra volutpat a a justo. Fusce aliquet nibh nec accumsan facilisis. Suspendisse in tempor nibh, eu fermentum velit. Suspendisse cursus ultricies ipsum, eget tincidunt arcu pretium laoreet. Pellentesque eget egestas erat. Donec dapibus pharetra ultrices. Vivamus mollis sapien sed laoreet interdum."

},
"tags": [
{
"id": 1,
"name": "JavaScript"
},
{
"id": 2,
"name": "React"
},
{
"id": 3,
"name": "HTML"
},
{
"id": 4,
"name": "CSS"
}
]
}
}
]
8 changes: 6 additions & 2 deletions routes/api/v1.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Http\Controllers\api\RecruiterController;
use App\Http\Controllers\api\StudentController;
use App\Http\Controllers\api\StudentListController;
use App\Http\Controllers\api\StudentDetailController;
use App\Http\Controllers\api\TagController;
use App\Http\Controllers\api\SpecializationListController;
use Illuminate\Support\Facades\Route;
Expand All @@ -26,12 +27,15 @@
Route::get('/students', [StudentController::class, 'index'])->name('students.list');
Route::get('/students/{id}', [StudentController::class, 'show'])->name('student.show');

// Students Home
Route::get('/student/list/for-home', StudentListController::class)->name('profiles.home');
Route::get('/student/detail/for-home', StudentDetailController::class)->name('student.detail');

Route::post('/recruiters', [RecruiterController::class, 'store'])->name('recruiter.create');
Route::get('/recruiters', [RecruiterController::class, 'index'])->name('recruiter.list');
Route::get('/recruiters/{id}', [RecruiterController::class, 'show'])->name('recruiter.show');

// Students
Route::get('/student/list/for-home', StudentListController::class)->name('profiles.home');


// Specialization List Endpoint
Route::get('/specialization/list', SpecializationListController::class)->name('roles.list');
Expand Down
91 changes: 89 additions & 2 deletions storage/api-docs/api-docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
},
"servers": [
{
"url": "http://127.0.0.1:8000"
"url": "https://itaperfils.eurecatacademy.org"
},
{
"url": "http://127.0.0.1:8000/api/v1"
"url": "https://itaperfils.eurecatacademy.org/api/v1"
}
],
"paths": {
Expand Down Expand Up @@ -559,6 +559,93 @@
]
}
},
"/student/detail/for-home": {
"get": {
"tags": [
"Student"
],
"summary": "Get Student Detail.",
"description": "Get student detail registered. No authentication required",
"operationId": "getStudentDetail",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"properties": {
"data": {
"type": "array",
"items": {
"properties": {
"student_id": {
"type": "integer",
"example": 1
},
"profile_detail": {
"properties": {
"fullname": {
"type": "string",
"example": "Juan Pérez"
},
"subtitle": {
"type": "string",
"example": "Desarrollador Frontend"
},
"social_media": {
"properties": {
"linkedin": {
"properties": {
"url": {
"type": "string",
"example": "https://es.linkedin.com/"
}
},
"type": "object"
},
"github": {
"properties": {
"url": {
"type": "string",
"example": "https://github.com/"
}
},
"type": "object"
}
},
"type": "object"
},
"about": {
"properties": {
"description": {
"type": "string",
"example": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam a euismod elit. Nunc elit ante, vulputate sed maximus eu, posuere eu nibh. In eget lacus in mi pharetra volutpat a a justo. Fusce aliquet nibh nec accumsan facilisis. Suspendisse in tempor nibh, eu fermentum velit. Suspendisse cursus ultricies ipsum, eget tincidunt arcu pretium laoreet. Pellentesque eget egestas erat. Donec dapibus pharetra ultrices. Vivamus mollis sapien sed laoreet interdum."
}
},
"type": "object"
},
"tags": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Tag"
}
}
},
"type": "object"
}
},
"type": "object"
}
}
},
"type": "object"
}
}
}
}
}
}
},
"/admins": {
"get": {
"tags": [
Expand Down

0 comments on commit 23fc350

Please sign in to comment.