Fixed getProjectForUsers
This commit is contained in:
parent
a5399c9335
commit
95b09a8ce7
1 changed files with 4 additions and 3 deletions
|
@ -64,9 +64,10 @@ const addWeeklyReport = `WITH UserLookup AS (SELECT id FROM users WHERE username
|
|||
const addUserToProject = "INSERT INTO user_roles (user_id, project_id, p_role) VALUES (?, ?, ?)" // WIP
|
||||
const changeUserRole = "UPDATE user_roles SET p_role = ? WHERE user_id = ? AND project_id = ?"
|
||||
|
||||
const getProjectsForUser = `SELECT projects.id, projects.name, projects.description, projects.owner_user_id
|
||||
FROM projects JOIN user_roles ON projects.id = user_roles.project_id
|
||||
JOIN users ON user_roles.user_id = users.id WHERE users.username = ?;`
|
||||
const getProjectsForUser = `SELECT p.id, p.name, p.description FROM projects p
|
||||
JOIN user_roles ur ON p.id = ur.project_id
|
||||
JOIN users u ON ur.user_id = u.id
|
||||
WHERE u.username = ?`
|
||||
|
||||
// DbConnect connects to the database
|
||||
func DbConnect(dbpath string) Database {
|
||||
|
|
Loading…
Reference in a new issue