Created
July 2, 2020 09:31
-
-
Save rezaindrag/51ce6d43d760a69210340245c5322c1a 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 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