Skip to content

Developer guidelines

Hoang Dang Khoa edited this page May 23, 2023 · 10 revisions
  • Keep it simple. Simplify things as much as you can. Only make them complex if it’s truly necessary.

    • In controllers, we can call repositories for simple operations like CRUD. For operations that have business logic, the code to handle that business logic should be separated on services.
    • We don't apply soft delete in the system, and not cascade delete (except for many-to-many tables). Whenever there is a database constraint exception, show a message to tell users that they need to delete all the children before delete the parent.
  • Keep the list of third-party libraries as small as possible.

  • Dead code or Zombie code should be removed

  • Run npx prettier -w . before commit frontend code

  • Entity definitions

    • Use primitives for non-nullable fields and wrapper objects for nullable fields
    • Override equals and hashCode
  • Git practices

    • Pull request should be small
    • Delete branch once pull request merged
    • Include #issueId in comment when commit code
    • Local development environment configuration should not be committed
  • Liquibase:

  • Do not update an already run changset. Any new database change should be placed in a new changeset
  • For DDL, put changeset under db\changelog\ddl
  • For data, put changeset under db\changelog\data
  • Notes for working with Search service and ElasticSearch
    • In application.properties of search module: change spring.kafka.consumer.bootstrap-servers=kafka:9092 to http://localhost:29092
    • In logback-spring.xml of search module: add <logger name="org.springframework.data.elasticsearch.client.WIRE" level="trace" /> to show query generated in console