{ "openapi": "3.0.0", "info": { "title": "API de gestion de dettes", "version": "1.0.0", "description": "API pour gérer les dettes des clients dans un magasin" }, "servers": [ { "url": "http://localhost:8000", "description": "Serveur Local" } ], "paths": { "/api/v1/dettes": { "post": { "summary": "Créer une nouvelle dette", "description": "Crée une nouvelle dette pour un client, avec possibilité d'ajouter des articles et un paiement initial.", "tags": ["Dettes"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "montant": { "type": "number", "description": "Le montant total de la dette", "example": 500.00 }, "clientId": { "type": "integer", "description": "L'ID du client associé à la dette", "example": 1 }, "date_echeance": { "type": "string", "description": "date echeance", "example": "2024-09-10" }, "articles": { "type": "array", "description": "Liste des articles associés à la dette", "items": { "type": "object", "properties": { "articleId": { "type": "integer", "description": "L'ID de l'article", "example": 2 }, "qteVente": { "type": "integer", "description": "Quantité vendue de l'article", "example": 3 }, "prixVente": { "type": "number", "description": "Prix de vente de l'article", "example": 100.00 } } } }, "paiement": { "type": "object", "description": "Détails du paiement initial (facultatif)", "properties": { "montant": { "type": "number", "description": "Montant du paiement", "example": 150.00 } } } }, "required": ["montant", "clientId", "articles"] } } } }, "responses": { "201": { "description": "Dette créée avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Dettes" } } } }, "400": { "description": "Erreur de validation." }, "404": { "description": "Client ou article non trouvé." } } } } , "/api/v1/dettes/{id}": { "get": { "summary": "Afficher une dette", "description": "Récupère les détails d'une dette spécifique.", "tags": ["Dettes"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "ID de la dette" } ], "responses": { "200": { "description": "Détails de la dette récupérés avec succès.", "content": { "application/json": { "$ref": "#/components/schemas/Dettes" } } }, "404": { "description": "Dette non trouvée" } } } }, "/api/v1/dettes/{id}/articles": { "get": { "summary": "Récupérer les articles d'une dette", "description": "Récupère les articles associés à une dette spécifique.", "tags": ["Dettes", "Articles"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "ID de la dette" } ], "responses": { "200": { "description": "Articles associés à la dette récupérés avec succès.", "content": { "application/json": { "type": "array", "items": { "$ref": "#/components/schemas/Article" } } } }, "404": { "description": "Dette ou articles non trouvés" } } } }, "/api/v1/dettes/{id}/paiements": { "get": { "summary": "Récupérer les paiements d'une dette", "description": "Récupère les paiements associés à une dette spécifique.", "tags": ["Dettes", "Paiements"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "ID de la dette" } ], "responses": { "200": { "description": "Paiements associés à la dette récupérés avec succès.", "content": { "application/json": { "type": "array", "items": { "$ref": "#/components/schemas/Paiement" } } } }, "404": { "description": "Dette ou paiements non trouvés" } } }, "post": { "summary": "Créer un paiement pour une dette", "description": "Crée un paiement pour une dette spécifique.", "tags": ["Dettes", "Paiements"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "ID de la dette" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Paiement" } } } }, "responses": { "201": { "description": "Paiement créé avec succès.", "content": { "application/json": { "$ref": "#/components/schemas/Paiement" } } }, "404": { "description": "Dette non trouvée" } } } }, "/api/v1/archive/clients/{id}/dettes": { "get": { "summary": "Récupérer les dettes archivées pour un client spécifique", "description": "Récupère toutes les dettes archivées pour un client identifié par son ID.", "tags": ["Dettes Archivées"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer", "example": 89 }, "description": "ID du client pour lequel les dettes archivées doivent être récupérées." } ], "responses": { "200": { "description": "Dettes archivées trouvées avec succès.", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/DetteArchive" } } } } }, "404": { "description": "Aucune dette archivées trouvée pour ce client." } } } }, "/api/v1/dettes/archive": { "get": { "summary": "Récupérer toutes les dettes archivées", "description": "Récupère toutes les dettes archivées.", "tags": ["Dettes Archivées"], "responses": { "200": { "description": "Dettes archivées trouvées avec succès.", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Dettes" } } } } } } } }, "/api/v1/archive/dettes/{id}": { "get": { "summary": "Récupérer une dette archivée par ID", "description": "Récupère une dette archivée spécifique en fonction de son ID.", "tags": ["Dettes Archivées"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer", "example": 1 }, "description": "ID de la dette archivées à récupérer." } ], "responses": { "200": { "description": "Dette archivée trouvée avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Dettes" } } } }, "404": { "description": "Dette archivée non trouvée pour cet ID." } } } }, "/api/v1/notification/client/{id}": { "get": { "summary": "Notifie un seul client", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "integer" }, "description": "ID du client à notifier" } ], "responses": { "200": { "description": "Notification envoyée au client", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "example": "Notification envoyée au client." } } } } } }, "404": { "description": "Client non trouvé" }, "401": { "description": "Non autorisé" } } } }, "/api/v1/notification/client/all": { "post": { "summary": "Envoie une notification à un groupe de clients", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "client_ids": { "type": "array", "items": { "type": "integer" }, "example": [1, 2, 3] } } } } } }, "responses": { "200": { "description": "Notifications envoyées avec succès", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "example": "Notifications envoyées avec succès au groupe." } } } } } }, "400": { "description": "Données invalides" } } } }, "/api/v1/notification/client/message": { "post": { "summary": "Envoie un message personnalisé à un groupe de clients", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "client_ids": { "type": "array", "items": { "type": "integer" }, "example": [1, 2, 3] }, "message": { "type": "string", "example": "Bonjour, Pensez a regulariser vos dettes" } } } } } }, "responses": { "200": { "description": "Messages envoyés avec succès", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "example": "Notifications envoyées avec succès au groupe." } } } } } }, "400": { "description": "Données invalides" } } } }, "/api/v1/notification/unread": { "get": { "summary": "Récupère les notifications non lues du client authentifié", "responses": { "200": { "description": "Notifications non lues récupérées avec succès", "content": { "application/json": { "schema": { "type": "object", "properties": { "statut": { "type": "string", "example": "Success" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/Notification" }, "example": [ "Liste des notifications non lues"] }, "message": { "type": "string", "example": "Notifications non lues du client récupérées avec succès." } } } } } }, "401": { "description": "Client non authentifié" }, "404": { "description": "Client non trouvé ou aucune notification non lue" } } } }, "/api/v1/notification/read": { "get": { "summary": "Récupère les notifications lues du client authentifié", "responses": { "200": { "description": "Notifications lues récupérées avec succès", "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "example": "Success" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/Notification" }, "example": [ "Liste des notifications lues"] }, "message": { "type": "string", "example": "Notifications lues récupérées avec succès." } } } } } }, "401": { "description": "Client non authentifié" }, "404": { "description": "Client non trouvé" } } } }, "/api/v1/demandes/notifications": { "get": { "summary": "Récupère les notifications du boutiquier", "responses": { "200": { "description": "Notifications récupérées avec succès", "content": { "application/json": { "schema": { "type": "object", "properties": { "notifications": { "type": "array", "items": { "$ref": "#/components/schemas/Notification" }, "example": [ "Liste des notifications pour le boutiquier"] } } } } } }, "401": { "description": "Utilisateur non authentifié" }, "403": { "description": "Accès non autorisé" } } } }, "/api/v1/demandes": { "post": { "summary": "Crée une nouvelle demande de dette", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "montant": { "type": "number", "format": "float", "example": 3000.0 }, "articles": { "type": "array", "items": { "type": "object", "properties": { "article_id": { "type": "integer", "example": 1 }, "qteVente": { "type": "integer", "example": 2 }, "prixVente": { "type": "number", "format": "float", "example": 100.0 } }, "required": ["article_id", "qteVente", "prixVente"] } } }, "required": ["montant", "articles"] } } } }, "responses": { "201": { "description": "Demande de dette créée avec succès", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "example": "Demande de dette enregistrée avec succès" }, "demande": { "$ref": "#/components/schemas/Demande" } } } } } }, "401": { "description": "Non authentifié", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "example": "Vous devez vous connecter pour effectuer cette action" } } } } } }, "403": { "description": "Interdiction d'accès", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "example": "Vous ne pouvez pas soumettre cette demande" } } } } } }, "400": { "description": "Requête invalide", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "Les clients Bronze ne peuvent pas avoir de dettes." } } } } } } } }, "get": { "summary": "Récupère les demandes du client authentifié", "parameters": [ { "in": "query", "name": "etat", "schema": { "type": "string", "enum": ["en attente", "annulee"], "example": "en attente" }, "description": "Filtre les demandes par état" } ], "responses": { "200": { "description": "Demandes récupérées avec succès", "content": { "application/json": { "schema": { "type": "object", "properties": { "demandes": { "type": "array", "items": { "$ref": "#/components/schemas/Demande" }, "example": [] } } } } } }, "401": { "description": "Non authentifié", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "example": "Vous devez vous connecter pour effectuer cette action" } } } } } }, "400": { "description": "État invalide", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string", "example": "État invalide" } } } } } } } } }, "/api/v1/demandes/{id}/relance": { "post": { "summary": "Relance une demande annulée", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "integer" }, "description": "ID de la demande à relancer" } ], "responses": { "200": { "description": "Relance planifiée avec succès", "content": { "application/json": { "schema": { "type": "object", "properties": { "message": { "type": "string", "example": "La relance sera envoyée dans 2 jours" } } } } } }, "400": { "description": "La demande doit être annulée pour envoyer une relance" }, "404": { "description": "Demande non trouvée" } } } }, "/api/v1/login": { "post": { "summary": "Connexion utilisateur", "description": "Authentifie un utilisateur et retourne un token JWT.", "tags": ["Auth"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "login": { "type": "string", "example": "serigneBoutiquier@gmai.com" }, "password": { "type": "string", "example": "Serigne@123" } }, "required": ["email", "password"] } } } }, "responses": { "200": { "description": "Token JWT retourné avec succès.", "content": { "application/json": { "schema": { "type": "object", "properties": { "access_token": { "type": "string" }, "token_type": { "type": "string", "example": "bearer" }, "expires_in": { "type": "integer", "example": 3600 } } } } } }, "401": { "description": "Identifiants incorrects" } } } }, "/api/v1/token/refresh": { "post": { "summary": "Rafraîchir le token JWT", "description": "Rafraîchit un token JWT expiré.", "tags": ["Auth"], "responses": { "200": { "description": "Token JWT rafraîchi avec succès.", "content": { "application/json": { "schema": { "type": "object", "properties": { "access_token": { "type": "string" }, "token_type": { "type": "string", "example": "bearer" }, "expires_in": { "type": "integer", "example": 3600 } } } } } }, "401": { "description": "Token non valide ou expiré" } } } }, "/api/v1/register": { "post": { "summary": "Inscription d'un nouvel utilisateur", "description": "Crée un nouvel utilisateur et retourne un token JWT.", "tags": ["Auth"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "nom": { "type": "string", "example": "John" }, "prenom": { "type": "string", "example": "Doe" }, "photo": { "type": "string", "example": "John Doe" }, "login": { "type": "string", "example": "john@example.com" }, "password": { "type": "string", "example": "password123" }, "password_confirmation": { "type": "string", "example": "password123" }, "role_id": { "type": "integer", "example": 3 } }, "required": ["name", "email", "password", "password_confirmation"] } } } }, "responses": { "201": { "description": "Utilisateur créé avec succès.", "content": { "application/json": { "schema": { "type": "object", "properties": { "access_token": { "type": "string" }, "token_type": { "type": "string", "example": "bearer" }, "expires_in": { "type": "integer", "example": 3600 } } } } } }, "400": { "description": "Erreur de validation" } } } }, "/api/v1/logout": { "post": { "summary": "Déconnexion de l'utilisateur", "description": "Déconnecte l'utilisateur en invalidant le token JWT.", "tags": ["Auth"], "responses": { "204": { "description": "Utilisateur déconnecté avec succès." } } } }, "/api/v1/articles": { "get": { "summary": "Liste des articles", "description": "Récupère la liste de tous les articles.", "tags": ["Articles"], "responses": { "200": { "description": "Liste des articles récupérée avec succès.", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Article" } } } } } } }, "post": { "summary": "Créer un article", "description": "Crée un nouvel article.", "tags": ["Articles"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Article" } } } }, "responses": { "201": { "description": "Article créé avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Article" } } } }, "400": { "description": "Erreur de validation" } } } }, "/api/v1/articles/{id}": { "get": { "summary": "Afficher un article", "description": "Récupère les détails d'un article spécifique.", "tags": ["Articles"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "ID de l'article" } ], "responses": { "200": { "description": "Détails de l'article récupérés avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Article" } } } }, "404": { "description": "Article non trouvé" } } }, "patch": { "summary": "Mettre à jour un article", "description": "Met à jour un article existant.", "tags": ["Articles"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "ID de l'article" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Article" } } } }, "responses": { "200": { "description": "Article mis à jour avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Article" } } } }, "404": { "description": "Article non trouvé" } } }, "delete": { "summary": "Supprimer un article", "description": "Supprime un article existant.", "tags": ["Articles"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "ID de l'article" } ], "responses": { "204": { "description": "Article supprimé avec succès." }, "404": { "description": "Article non trouvé" } } } }, "/api/v1/articles/libelle": { "post": { "summary": "Rechercher un article par libellé", "description": "Récupère un article en fonction de son libellé.", "tags": ["Articles"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "libelle": { "type": "string", "example": "nom_article" } }, "required": ["libelle"] } } } }, "responses": { "200": { "description": "Article trouvé avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Article" } } } }, "404": { "description": "Article non trouvé" } } } }, "/api/v1/articles/stock": { "post": { "summary": "Mettre à jour le stock des articles", "description": "Met à jour le stock de plusieurs articles.", "tags": ["Articles"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "quantite": { "type": "integer", "example": 100 } }, "required": ["id", "quantite"] } } } } }, "responses": { "200": { "description": "Stocks mis à jour avec succès.", "content": { "application/json": { "schema": { "type": "object", "properties": { "updatedArticles": { "type": "array", "items": { "$ref": "#/components/schemas/Article" } }, "notFoundArticles": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "example": 2 }, "quantite": { "type": "integer", "example": 50 } } } } } } } } }, "404": { "description": "Aucun article mis à jour, tous les articles spécifiés n'ont pas été trouvés." }, "400": { "description": "Requête mal formulée. Les données doivent être un tableau d'articles avec un 'id' et 'quantite'." } } } }, "/api/v1/articles/{id}/stock": { "patch": { "summary": "Mettre à jour le stock d'un article par ID", "description": "Met à jour le stock d'un article spécifique par son ID.", "tags": ["Articles"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "ID de l'article" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "quantity": { "type": "integer", "example": 100 } }, "required": ["quantite"] } } } }, "responses": { "200": { "description": "Stock mis à jour avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Article" } } } }, "404": { "description": "Article non trouvé" } } } }, "/api/v1/client": { "post": { "summary": "Créer un nouveau client avec un utilisateur associé", "description": "Crée un nouveau client et, facultativement, un compte utilisateur associé.", "tags": ["Clients"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "surname": { "type": "string", "description": "Le nom du client", "example": "Doe" }, "telephone": { "type": "string", "description": "Le numéro de téléphone du client", "example": "123456789" }, "adresse": { "type": "string", "description": "L'adresse du client", "example": "123 Rue de Paris" }, "max_montant": { "type": "float", "description": "montant max", "example": 564.98 }, "categorie_id": { "type": "integer", "description": "categorie ", "example": "Silver" }, "user": { "type": "object", "description": "Informations sur l'utilisateur associé (facultatif)", "properties": { "nom": { "type": "string", "description": "Le nom de l'utilisateur", "example": "John" }, "prenom": { "type": "string", "description": "Le prénom de l'utilisateur", "example": "Doe" }, "login": { "type": "string", "description": "Le login de l'utilisateur", "example": "johndoe" }, "password": { "type": "string", "description": "Le mot de passe de l'utilisateur", "example": "password123" }, "role_id": { "type": "integer", "description": "L'ID du rôle attribué à l'utilisateur", "example": 2 }, "photo": { "type": "string", "format": "binary", "description": "Une image de profil de l'utilisateur (facultatif)" } }, "required": ["nom", "prenom", "login", "password", "role_id"] } }, "required": ["surname", "telephone", "adresse"] } } } }, "responses": { "201": { "description": "Client et utilisateur créés avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Client" } } } }, "400": { "description": "Erreur de validation." }, "404": { "description": "Rôle non trouvé." } } } }, "/api/v1/clients": { "get": { "summary": "Liste des clients", "description": "Récupère la liste de tous les clients.", "tags": ["Clients"], "responses": { "200": { "description": "Liste des clients récupérée avec succès.", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Client" } } } } } } }, "post": { "summary": "Créer un client", "description": "Crée un nouveau client.", "tags": ["Clients"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Client" } } } }, "responses": { "201": { "description": "Client créé avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Client" } } } }, "400": { "description": "Erreur de validation" } } } }, "/api/v1/clients/{id}": { "get": { "summary": "Afficher un client", "description": "Récupère les détails d'un client spécifique.", "tags": ["Clients"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "ID du client" } ], "responses": { "200": { "description": "Détails du client récupérés avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Client" } } } }, "404": { "description": "Client non trouvé" } } } }, "/api/v1/clients/{id}/add-user": { "patch": { "summary": "Ajouter un utilisateur à un client", "description": "Ajoute un utilisateur à un client spécifique.", "tags": ["Clients"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "ID du client" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "user_id": { "type": "integer", "example": 1 } }, "required": ["user_id"] } } } }, "responses": { "200": { "description": "Utilisateur ajouté avec succès au client.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Client" } } } }, "404": { "description": "Client ou utilisateur non trouvé" } } } }, "/api/v1/clients/telephone": { "post": { "summary": "Rechercher un client par téléphone", "description": "Récupère un client en fonction de son numéro de téléphone.", "tags": ["Clients"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "telephone": { "type": "string", "example": "+221771234567" } }, "required": ["telephone"] } } } }, "responses": { "200": { "description": "Client trouvé avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Client" } } } }, "404": { "description": "Client non trouvé" } } } }, "/api/v1/clients/{id}/dettes": { "post": { "summary": "Lister les dettes d'un client", "description": "Récupère la liste des dettes d'un client spécifique.", "tags": ["Clients"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "ID du client" } ], "responses": { "200": { "description": "Liste des dettes récupérée avec succès.", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Dettes" } } } } }, "404": { "description": "Client non trouvé" } } } }, "/api/v1/clients/{id}/user": { "post": { "summary": "Afficher un client avec utilisateur", "description": "Récupère les détails d'un client avec les informations de l'utilisateur.", "tags": ["Clients"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "ID du client" } ], "responses": { "200": { "description": "Détails du client avec utilisateur récupérés avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Client" } } } }, "404": { "description": "Client ou utilisateur non trouvé" } } } }, "/api/v1/users": { "get": { "summary": "Liste des utilisateurs", "description": "Récupère la liste de tous les utilisateurs.", "tags": ["Users"], "responses": { "200": { "description": "Liste des utilisateurs récupérée avec succès.", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/User" } } } } } } }, "post": { "summary": "Créer un utilisateur", "description": "Crée un nouvel utilisateur.", "tags": ["Users"], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "responses": { "201": { "description": "Utilisateur créé avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Erreur de validation" } } } }, "/api/v1/users/{id}": { "get": { "summary": "Afficher un utilisateur", "description": "Récupère les détails d'un utilisateur spécifique.", "tags": ["Users"], "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "ID de l'utilisateur" } ], "responses": { "200": { "description": "Détails de l'utilisateur récupérés avec succès.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "404": { "description": "Utilisateur non trouvé" } } } }, "/api/v1/route-protegee": { "get": { "summary": "Route protégée", "description": "Route d'exemple protégée par l'authentification.", "tags": ["Protected"], "responses": { "200": { "description": "Accès à la route protégée réussi.", "content": { "application/json": { "schema": { "type": "string", "example": "Bienvenue sur la route protégée !" } } } }, "401": { "description": "Accès non autorisé" } } } }, "/api/v1/demandes/all": { "get": { "summary": "Récupère toutes les demandes, avec option de filtrage par statut", "parameters": [ { "in": "query", "name": "status", "schema": { "type": "string", "enum": ["en attente", "annulee"] }, "description": "Filtre les demandes par statut" } ], "responses": { "200": { "description": "Demandes récupérées avec succès", "content": { "application/json": { "schema": { "type": "object", "properties": { "demandes": { "type": "array", "items": { "$ref": "#/components/schemas/Demande" }, "example": ["Liste des demandes"] } } } } } }, "400": { "description": "Statut invalide" } } } } }, "components": { "schemas": { "Demande": { "type": "object", "properties": { "id": { "type": "integer" }, "status": { "type": "string" }, "montant": { "type": "number", "format": "float" }, "client_id": { "type": "integer" }, "details": { "type": "string" }, "articles": { "type": "string" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } } }, "Article": { "type": "object", "properties": { "id": { "type": "integer" }, "libelle": { "type": "string" }, "reference": { "type": "string" }, "prix": { "type": "number", "format": "float" }, "quantite": { "type": "integer" } } }, "Client": { "type": "object", "properties": { "id": { "type": "integer" }, "surname": { "type": "string" }, "telephone": { "type": "string" }, "adresse": { "type": "string" }, "categorie_id": { "type": "number", "format": "integer" }, "max_montant": { "type": "number", "format": "float" } } }, "Dettes": { "type": "object", "properties": { "id": { "type": "integer" }, "client_id": { "type": "integer" }, "date_echeance": { "type": "string" }, "montantTotal": { "type": "number", "format": "float" }, "montantRestant": { "type": "number", "format": "float" } } }, "User": { "type": "object", "properties": { "id": { "type": "integer" }, "nom": { "type": "string" }, "prenom": { "type": "string" }, "login": { "type": "string", "format": "email" }, "password": { "type": "string" }, "password_confirmation": { "type": "string" }, "photo": { "type": "image" }, "role_id": { "type": "integer" } } }, "Paiement": { "type": "object", "properties": { "id": { "type": "integer" }, "dette_id": { "type": "integer" }, "montant": { "type": "number", "format": "float" } } }, "Notification": { "type": "object", "properties": { "id": { "type": "integer" }, "message": { "type": "string" }, "read_at": { "type": "string", "format": "date-time" }, "created_at": { "type": "string", "format": "date-time" }, "updated_at": { "type": "string", "format": "date-time" } } }, "DetteArchive": { "type": "object", "properties": { "id": { "type": "integer", "example": 89 }, "montantRestant": { "type": "string", "example": "0.00" }, "montantTotal": { "type": "string", "example": "40000.00" }, "montantVerse": { "type": "string", "example": "40000.00" }, "articles": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "example": 1 }, "libelle": { "type": "string", "example": "Lait" }, "prix": { "type": "string", "example": "564.89" }, "quantite": { "type": "integer", "example": 20 }, "reference": { "type": "string", "example": "REF22" }, "pivot": { "type": "object", "properties": { "article_id": { "type": "integer", "example": 1 }, "dette_id": { "type": "integer", "example": 89 }, "prixVente": { "type": "string", "example": "200.00" }, "qteVente": { "type": "integer", "example": 10 } }, "required": [ "article_id", "dette_id", "prixVente", "qteVente" ] } }, "required": [ "id", "libelle", "prix", "quantite", "reference", "pivot" ] } }, "client": { "type": "object", "properties": { "id": { "type": "integer", "example": 256 }, "adresse": { "type": "string", "example": "parcelle" }, "categorie_id": { "type": "integer", "example": 2 }, "max_montant": { "type": "string", "example": "30000.00" }, "qr_code": { "type": "string", "example": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjQwMCIgaGVpZ2h0PSI0MDAiIHZpZXdCb3g9IjAgMCA0MDAgNDAwIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iNDAwIiBoZWlnaHQ9IjQwMCIgZmlsbD0iI2ZlZmVmZSIvPjxnIHRyYW5zZm9ybT0ic2NhbGUoMTMuNzkzKSI+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNC4wMDAsNC4wMDApIj48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMCAwTDEwIDFMOCAxTDggMkwxMCAyTDEwIDNMOCAzTDggNEw5IDRMOSA1TDggNUw4IDdMOSA3TDkgOEw2IDhMNiA5TDcgOUw3IDEwTDYgMTBMNiAxMUw1IDExTDUgOEwwIDhMMCAxMkwyIDEyTDIgMTNMMyAxM0wzIDExTDUgMTFMNSAxM0w3IDEzTDcgMTJMOCAxMkw4IDE1TDkgMTVMOSAxMkw4IDEyTDggMTFMOSAxMUw5IDEwTDEwIDEwTDEwIDlMOSA5TDkgOEwxMCA4TDEwIDdMMTEgN0wxMSA2TDEwIDZMMTAgN0w5IDdMOSA1TDEwIDVMMTAgM0wxMSAzTDExIDBaTTEyIDBMMTIgNEwxMSA0TDExIDVMMTIgNUwxMiA4TDExIDhMMTEgMTBMMTIgMTBMMTIgMTJMMTMgMTJMMTMgMTRMMTIgMTRMMTIgMTNMMTEgMTNMMTEgMTFMMTAgMTFMMTAgMTNMMTEgMTNMMTEgMTRMMTIgMTRMMTIgMTVMMTEgMTVMMTEgMThMMTIgMThMMTIgMTlMOSAxOUw5IDE4TDEwIDE4TDEwIDE2TDggMTZMOCAyMUwxMSAyMUwxMSAyMEwxMyAyMEwxMyAyMUwxNSAyMUwxNSAyMEwxMyAyMEwxMyAxOUwxNiAxOUwxNiAyMEwxOSAyMEwxOSAyMUwyMCAyMUwyMCAyMEwxOSAyMEwxOSAxOUwxNiAxOUwxNiAxOEwxOCAxOEwxOCAxN0wxNiAxN0wxNiAxNEwxNyAxNEwxNyAxNkwxOSAxNkwxOSAxN0wyMSAxN0wyMSAxNUwyMCAxNUwyMCAxNEwyMSAxNEwyMSAxM0wyMCAxM0wyMCAxMkwyMSAxMkwyMSAxMUwyMCAxMUwyMCAxMEwyMSAxMEwyMSA5TDIwIDlMMjAgOEwxOSA4TDE5IDlMMjAgOUwyMCAxMEwxOSAxMEwxOSAxMUwxNiAxMUwxNiAxMEwxOCAxMEwxOCA4TDE3IDhMMTcgOUwxNiA5TDE2IDhMMTUgOEwxNSA5TDE2IDlMMTYgMTBMMTQgMTBMMTQgOEwxMyA4TDEzIDVMMTIgNUwxMiA0TDEzIDRMMTMgMFpNOCA5TDggMTBMNyAxMEw3IDExTDYgMTFMNiAxMkw3IDEyTDcgMTFMOCAxMUw4IDEwTDkgMTBMOSA5Wk0xMiA5TDEyIDEwTDEzIDEwTDEzIDlaTTIgMTBMMiAxMUwzIDExTDMgMTBaTTEzIDExTDEzIDEyTDE1IDEyTDE1IDEzTDE0IDEzTDE0IDE0TDEzIDE0TDEzIDE2TDE1IDE2TDE1IDE1TDE0IDE1TDE0IDE0TDE2IDE0TDE2IDEzTDE3IDEzTDE3IDE0TDIwIDE0TDIwIDEzTDE5IDEzTDE5IDEyTDE2IDEyTDE2IDExWk0xMiAxN0wxMiAxOEwxMyAxOEwxMyAxN1pNMTQgMTdMMTQgMThMMTUgMThMMTUgMTdaTTAgMEwwIDdMNyA3TDcgMFpNMSAxTDEgNkw2IDZMNiAxWk0yIDJMMiA1TDUgNUw1IDJaTTIxIDBMMTQgMEwxNCA3TDIxIDdaTTIwIDFMMTUgMUwxNSA2TDIwIDZaTTE5IDJMMTYgMkwxNiA1TDE5IDVaTTAgMjFMNyAyMUw3IDE0TDAgMTRaTTEgMjBMNiAyMEw2IDE1TDEgMTVaTTIgMTlMNSAxOUw1IDE2TDIgMTZaIiBmaWxsPSIjMDAwMDAwIi8+PC9nPjwvZz48L3N2Zz4K" }, "required": [ "id", "adresse", "categorie_id", "max_montant", "qr_code" ] } }, "paiements": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "integer", "example": 8 }, "montant": { "type": "string", "example": "40000.00" } }, "required": [ "id", "montant" ] } }, "archived_at": { "type": "string", "format": "date-time", "example": "2024-09-17T09:33:28.800542Z" } }, "required": [ "id", "montantRestant", "montantTotal", "montantVerse", "articles", "client", "paiements", "archived_at" ] } }, "securitySchemes": { "BearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } } }, "security": [ { "BearerAuth": [] } ] }