Skip to content

ThomasBerranger/Glouton-API

Repository files navigation

Glouton

Glouton API

Tech Highlights

Mise en place d'une intégration et d'un déploiement continu via les actions GitHub.

Intégration d'un système d'authentification via le AccessTokenHandler de Symfony et une gestion des Tokens.

Implémentation d'un héritage entre l'entité mère Product et les entités filles ScannedProduct et CustomProduct.

Conception de tests unitaires et fonctionnels avec PHPUnit. Création de fixtures ordonnées et liées via références pour les tests et utilisation du package Faker.

Attribution de rôles aux utilisateurs et vérification des droits via des Voters.

Utilisation des groupes de serialisation et validation sur les propriétés des modèles.

Liaisons des entités via les types OneToOne, ManyToOne et ManyToMany avec la persistence de données configurée et la suppression d'éléments orphelins.

Mise en place de Listeners Doctrine sur la création d'objets

  • Prochainement

Utilisation de Messenger pour l'envoi de mail

Tech Stack

Programming Language: PHP 8.2

Framework: Symfony 7.1

Server: PHP Built-in Server, Heroku

Database: Mysql 8.0.33

Testing: PHPUnit 9.5

Deployment Tools: GitHub Actions

Code Quality Tools: PHPStan, PHP CS Fixer

Roadmap

Création du projet
  • CrĂ©ation du projet Symfony 7.1
  • DĂ©ploiement sur GitHub
  • IntĂ©grer PHPUnit
  • IntĂ©grer PHPStan
  • IntĂ©grer PHP CS Fixer
Configuration du repository GitHub
  • Premier commit du projet
  • RĂ©daction d’une première doc
  • RĂ©daction de la roadmap
  • CrĂ©ation d’une CI/CD GitHub
User
  • CrĂ©ation du modèle User
  • ImplĂ©mentation de l’authentification
Product
  • CrĂ©ation du modèle Product parent
  • CrĂ©ation des modèles enfant
  • Get endpoint
  • Post endpoint
  • Patch endpoint
  • Delete endpoint
RĂ©daction des premiers tests unitaires et fonctionnels
  • RĂ©daction des tests d'authentification
  • RĂ©daction de Fixtures liĂ©es par rĂ©fĂ©rence
  • RĂ©daction des tests d'accès sur les endpoints de Product
  • RĂ©daction des tests de serialization sur Product
  • RĂ©daction des tests de validation sur Product
Recipe
  • CrĂ©ation du modèle Recipe
  • CrĂ©ation des endpoints
  • RĂ©daction des tests
  • CrĂ©ation d'un endpoint pour obtenir la liste de course
Deploiement
  • DĂ©ploiement du projet sur Heroku
  • Listener sur l'ajout de produit pour y lier le current user

API Reference

Register

  POST /register
Parameter Type Required Description
email string true Your email
password string true Your password
{
  "email": "[email protected]",
  "password": "your_password"
}

Create Scanned Product

  POST /scanned-products
{
  "name": "Product name",
  "barcode": "123",
  "nutriscore": "a",
  "novagroup": 2,
  "ecoscore": "b",
  "description": "Product description",
  "image": "https://product-image-url",
  "finishedAt": "01/01/2025 15:16:17",
  "addedToListAt": "02/01/2025",
  "expirationDates": [
    {
      "date": "01/01/2025"
    },
    {
      "date": "01/01/2025"
    }
  ]
}
Parameter Required Type Description
name true string Product name
barcode true string Product barcode scanned
nutriscore false string Product nutriscore
novagroup false integer Product NOVA group
ecoscore false string Product ecoscore
description false string Product description
image false string Url to product online image
finished_at false datetime Product consumption date
added_to_list_at false datetime Product addition date to the list
expirationDates false array Product related expiration dates

Create Custom Product

  POST /custom-products
{
  "name": "Product name",
  "description": "Product description",
  "image": "https://product-image-url",
  "finished_at": "2024-10-15 15:16:17",
  "added_to_list_at": "2024-10-14 15:16:17",
  "expirationDates": [
    {
      "date": "01/01/2025"
    }
  ]
}
Parameter Required Type Description
name true string Product name
description false string Product description
image false string Url to product online image
finished_at false datetime Product consumption date
added_to_list_at false datetime Product addition date to the list
expirationDates false array Product related expiration dates

Show Product list

  GET /products

Show Product

  GET /products/${id}
Parameter Type Required Description
id string true Id of item to fetch

Update Scanned Product

  PATCH /scanned-products
{
  "name": "New product name",
  "description": "New product description",
  "image": "https://new-product-image-url",
  "finishedAt": "01/01/2025 15:16:17",
  "addedToListAt": "02/01/2025",
  "barcode": "123",
  "nutriscore": "A",
  "novagroup": 2,
  "ecoscore": 3,
  "expirationDates": []
}
Parameter Required Type Description
name true string Product name
barcode true string Product barcode scanned
nutriscore false string Product nutriscore
novagroup false integer Product NOVA group
ecoscore false string Product ecoscore
description false string Product description
image false string Url to product online image
finished_at false datetime Product consumption date
added_to_list_at false datetime Product addition date to the list
expirationDates false array Product related expiration dates

Update Custom Product

  PATCH /custom-products
{
  "name": "New product name",
  "description": "New product description",
  "image": "https://new-product-image-url",
  "finished_at": "2024-10-15 15:16:17",
  "added_to_list_at": "2024-10-14 15:16:17",
  "expirationDates": [
    {
      "date": "01/01/2025"
    }
  ]
}
Parameter Required Type Description
name true string Product name
description false string Product description
image false string Url to product online image
finished_at false datetime Product consumption date
added_to_list_at false datetime Product addition date to the list
expirationDates false array Product related expiration dates

Delete Product

  DELETE /products/${id}
Parameter Type Required Description
id string true Id of item to delete

About

Symfony API designed for Glouton web app 🤖

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages