ita-social-projects / Home

Home - is an all-in-one social service that will cover all aspects of your communication with your home and neighbors.
http://www.home-project-engineering.tech/api/0/apidocs/index.html
MIT License
26 stars 30 forks source link

Refactor apartment and user registration workflow #478

Open vladyslavyarets opened 2 years ago

vladyslavyarets commented 2 years ago

Apartment

Description:

For correct process of cooperation workflow there required for all apartments in the cooperation should be filled. Every apartment should have all ownerships filled. So, for correct apartment registration required following payload:

{
  "number": "15",
  "area": 75.28,
  "ownerships": [
    {
      "type": "person",
      "first_name": "Ivan",
      "last_name": "Ivanov",
      "middle_name": "Ivanovich",
      "ovnership_part": 0.3
    },
    {
      "type": "legal_entity"
      "name": "Company Inc.",
      "edrpou": "12345678",
      "ovnership_part": 0.7
    }
  ]
}

New field ownerships(array) required. There 2 types of ownership can exist. person - is a physical user or non-legal-entity user, human. legal_entity - in this case owner can be a not physical person but legal entity. Due to this there different required fields in every case:

Required field for every ownership:

Tasks:

  1. Change OpenApi specification due to requirements described above.

  2. Change Service workflow. Now users should be created in the Database during apartment creation by information contains in ownership part. This new user should be created as disabled and contains following information: first name, middle, name, last name if this is person registered or name and edrpou if this owner is legal_entity.

  3. Rewrite api tests due to new logic


User

Description

Every user in our application should be an owner of some apartment. Once apartment created it should already have a list of ownerships (see ticket #478). Important user information as full name should be filled by cooperation admin during apartment creation. In this way during registration process user should not change it. There 2 types of owners can be created. Person and New workflow depends with other steps:

If user is a person:

If user is a legal_state:

Tasks:

  1. Rewrite OpenApi specification due to new model. Example of required payload present below:

For person:

{
  "user_id": 4
  "registration_token": "7b3a32f0-1326-11ed-b2e2-b51ca8f90a82",
  "email": "test@gmail.com",
  "password": "Passw0rd",
  "phone_number": 380501112233
}

For legal_state user:

{
  "user_id": 4
  "registration_token": "7b3a32f0-1326-11ed-b2e2-b51ca8f90a82",
  "email": "test@gmail.com",
  "password": "Passw0rd",
  "phone_number": 380501112233
}
  1. Rewrite service layer due to new logic.

  2. Optimize user' contact information storage in the database

  3. Rewrite api tests due to new logic


Versioning workflow

  1. Create feature/Issue#478... from dev

  2. Create feature/Issue#482... from branch #478

3.1. Create feature/Issue#480... from branch #482 and implement task. Merge into #482 branch

3.2. Create feature/Issue#481... from branch #482 and implement task. Merge into #482 branch

  1. Close Issue #482 and merge it in branch #478

5.1. Create new branch from #478 for implementing new service logic for user and apartment registration and merge it back

5.2. Create new branch from #478 and cover all new logic with api tests and change tests already created and merge it back

  1. Test all functionality manually and merge branch #478 into dev