-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from fac-13/issue80
SQL query to get all members and basic information from db - Issue80
- Loading branch information
Showing
3 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const dbConnection = require('../database/db_connection.js'); | ||
|
||
const allMembersQuery = | ||
`SELECT mem.id, mem.github_id, mem.full_name, mem.github_handle, github_avatar_url, code.code AS fac_cohort, | ||
(SELECT array_agg(tech.tech ORDER BY stack.order_num) | ||
FROM tech_stack tech | ||
INNER JOIN member_tech_stack stack | ||
ON stack.stack_id = tech.id | ||
WHERE stack.member_id = mem.id | ||
) AS tech_stack, job_search_status | ||
FROM members mem | ||
INNER JOIN fac_code code | ||
ON mem.fac_code_id = code.id`; | ||
|
||
const getAllMemberData = () => | ||
dbConnection | ||
.query(allMembersQuery) | ||
.then(allMemberDetails => allMemberDetails); | ||
|
||
module.exports = getAllMemberData; | ||
|
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