Code Monkey home page Code Monkey logo

oc-p7-bilemo's People

Contributors

annaigjegourel avatar

Stargazers

 avatar

Watchers

 avatar

oc-p7-bilemo's Issues

Make API discoverable (Richardson Model level 3) 🎉

Install & Config Hateoas & JMS:

Capture d’écran 2023-03-30 à 17 02 11

  • Config jms

Update Controllers:

  • Use JMSSerializerInterface & not Sf serializer in PhoneController
  • Use JMSSerializerInterface & not Sf serializer in UserController
  • Add context in functions + use JMS context in UserController

Update Entities:

  • Use JMS\Serializer\Annotation\Groups instead of Symfony\Component\Serializer\Annotation\Groups in User Entity
  • Same in Customer Entity
  • Test in postman

Add links :

  • Add links & use Hateoas to entity Phone
  • Add links & use Hateoas to entity User

Add embedded? NO use here.

Create Documentation (with Nelmio)

  • Install Nelmio
  • Config Nelmio: path in config/routes & config/packages/security
  • Install Asset component & Twig extra bundle: composer require twig asset

Improvements:

  • Config Nelmio with JWT to test routes
  • Use Nelmio in PhoneController & comment methods to improve infos: specify page, element quantity
  • same in UserController
  • Write best messages & examples for UX

4️⃣ Add Cache system

Add cache in PhoneController::getAllPhones()

  • Use Sf cache component
  • Add cache id & tag in getAllPhones()
  • Add expire time

Add cache in UserController::getCustomerUsersList

  • Use Sf cache component
  • Add cache id & tag in getCustomerUsersList()
  • Lazy loading: Serialize inside cache function OR Add Fetch mode EAGER in UserRepository
  • Add refresh time

Add cache in other CRUD methods of UserController

  • Use cache->invalidateTags() in deleteUser(), createUser(), updateUser()

Code style

  • Improve code following Codacy

Create UML

  • Use case diagram
  • Sequence diagram
  • Class diagram

🔝 Improvements 🔝

Improvements:

  • Improve UML diagrams
  • Doc: improve @OA annotations & make them consistent
  • See also UserRepository: setpassword: Using wrong arguments / calling wrong class for upgradePassword()
    UserRepository::upgradePassword::$user->setPassword() unknown (use Entity/User instead of interface?)
  • Add customer condition to User CRUD: isGranted? checkCustomer()? voters?
    https://symfony.com/doc/current/security/voters.html

Review code style:

Lint code

Codacy

  • Set Codacy ignoring basic Sf files

PHPstan

  • Install PHPStan
  • Set & run PHPstan analysis
  • Test highest level
  • Fix issues (2 left)

CodeClimate

  • See also CodeClimate: maintainability B->A

Code

  • Fix issues & disable useless patterns to get better badges

Enhance Users CRUD

  • Create deleteUser()
  • Create createUser()
  • Update createUser() creating id automatically
  • Update createUser() creating customer (adding idCustomer)
  • Update createUser() hashing password
  • Create updateUser()

Create Users

  • install security bundle
  • create User
  • create entity Customer (relation to User)
  • update AppFixtures adding Customer, admin & users
  • create UserController
  • update UserController making getAllUsers($customer) using argument

Fix

  • fix circular reference adding group 'getUsers' to getAllUsers()
  • admin fixture: remove

Create first entity & database

  • Install Maker bundle
  • Install Doctrine ORM
  • Create Entity Phone
  • [local] Create database, config .env.local, migrate entity

Create Pagination for getAll...() functions

Phones pagination:

  • Create function findAllWithPagintation ($page, $limit) in PhoneRepository
  • Use findAllWithPagination() & request page & limit from url in PhoneController::getAllPhones
  • Test with Postman

Users pagination:

  • Create findByCustomerPagin($idCustomer, $page, $limit) in UserRepository
  • Use findByCustomerPagin() & request in UserController::getCustomerUsersList()
  • Test with Postman

Create product fixtures

  • Install Doctrine fixtures bundle
  • Add content in AppFixtures.php
  • Migrate to db
  • Create PR, link to issue & merge to main

Init Project

  • Create local & distant repositories
  • Add ReadMe
  • Add Codacy & CodeClimate badges
  • Add License
  • Create issues
  • Fix first issues following Codacy & VSCode

3️⃣ Debug & Fix UserController

Debug

  • Install Symfony debug bundle (including monolog & web profiler)
  • (add debug mode to ExceptionSubscriber) OR #[When: env=prod]

Fix routes / methods

  • Update POST (add conditions/ see pwd problem)
  • Fix PUT saving every element
  • Update PATCH (2 problems due to JMS serializer) & add Hateoas relation to entity... or delete this function?)

See also password problem:

  • PATCH PUT POST -> error 500 "undefined array key password"
  • Make it mandatory (like e-mail)

1️⃣ Improve code style

  • Choose "Response" or "JsonResponse"
  • Create Homepage
  • Comment all functions
  • Comment all variables
  • PHPStan: Comment & fix
  • Codacy: Enable comments patterns on Codacy & check
  • Codacy: Check & fix
  • PHPstan Entity/User.php::$roles type ??
    https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type
  • UserController::createUser() - > persist role (default: User) in db
  • CodeClimate: refactoring Repos??
  • Codacy: vérifier erreurs restantes & disabled patterns

Following Symfony best practices:
https://symfony.com/doc/current/best_practices.html
Symfony standards & PHP CS fixer:
https://symfony.com/doc/current/contributing/code/standards.html
See adr pattern (for apis)?

Create PhoneController

  • Create PhoneController & test /api/phones with Postman
  • Install Serializer
  • Update getAllPhones() with Serializer
  • Create getDetailsPhone()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.