Open vikasagarwal opened 9 years ago
Change the business schema to include an array of contacts. Contact's schema would include four fields: title, phone, email, primary Only one of the contacts in the entire array of contacts for a particular business can be primary. Need to add a validation for this. At the time a user creates a business, his email address would be duplicated, i.e. his contact would be stored in his own document in the users collection. Also, his contact would be stored within the business' collection as one of the contacts there. In this contact, the primary flag will be set. In case the user creates more contacts for the business and selects one of those as the primary one, the primary flag will be removed from the user's contact who created it and will be set on the primary contact then selected.
Agreed..!! Suggestion - @vikasagarwal there can be these above four diff contact types. however option to be there to add another type of contact. And then get saved for that user or business.. As types of contacts can be indefinite and vary from business to business.
Same goes for the contacts four fields.. Option to add more fields to be there and auto saved for that user..
@amit-k86, there is no limitation on the number and types of contacts one can add. However, I'm only allowing the fields above mentioned. I can't think of a reason why we want additional fields in a contact.
This has been completed. Would @naveen1601 or @priyankshukla mind reviewing the code? I would like to see your comments on the code, clean code being a priority.
@amit-k86 , please QA this as well. I have moved it into the staging branch.
As a user creating a business, he/she should be able to enter multiple email addresses as various types of contacts a business typically has. For example, for a company, ABC, there can be four different contacts: Sales Procurement General/Info Marketing
By default, the primary contact would be of the user who is creating the business but if there are multiple contacts available, the option to choose one of those as primary contacts should be present.