Creates previous_employment_details table#481
Conversation
Current Code Coverage Percent of this PR:89.22 %Files having coverage below 100%
|
rohitjoshixyz
left a comment
There was a problem hiding this comment.
Check schema file, rest LGTM
apoorv-mishra
left a comment
There was a problem hiding this comment.
Could you resolve conflicts?
There was a problem hiding this comment.
@mohinid I've some concerns about this association. The think the previous company details should be directly associated with the User model. For a user, the previous employment should same for each company and it does not vary from company to company.
Eg: Consider, Currently a user belongs to 2 companies A and B. Same user has worked for 3 companies before. As per your flow, the user has 2 employment_details ( for company A and Company B) and each employee details have 3 same previous employees details.
@keshavbiswa @rohitjoshixyz @apoorv-mishra
|
@akhilgkrishnan Well, it makes sense that we associate the model to users since we are storing only |
Thanks, @rohitjoshixyz, @akhilgkrishnan I will change it. |
Agreed. Shouldn't the same be true for employee_details table? The user would have the same employee_details regardless of whichever company he is part of. I mean the user, should have employee_details and previous_employee_details directly or am I missing something? |
Hi @keshavbiswa Not really. Please check the fields of employment_details table in ERD. It has employee_id, designation etc which are specific to each company. |
|
So, if current_user has two |
Yes. because for that user the employment_details varies for both companies. |
|
@keshavbiswa @mohinid I think having a separate table is preferable, because the company_users table is bound to grow as we add more features to Miru instead of having 10 other columns which will be rarely fetched (mostly on the employee profile page) |
|
Updated reference from CompanyUser to User as discussed. |
keshavbiswa
left a comment
There was a problem hiding this comment.
Added few suggestions for missing tests, rest LGTM!
keshavbiswa
left a comment
There was a problem hiding this comment.
Thanks for making all the changes. Looks good to me!
Thanks a lot @keshavbiswa , @akhilgkrishnan & @rohitjoshixyz for your time!! :) |
* Creates previous_employment_details table * Remove invoice changes from schema.rb * Update reference from CompanyUser to User * Additional tests for model * Addedd dependent-destroy to User-PreviousEmploymentDetails association test Co-authored-by: Akhil G Krishnan <[email protected]>
Notion card
https://www.notion.so/saeloun/Add-tables-for-personal-employment-Allocated-devices-compensation-71ef49d0c38e4242bd2998120141372d
Summary
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Manually verified associations and validations on the Rails console.
Checklist:
Preview of ERD