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 configurée et la suppression d'éléments orphelins.

  • Prochainement

Mise en place de Listeners & Utilisation de Messenger

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
  • DĂ©ploiement du projet sur Heroku

  • CrĂ©ation d'un endpoint pour obtenir la liste de course

  • Listener sur l'ajout de produit pour y lier le current user

API Reference

Register

  POST /login
Parameter Type Required Description
email string true Your email
password string true Your password
{
  "email": "user@gmail.com",
  "password": "your_password"
}

Login

  POST /register
Parameter Type Required Description
username string true Your email
password string true Your password
{
  "username": "user@gmail.com",
  "password": "your_password"
}

Logout

  POST /logout

Create Scanned Product

  POST /scanned-products
{
  "name": "Product name",
  "description": "Product description",
  "image": "https://product-image-url",
  "finishedAt": "01/01/2025 15:16:17",
  "addedToListAt": "02/01/2025",
  "barcode": "123",
  "nutriscore": "A",
  "novagroup": 2,
  "ecoscore": 3,
  "expirationDates": [
    {
      "date": "01/01/2025"
    },
    {
      "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
barcode true string Product barcode scanned
nutriscore false string Product nutriscore
novagroup false integer Product novagroup
ecoscore false integer Product ecoscore
expirationDates false array Product 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 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 false 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
barcode false string Product barcode scanned
nutriscore false string Product nutriscore
novagroup false integer Product novagroup
ecoscore false integer Product ecoscore
expirationDates false array Product 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 false 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 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