Last active
August 29, 2015 14:15
-
-
Save tkellen/246058f6d999de7b06c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const _ = require('lodash'); | |
const depMap = require('./depmap'); | |
function depMapper (table) { | |
var deps = depMap[table].reverse(); | |
return _.uniq(_.chain(deps).reduce(function (result, dep) { | |
result.push(depMapper(dep)); | |
return result; | |
}, []).flatten().value().concat(deps)); | |
}; | |
var table = 'utilization'; | |
console.log(table+' needs '+depMapper(table)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"applicant_comment": [ | |
"applicant", | |
"employee" | |
], | |
"applicant_state": [], | |
"applicant": [ | |
"position", | |
"applicant_state" | |
], | |
"bill_method": [], | |
"bills": [ | |
"project", | |
"bill_method" | |
], | |
"board": [], | |
"deployment": [ | |
"service" | |
], | |
"employee": [ | |
"position" | |
], | |
"event_type": [ | |
"event_event_type" | |
], | |
"event": [], | |
"hr_task_group": [], | |
"hr_task_type": [], | |
"hr_task": [ | |
"hr_task_type", | |
"hr_task_group" | |
], | |
"leave_request_activity": [ | |
"leave_request", | |
"leave_request_state" | |
], | |
"leave_request_state": [], | |
"leave_request": [ | |
"employee", | |
"utilization_type" | |
], | |
"organization": [], | |
"position": [], | |
"project_phase": [ | |
"project" | |
], | |
"project_phase_review": [ | |
"project_phase" | |
], | |
"project_sow_state": [], | |
"project_sow": [ | |
"project", | |
"project_sow_state" | |
], | |
"project_type": [], | |
"project": [ | |
"employee", | |
"organization", | |
"position", | |
"utilization_type" | |
], | |
"service": [ | |
"employee" | |
], | |
"sketch_calendar": [], | |
"team": [], | |
"utilization_type": [], | |
"utilization": [ | |
"utilization_type", | |
"employee", | |
"position", | |
"project_phase", | |
"sketch_calendar" | |
], | |
"venue": [] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment