OrderMail / blacklabel

MIT License
2 stars 3 forks source link

Business Registration and association with user. #16

Open vikasagarwal opened 9 years ago

vikasagarwal commented 9 years ago

Pending tasks from #7

Acceptance Criteria

When a user opens the business registration page:

  1. It should be checked that the user isn't already associated with a business. If he/she is, then disallow registration of a new business.
  2. It should be checked whether the user is logged in or not. if not, ask user to log in first. Upon completion of business registration, user should be redirected to the dashboard instead of showing the business registration form on the same page.
priyankshukla commented 9 years ago

@vikasagarwal @naveen1601 @amit-k86

Guys,

I need your feedback/suggestions on below:

Case- Business association with user object.

Options-

  1. No CRUD operation is required on User table after saving the business. i.e The business table must have information of all the users who are associated with that. Also, if a user refer another user for same business, the second person will also get added in this business (no business related information created in User table)
  2. After saving the business, we have to perform another CRUD operation on User table, and update the exiting user with newly created business-id in same transaction. i.e. User table must have information of businesses that who is associated with which business.

Additional, We have to save the user-id along with Business object all the time (to refer who has created this business). I am assuming we need to buy out this point at any case.

vikasagarwal commented 9 years ago

We should go ahead with option 2 (storing the business ids into the users collection) instead of other way round.

priyankshukla commented 9 years ago

Functionality implemented

Pending User table must have updated with business_id (which has recently created) in same transaction

Note- Code has committed so far on local branch- feature-businessassociationwithuser-16

priyankshukla commented 9 years ago

I merged the code on 'feature-businessregistration-7' branch today!

priyankshukla commented 9 years ago

I successfully updated the user table with newly generated business ID

Code has committed so far i local branch "feature-businessassociationwithuser-16"

I will merge this code to upper branch "feature-businessregistration-7" after doing code refactoring on next working day

priyankshukla commented 9 years ago

Request you all to reset the User module indexes in database.

I removed business_id & businessname indexes (uniqueness) from my local mongoose db.

priyankshukla commented 9 years ago

Business registration functionality has been completed!

It checks user logged-in and business association with user case (till now) before redirecting to business registration page.

priyankshukla commented 9 years ago

Following are the outstanding issues:

  1. It will restrict you to go to business registration page in case of any error(user loggedin check + business association with user check) but redirecting to home page (login page) functionality has been implemented, but its not working properly.
  2. While registering the user, a default business id gets saved (a bug it seems). I tested this story to remove the business id from back-end.
priyankshukla commented 9 years ago

@naveen1601 Please review

priyankshukla commented 9 years ago

I committed the code & merged with feature-businessregistration-7 branch

priyankshukla commented 9 years ago

17 has been raised as a bug

priyankshukla commented 9 years ago

@vikasagarwal Please review the code, I committed/merged the latest code on feature-businessregistration-7 branch.

vikasagarwal commented 9 years ago

@priyankshukla 1st acceptance criterion is being met but with imperfections. If a logged in user having business associated tries to open "localhost:3000/businessregistration", it shows "not found" on screen. This is functionally correct but the error message is wrong. Please fix.

Edit: See the next two comments
vikasagarwal commented 9 years ago

I tried testing but failed; I cannot get the business registration page to load. Here is what I did:

  1. Signed up as a new user without selecting an existing business
  2. Activated the user account
  3. Logged in as the selected user. This opened dashboard for me [undesirable]
  4. Opened "localhost:3000/businessregistration" on the browser because there is no direct link that allows me to reach the business registration page. This page didn't open, instead, showed "not found" on the screen.

Is there something amongst the steps above I should be doing differently? I'm assuming that this code is already committed and is available in the branch "feature-businessregistration7".

@priyankshukla, Please comment on priority. This is holding me from moving ahead. Thanks

vikasagarwal commented 9 years ago

Following the above comment: I tried again using, "localhost:3000/#!/businessregistration" and I was able to see the page. You can ignore the previous comment. Don't delete it though

@priyankshukla , @naveen1601. Please ensure that you write testing instructions VERY CLEARLY. This lack of clarity has cost me many hours. And, this is going to be really too difficult for @amit-k86 to test if a relatively technical person like me is having issues testing.

vikasagarwal commented 9 years ago

I dropped indexes and tested in the feature-businessregistration-7 branch. The business registration is not working. @priyankshukla Please recheck.

vikasagarwal commented 9 years ago

I logged in as a user that didn't have a business associated and I was able to open the businessregistration page. However, after filling in all the fields, when I clicked 'Register' I saw a 404 error on Post. Please look into this.

vikasagarwal commented 9 years ago

Then, I commented out the BusinessRegistrationCtrl, corresponding route, and the business-registration.html from the Users package, which resulted in:

I think all these errors are because the namespace conflict the co-existence of the duplicates of the business registration artifacts in the code base. Need to be checked thoroughly.

vikasagarwal commented 9 years ago

@priyankshukla I have cleaned up (commented out the incorrect code) and pushed into the feature-businessregistration-7 branch. Please pull that before you work on it further. These errors were actually because at some place it was using stuff from the Users package while at others, from the business package.

priyankshukla commented 9 years ago

Who is doing QA for this issue? Shall I close this if it's qa passed?