Skip to content

Instantly share code, notes, and snippets.

@rezaindrag
Created July 2, 2020 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rezaindrag/51ce6d43d760a69210340245c5322c1a to your computer and use it in GitHub Desktop.
Save rezaindrag/51ce6d43d760a69210340245c5322c1a to your computer and use it in GitHub Desktop.
const companyRepository = require("../repositories/company.repository");
async function fetchCompanyProfile() {
const users = await companyRepository.fetchUsers();
const employees = await companyRepository.fetchEmployees();
const companyUsers = [];
for (let user of users) {
companyUsers.push({
id: user.id,
name: user.login,
});
}
const companyEmployees = [];
for (let employee of employees) {
companyEmployees.push({
id: parseInt(employee.id),
name: employee.employee_name,
});
}
return {
companyName: "Facebook Inc",
companyUsers,
companyEmployees,
};
}
module.exports = {
fetchCompanyProfile,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment