Compare commits
7 Commits
6b5067217c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b59ec51b5c | ||
| f67eb5eb53 | |||
|
|
b0765e8aac | ||
|
|
6e2fdb5087 | ||
|
|
340365b258 | ||
|
|
34f507f68e | ||
|
|
c36aeed03c |
34
README.md
Normal file
34
README.md
Normal file
@@ -0,0 +1,34 @@
|
||||
<h1 align=center>Blog API</h1>
|
||||
|
||||
<p align="center">
|
||||
<a href="#prerequis"><img src="https://img.shields.io/badge/Prerequis-000fff.svg" alt="Prérequis"></a>
|
||||
<a href="#installation"><img src="https://img.shields.io/badge/Installation-000ff.svg" alt="Installation"></a>
|
||||
<a href="#usage"><img src="https://img.shields.io/badge/Usage-f00.svg" alt="Usage"></a>
|
||||
</p>
|
||||
|
||||
## Prérequis
|
||||
Pour exécuter ce projet vous devez avoir :
|
||||
- Docker
|
||||
- Docker Compose
|
||||
- Make
|
||||
|
||||
## Installation
|
||||
Pour installer le projet, il faut d'abord cloner le repo, puis lancer les conteneurs :
|
||||
|
||||
```bash
|
||||
make run
|
||||
```
|
||||
|
||||
Il vous faudra ensuite modifier le fichier `.env` pour y mettre les credentials de la base de données, telles qu'elles sont décrites dans `images/.env`.
|
||||
|
||||
## Usage
|
||||
|
||||
Pour utiliser l'API, vous pouvez utiliser un client HTTP comme Postman ou Insomnia.
|
||||
|
||||
Cependant, pour simplifier les requêtes vous pouvez utiliser le swagger mis à disposition à l'adresse suivante :
|
||||
|
||||
```plaintext
|
||||
http://localhost:8000/api/docs
|
||||
// ou en production
|
||||
https://isi2.ale-pri.com/swagger
|
||||
```
|
||||
0
laravel/.buildcomplete
Normal file → Executable file
0
laravel/.buildcomplete
Normal file → Executable file
0
laravel/.editorconfig
Normal file → Executable file
0
laravel/.editorconfig
Normal file → Executable file
0
laravel/.env.example
Normal file → Executable file
0
laravel/.env.example
Normal file → Executable file
0
laravel/.gitattributes
vendored
Normal file → Executable file
0
laravel/.gitattributes
vendored
Normal file → Executable file
0
laravel/.gitignore
vendored
Normal file → Executable file
0
laravel/.gitignore
vendored
Normal file → Executable file
0
laravel/.spdx-laravel.spdx
Normal file → Executable file
0
laravel/.spdx-laravel.spdx
Normal file → Executable file
0
laravel/README.md
Normal file → Executable file
0
laravel/README.md
Normal file → Executable file
0
laravel/app/Http/Controllers/BilletController.php
Normal file → Executable file
0
laravel/app/Http/Controllers/BilletController.php
Normal file → Executable file
0
laravel/app/Http/Controllers/CommentaireController.php
Normal file → Executable file
0
laravel/app/Http/Controllers/CommentaireController.php
Normal file → Executable file
0
laravel/app/Http/Controllers/Controller.php
Normal file → Executable file
0
laravel/app/Http/Controllers/Controller.php
Normal file → Executable file
0
laravel/app/Http/Controllers/UserController.php
Normal file → Executable file
0
laravel/app/Http/Controllers/UserController.php
Normal file → Executable file
0
laravel/app/Http/Requests/StoreBilletRequest.php
Normal file → Executable file
0
laravel/app/Http/Requests/StoreBilletRequest.php
Normal file → Executable file
0
laravel/app/Http/Requests/StoreCommentairesRequest.php
Normal file → Executable file
0
laravel/app/Http/Requests/StoreCommentairesRequest.php
Normal file → Executable file
0
laravel/app/Http/Requests/UpdateBilletRequest.php
Normal file → Executable file
0
laravel/app/Http/Requests/UpdateBilletRequest.php
Normal file → Executable file
0
laravel/app/Http/Requests/UpdateCommentairesRequest.php
Normal file → Executable file
0
laravel/app/Http/Requests/UpdateCommentairesRequest.php
Normal file → Executable file
0
laravel/app/Http/Resources/BilletResource.php
Normal file → Executable file
0
laravel/app/Http/Resources/BilletResource.php
Normal file → Executable file
0
laravel/app/Http/Resources/BilletsResource.php
Normal file → Executable file
0
laravel/app/Http/Resources/BilletsResource.php
Normal file → Executable file
0
laravel/app/Http/Resources/CommentaireResource.php
Normal file → Executable file
0
laravel/app/Http/Resources/CommentaireResource.php
Normal file → Executable file
0
laravel/app/Http/Resources/UserResource.php
Normal file → Executable file
0
laravel/app/Http/Resources/UserResource.php
Normal file → Executable file
0
laravel/app/Models/Billet.php
Normal file → Executable file
0
laravel/app/Models/Billet.php
Normal file → Executable file
1
laravel/app/Models/Commentaire.php
Normal file → Executable file
1
laravel/app/Models/Commentaire.php
Normal file → Executable file
@@ -26,6 +26,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
*/
|
||||
class Commentaire extends Model
|
||||
{
|
||||
use \Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
protected $table = 'commentaires';
|
||||
|
||||
protected $casts = [
|
||||
|
||||
0
laravel/app/Models/User.php
Normal file → Executable file
0
laravel/app/Models/User.php
Normal file → Executable file
0
laravel/app/Policies/BilletPolicy.php
Normal file → Executable file
0
laravel/app/Policies/BilletPolicy.php
Normal file → Executable file
0
laravel/app/Policies/CommentairesPolicy.php
Normal file → Executable file
0
laravel/app/Policies/CommentairesPolicy.php
Normal file → Executable file
4
laravel/app/Providers/AppServiceProvider.php
Normal file → Executable file
4
laravel/app/Providers/AppServiceProvider.php
Normal file → Executable file
@@ -19,6 +19,8 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
if (env('APP_ENV') === 'production') {
|
||||
$this->app['request']->server->set('HTTPS','on'); // this line
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
laravel/app/Providers/SwaggerUiServiceProvider.php
Executable file
18
laravel/app/Providers/SwaggerUiServiceProvider.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class SwaggerUiServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot() : void
|
||||
{
|
||||
Gate::define('viewSwaggerUI', function ($user = null) {
|
||||
return in_array(optional($user)->email, [
|
||||
//
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
0
laravel/bootstrap/app.php
Normal file → Executable file
0
laravel/bootstrap/app.php
Normal file → Executable file
0
laravel/bootstrap/cache/.gitignore
vendored
Normal file → Executable file
0
laravel/bootstrap/cache/.gitignore
vendored
Normal file → Executable file
0
laravel/bootstrap/providers.php
Normal file → Executable file
0
laravel/bootstrap/providers.php
Normal file → Executable file
3
laravel/composer.json
Normal file → Executable file
3
laravel/composer.json
Normal file → Executable file
@@ -9,7 +9,8 @@
|
||||
"php": "^8.2",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/sanctum": "^4.0",
|
||||
"laravel/tinker": "^2.10.1"
|
||||
"laravel/tinker": "^2.10.1",
|
||||
"wotz/laravel-swagger-ui": "^1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.23",
|
||||
|
||||
71
laravel/composer.lock
generated
Normal file → Executable file
71
laravel/composer.lock
generated
Normal file → Executable file
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "85c1d2065f70e38b0d6bf66559fb13c5",
|
||||
"content-hash": "9ab0c2699b085b8f930df0cbb271b9a3",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@@ -5842,6 +5842,75 @@
|
||||
"source": "https://github.com/webmozarts/assert/tree/1.11.0"
|
||||
},
|
||||
"time": "2022-06-03T18:03:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "wotz/laravel-swagger-ui",
|
||||
"version": "1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/wotzebra/laravel-swagger-ui.git",
|
||||
"reference": "f63430e96179c919c521ebb76fc4dddcc8b3dfae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/wotzebra/laravel-swagger-ui/zipball/f63430e96179c919c521ebb76fc4dddcc8b3dfae",
|
||||
"reference": "f63430e96179c919c521ebb76fc4dddcc8b3dfae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"laravel/framework": "^9.0|^10.0|^11.0|^12.0",
|
||||
"php": "^8.1|^8.2|^8.3|^8.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"adamwojs/php-cs-fixer-phpdoc-force-fqcn": "^2.0",
|
||||
"friendsofphp/php-cs-fixer": "^3.0",
|
||||
"guzzlehttp/guzzle": "^7.5",
|
||||
"jasonmccreary/laravel-test-assertions": "^2.3",
|
||||
"orchestra/testbench": "^7.0|^8.0|^9.0|^10.0",
|
||||
"phpunit/phpunit": "^9.5|^10.0|^11.5.3",
|
||||
"squizlabs/php_codesniffer": "^3.6"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-yaml": "*"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Wotz\\SwaggerUi\\SwaggerUiServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Wotz\\SwaggerUi\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Günther Debrauwer",
|
||||
"email": "gunther.debrauwer@whoownsthezebra.be",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Add Swagger UI to a Laravel application.",
|
||||
"homepage": "https://github.com/wotzebra/laravel-swagger-ui",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"openapi",
|
||||
"swagger",
|
||||
"swagger-ui"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/wotzebra/laravel-swagger-ui/issues",
|
||||
"source": "https://github.com/wotzebra/laravel-swagger-ui/tree/1.2.0"
|
||||
},
|
||||
"time": "2025-03-05T09:26:18+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
|
||||
0
laravel/config/app.php
Normal file → Executable file
0
laravel/config/app.php
Normal file → Executable file
0
laravel/config/auth.php
Normal file → Executable file
0
laravel/config/auth.php
Normal file → Executable file
0
laravel/config/cache.php
Normal file → Executable file
0
laravel/config/cache.php
Normal file → Executable file
0
laravel/config/database.php
Normal file → Executable file
0
laravel/config/database.php
Normal file → Executable file
0
laravel/config/filesystems.php
Normal file → Executable file
0
laravel/config/filesystems.php
Normal file → Executable file
0
laravel/config/logging.php
Normal file → Executable file
0
laravel/config/logging.php
Normal file → Executable file
0
laravel/config/mail.php
Normal file → Executable file
0
laravel/config/mail.php
Normal file → Executable file
0
laravel/config/queue.php
Normal file → Executable file
0
laravel/config/queue.php
Normal file → Executable file
0
laravel/config/sanctum.php
Normal file → Executable file
0
laravel/config/sanctum.php
Normal file → Executable file
0
laravel/config/services.php
Normal file → Executable file
0
laravel/config/services.php
Normal file → Executable file
0
laravel/config/session.php
Normal file → Executable file
0
laravel/config/session.php
Normal file → Executable file
72
laravel/config/swagger-ui.php
Executable file
72
laravel/config/swagger-ui.php
Executable file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
use Wotz\SwaggerUi\Http\Middleware\EnsureUserIsAuthorized;
|
||||
|
||||
return [
|
||||
'files' => [
|
||||
[
|
||||
/*
|
||||
* The path where the swagger file is served.
|
||||
*/
|
||||
'path' => 'swagger',
|
||||
|
||||
/*
|
||||
* The title of the page where the swagger file is served.
|
||||
*/
|
||||
'title' => env('APP_NAME') . ' - Swagger',
|
||||
|
||||
/*
|
||||
* The versions of the swagger file. The key is the version name and the value is the path to the file.
|
||||
*/
|
||||
'versions' => [
|
||||
'v1' => resource_path('/swagger/openapi.json'),
|
||||
],
|
||||
|
||||
/*
|
||||
* The default version that is loaded when the route is accessed.
|
||||
*/
|
||||
'default' => 'v1',
|
||||
|
||||
/*
|
||||
* The middleware that is applied to the route.
|
||||
*/
|
||||
'middleware' => [
|
||||
'web',
|
||||
EnsureUserIsAuthorized::class,
|
||||
],
|
||||
|
||||
/*
|
||||
* Specify the validator URL. Set to false to disable validation.
|
||||
*/
|
||||
'validator_url' => false,
|
||||
|
||||
/*
|
||||
* If enabled the file will be modified to set the server url and oauth urls.
|
||||
*/
|
||||
'modify_file' => true,
|
||||
|
||||
/*
|
||||
* The server URL configuration for the swagger file.
|
||||
*/
|
||||
'server_url' => env('APP_URL'),
|
||||
|
||||
/*
|
||||
* The oauth configuration for the swagger file.
|
||||
*/
|
||||
'oauth' => [
|
||||
'token_path' => 'oauth/token',
|
||||
'refresh_path' => 'oauth/token',
|
||||
'authorization_path' => 'oauth/authorize',
|
||||
|
||||
'client_id' => env('SWAGGER_UI_OAUTH_CLIENT_ID'),
|
||||
'client_secret' => env('SWAGGER_UI_OAUTH_CLIENT_SECRET'),
|
||||
],
|
||||
|
||||
/*
|
||||
* Path to a custom stylesheet file if you want to customize the look and feel of swagger-ui.
|
||||
* The content of the file will be read and added into a style-tag on the swagger-ui page.
|
||||
*/
|
||||
'stylesheet' => null,
|
||||
],
|
||||
],
|
||||
];
|
||||
0
laravel/database/.gitignore
vendored
Normal file → Executable file
0
laravel/database/.gitignore
vendored
Normal file → Executable file
0
laravel/database/factories/BilletFactory.php
Normal file → Executable file
0
laravel/database/factories/BilletFactory.php
Normal file → Executable file
4
laravel/database/factories/CommentairesFactory.php → laravel/database/factories/CommentaireFactory.php
Normal file → Executable file
4
laravel/database/factories/CommentairesFactory.php → laravel/database/factories/CommentaireFactory.php
Normal file → Executable file
@@ -5,9 +5,9 @@ namespace Database\Factories;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Commentaires>
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Commentaire>
|
||||
*/
|
||||
class CommentairesFactory extends Factory
|
||||
class CommentaireFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
0
laravel/database/factories/UserFactory.php
Normal file → Executable file
0
laravel/database/factories/UserFactory.php
Normal file → Executable file
0
laravel/database/migrations/0001_01_01_000000_create_users_table.php
Normal file → Executable file
0
laravel/database/migrations/0001_01_01_000000_create_users_table.php
Normal file → Executable file
0
laravel/database/migrations/0001_01_01_000001_create_cache_table.php
Normal file → Executable file
0
laravel/database/migrations/0001_01_01_000001_create_cache_table.php
Normal file → Executable file
0
laravel/database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file → Executable file
0
laravel/database/migrations/0001_01_01_000002_create_jobs_table.php
Normal file → Executable file
0
laravel/database/migrations/2025_06_04_062118_create_personal_access_tokens_table.php
Normal file → Executable file
0
laravel/database/migrations/2025_06_04_062118_create_personal_access_tokens_table.php
Normal file → Executable file
0
laravel/database/migrations/2025_06_04_062336_create_billets_table.php
Normal file → Executable file
0
laravel/database/migrations/2025_06_04_062336_create_billets_table.php
Normal file → Executable file
0
laravel/database/migrations/2025_06_04_063420_create_commentaires_table.php
Normal file → Executable file
0
laravel/database/migrations/2025_06_04_063420_create_commentaires_table.php
Normal file → Executable file
0
laravel/database/seeders/BilletSeeder.php
Normal file → Executable file
0
laravel/database/seeders/BilletSeeder.php
Normal file → Executable file
2
laravel/database/seeders/CommentairesSeeder.php → laravel/database/seeders/CommentaireSeeder.php
Normal file → Executable file
2
laravel/database/seeders/CommentairesSeeder.php → laravel/database/seeders/CommentaireSeeder.php
Normal file → Executable file
@@ -6,7 +6,7 @@ use App\Models\Commentaire;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class CommentairesSeeder extends Seeder
|
||||
class CommentaireSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
0
laravel/database/seeders/DatabaseSeeder.php
Normal file → Executable file
0
laravel/database/seeders/DatabaseSeeder.php
Normal file → Executable file
0
laravel/database/seeders/UserSeeder.php
Normal file → Executable file
0
laravel/database/seeders/UserSeeder.php
Normal file → Executable file
0
laravel/licenses/laravel-12.0.3.txt
Normal file → Executable file
0
laravel/licenses/laravel-12.0.3.txt
Normal file → Executable file
0
laravel/log/laravel.log
Normal file → Executable file
0
laravel/log/laravel.log
Normal file → Executable file
0
laravel/package.json
Normal file → Executable file
0
laravel/package.json
Normal file → Executable file
0
laravel/phpunit.xml
Normal file → Executable file
0
laravel/phpunit.xml
Normal file → Executable file
0
laravel/public/.htaccess
Normal file → Executable file
0
laravel/public/.htaccess
Normal file → Executable file
0
laravel/public/favicon.ico
Normal file → Executable file
0
laravel/public/favicon.ico
Normal file → Executable file
0
laravel/public/index.php
Normal file → Executable file
0
laravel/public/index.php
Normal file → Executable file
0
laravel/public/robots.txt
Normal file → Executable file
0
laravel/public/robots.txt
Normal file → Executable file
0
laravel/resources/css/app.css
Normal file → Executable file
0
laravel/resources/css/app.css
Normal file → Executable file
0
laravel/resources/js/app.js
Normal file → Executable file
0
laravel/resources/js/app.js
Normal file → Executable file
0
laravel/resources/js/bootstrap.js
vendored
Normal file → Executable file
0
laravel/resources/js/bootstrap.js
vendored
Normal file → Executable file
432
laravel/resources/swagger/openapi.json
Normal file
432
laravel/resources/swagger/openapi.json
Normal file
@@ -0,0 +1,432 @@
|
||||
{
|
||||
"openapi": "3.0.4",
|
||||
"info": {
|
||||
"title": "Blog API",
|
||||
"description": "Projet Laravel avec Sanctum pour l'authentification",
|
||||
"license": {
|
||||
"name": "Creative Commons 4.0",
|
||||
"url": "https://creativecommons.org/licenses/by/4.0/"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://isi2.ale-pri.com/api/",
|
||||
"description": "Serveur de production"
|
||||
},
|
||||
{
|
||||
"url": "http://localhost:8000/api/",
|
||||
"description": "Serveur de développement local"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"name": "billets",
|
||||
"description": "Opérations sur les billets"
|
||||
},
|
||||
{
|
||||
"name": "commentaires",
|
||||
"description": "Operations sur les commentaires"
|
||||
},
|
||||
{
|
||||
"name": "user",
|
||||
"description": "Operations about user"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/billets": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"billets"
|
||||
],
|
||||
"summary": "Liste des billets",
|
||||
"operationId": "getBillets",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Liste des billets",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Billet"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/login": {
|
||||
"post": {
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Authentification réussie",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TokenResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Authentification échouée"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Authentification de l'utilisateur",
|
||||
"operationId": "loginUser",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/LoginRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/register": {
|
||||
"post": {
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Utilisateur créé avec succès",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/TokenResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Erreur de validation"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Enregistrement d'un nouvel utilisateur",
|
||||
"operationId": "registerUser",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/RegisterRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"sanctum": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Récupérer les informations de l'utilisateur connecté",
|
||||
"operationId": "getUser",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Informations de l'utilisateur",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/User"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Non autorisé"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/user/logout": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"sanctum": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Déconnexion de l'utilisateur",
|
||||
"operationId": "logoutUser",
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "Déconnexion réussie"
|
||||
},
|
||||
"401": {
|
||||
"description": "Non autorisé"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/billets/{id}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"sanctum": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"billets"
|
||||
],
|
||||
"summary": "Détails d'un billet",
|
||||
"operationId": "getBilletById",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
},
|
||||
"description": "ID du billet"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Détails du billet",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/BilletWithComments"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Billet non trouvé"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/commentaires": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"sanctum": []
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"commentaires"
|
||||
],
|
||||
"summary": "Ajouter un commentaire à un billet",
|
||||
"operationId": "addComment",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CommentaireRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Commentaire ajouté avec succès",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Commentaire"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Erreur de validation"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"Billet": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Date": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"example": "2023-10-01"
|
||||
},
|
||||
"Titre": {
|
||||
"type": "string",
|
||||
"example": "Billet 1"
|
||||
},
|
||||
"Contenu": {
|
||||
"type": "string",
|
||||
"example": "Lorem ipsum dolor sit amet."
|
||||
}
|
||||
}
|
||||
},
|
||||
"BilletWithComments": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Date": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"example": "2023-10-01"
|
||||
},
|
||||
"Titre": {
|
||||
"type": "string",
|
||||
"example": "Billet 1"
|
||||
},
|
||||
"Contenu": {
|
||||
"type": "string",
|
||||
"example": "Lorem ipsum dolor sit amet."
|
||||
},
|
||||
"Commentaires": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Commentaire"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Commentaire": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"COM_DATE": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"example": "2023-10-01"
|
||||
},
|
||||
"COM_AUTEUR": {
|
||||
"type": "string",
|
||||
"example": "John Doe"
|
||||
},
|
||||
"COM_CONTENU": {
|
||||
"type": "string",
|
||||
"example": "Lorem ipsum dolor sit amet."
|
||||
},
|
||||
"billet_id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"user_id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"CommentaireRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"COM_DATE": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"example": "2023-10-01"
|
||||
},
|
||||
"COM_CONTENU": {
|
||||
"type": "string",
|
||||
"example": "Lorem ipsum dolor sit amet."
|
||||
},
|
||||
"billet_id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"user_id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"LoginRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string",
|
||||
"format": "email",
|
||||
"example": "au@secou.rs"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"format": "password",
|
||||
"example": "secret123"
|
||||
}
|
||||
}
|
||||
},
|
||||
"TokenResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"token": {
|
||||
"type": "string",
|
||||
"example": "1|a2b3c4d5e6f7g8h9i0j"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"example": "Bearer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RegisterRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "John Doe"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"format": "email",
|
||||
"example": "au@secou.rs"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"format": "password",
|
||||
"example": "secret123"
|
||||
}
|
||||
}
|
||||
},
|
||||
"User": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 1
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "John Doe"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"format": "email",
|
||||
"example": "au@secou.rs"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securitySchemes": {
|
||||
"sanctum": {
|
||||
"type": "http",
|
||||
"scheme": "bearer",
|
||||
"bearerFormat": "Bearer",
|
||||
"description": "Utiliser le token Bearer pour l'authentification"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
281
laravel/resources/swagger/openapi.yml
Executable file
281
laravel/resources/swagger/openapi.yml
Executable file
@@ -0,0 +1,281 @@
|
||||
openapi: 3.0.4
|
||||
info:
|
||||
title: Blog API
|
||||
description: |-
|
||||
Projet Laravel avec Sanctum pour l'authentification
|
||||
license:
|
||||
name: Creative Commons 4.0
|
||||
url: https://creativecommons.org/licenses/by/4.0/
|
||||
version: 1.0.0
|
||||
servers:
|
||||
- url: https://isi2.ale-pri.com/api/
|
||||
description: Serveur de production
|
||||
- url: http://localhost:8000/api/
|
||||
description: Serveur de développement local
|
||||
tags:
|
||||
- name: billets
|
||||
description: Opérations sur les billets
|
||||
- name: commentaires
|
||||
description: Operations sur les commentaires
|
||||
- name: user
|
||||
description: Operations about user
|
||||
paths:
|
||||
/billets:
|
||||
get:
|
||||
tags:
|
||||
- billets
|
||||
summary: Liste des billets
|
||||
operationId: getBillets
|
||||
responses:
|
||||
'200':
|
||||
description: Liste des billets
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Billet'
|
||||
/login:
|
||||
post:
|
||||
responses:
|
||||
'200':
|
||||
description: Authentification réussie
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TokenResponse'
|
||||
'401':
|
||||
description: Authentification échouée
|
||||
tags:
|
||||
- user
|
||||
summary: Authentification de l'utilisateur
|
||||
operationId: loginUser
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/LoginRequest'
|
||||
/register:
|
||||
post:
|
||||
responses:
|
||||
'201':
|
||||
description: Utilisateur créé avec succès
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TokenResponse'
|
||||
'422':
|
||||
description: Erreur de validation
|
||||
tags:
|
||||
- user
|
||||
summary: Enregistrement d'un nouvel utilisateur
|
||||
operationId: registerUser
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RegisterRequest'
|
||||
/user:
|
||||
get:
|
||||
security:
|
||||
- sanctum: []
|
||||
tags:
|
||||
- user
|
||||
summary: Récupérer les informations de l'utilisateur connecté
|
||||
operationId: getUser
|
||||
responses:
|
||||
'200':
|
||||
description: Informations de l'utilisateur
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
'401':
|
||||
description: Non autorisé
|
||||
/user/logout:
|
||||
post:
|
||||
security:
|
||||
- sanctum: []
|
||||
tags:
|
||||
- user
|
||||
summary: Déconnexion de l'utilisateur
|
||||
operationId: logoutUser
|
||||
responses:
|
||||
'204':
|
||||
description: Déconnexion réussie
|
||||
'401':
|
||||
description: Non autorisé
|
||||
/billets/{id}:
|
||||
get:
|
||||
security:
|
||||
- sanctum: []
|
||||
tags:
|
||||
- billets
|
||||
summary: Détails d'un billet
|
||||
operationId: getBilletById
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
description: ID du billet
|
||||
responses:
|
||||
'200':
|
||||
description: Détails du billet
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/BilletWithComments'
|
||||
'404':
|
||||
description: Billet non trouvé
|
||||
/commentaires:
|
||||
post:
|
||||
security:
|
||||
- sanctum: []
|
||||
tags:
|
||||
- commentaires
|
||||
summary: Ajouter un commentaire à un billet
|
||||
operationId: addComment
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CommentaireRequest'
|
||||
responses:
|
||||
'201':
|
||||
description: Commentaire ajouté avec succès
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Commentaire'
|
||||
'422':
|
||||
description: Erreur de validation
|
||||
|
||||
|
||||
components:
|
||||
schemas:
|
||||
Billet:
|
||||
type: object
|
||||
properties:
|
||||
Date:
|
||||
type: string
|
||||
format: date-time
|
||||
example: '2023-10-01'
|
||||
Titre:
|
||||
type: string
|
||||
example: Billet 1
|
||||
Contenu:
|
||||
type: string
|
||||
example: Lorem ipsum dolor sit amet.
|
||||
BilletWithComments:
|
||||
type: object
|
||||
properties:
|
||||
Date:
|
||||
type: string
|
||||
format: date-time
|
||||
example: '2023-10-01'
|
||||
Titre:
|
||||
type: string
|
||||
example: Billet 1
|
||||
Contenu:
|
||||
type: string
|
||||
example: Lorem ipsum dolor sit amet.
|
||||
Commentaires:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Commentaire'
|
||||
Commentaire:
|
||||
type: object
|
||||
properties:
|
||||
COM_DATE:
|
||||
type: string
|
||||
format: date-time
|
||||
example: '2023-10-01'
|
||||
COM_AUTEUR:
|
||||
type: string
|
||||
example: John Doe
|
||||
COM_CONTENU:
|
||||
type: string
|
||||
example: Lorem ipsum dolor sit amet.
|
||||
billet_id:
|
||||
type: integer
|
||||
example: 1
|
||||
user_id:
|
||||
type: integer
|
||||
example: 1
|
||||
CommentaireRequest:
|
||||
type: object
|
||||
properties:
|
||||
COM_DATE:
|
||||
type: string
|
||||
format: date-time
|
||||
example: '2023-10-01'
|
||||
COM_CONTENU:
|
||||
type: string
|
||||
example: Lorem ipsum dolor sit amet.
|
||||
billet_id:
|
||||
type: integer
|
||||
example: 1
|
||||
user_id:
|
||||
type: integer
|
||||
example: 1
|
||||
LoginRequest:
|
||||
type: object
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
example: au@secou.rs
|
||||
password:
|
||||
type: string
|
||||
format: password
|
||||
example: secret123
|
||||
TokenResponse:
|
||||
type: object
|
||||
properties:
|
||||
token:
|
||||
type: string
|
||||
example: 1|a2b3c4d5e6f7g8h9i0j
|
||||
type:
|
||||
type: string
|
||||
example: Bearer
|
||||
RegisterRequest:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
example: John Doe
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
example: au@secou.rs
|
||||
password:
|
||||
type: string
|
||||
format: password
|
||||
example: secret123
|
||||
User:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
example: 1
|
||||
name:
|
||||
type: string
|
||||
example: John Doe
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
example: au@secou.rs
|
||||
securitySchemes:
|
||||
sanctum:
|
||||
type: http
|
||||
scheme: bearer
|
||||
bearerFormat: Bearer
|
||||
description: Utiliser le token Bearer pour l'authentification
|
||||
0
laravel/resources/views/welcome.blade.php
Normal file → Executable file
0
laravel/resources/views/welcome.blade.php
Normal file → Executable file
0
laravel/routes/console.php
Normal file → Executable file
0
laravel/routes/console.php
Normal file → Executable file
0
laravel/routes/web.php
Normal file → Executable file
0
laravel/routes/web.php
Normal file → Executable file
0
laravel/storage/app/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/app/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/app/private/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/app/private/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/app/public/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/app/public/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/cache/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/cache/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/cache/data/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/cache/data/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/sessions/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/sessions/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/testing/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/testing/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/views/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/framework/views/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/logs/.gitignore
vendored
Normal file → Executable file
0
laravel/storage/logs/.gitignore
vendored
Normal file → Executable file
0
laravel/tests/Feature/ExampleTest.php
Normal file → Executable file
0
laravel/tests/Feature/ExampleTest.php
Normal file → Executable file
0
laravel/tests/TestCase.php
Normal file → Executable file
0
laravel/tests/TestCase.php
Normal file → Executable file
0
laravel/tests/Unit/ExampleTest.php
Normal file → Executable file
0
laravel/tests/Unit/ExampleTest.php
Normal file → Executable file
0
laravel/vite.config.js
Normal file → Executable file
0
laravel/vite.config.js
Normal file → Executable file
Reference in New Issue
Block a user