(ctx context.Context, userID string)
| 288 | } |
| 289 | |
| 290 | func (c *connection) FindProjectsForUser(ctx context.Context, userID string) ([]*database.Project, error) { |
| 291 | var res []*projectDTO |
| 292 | err := c.getDB(ctx).SelectContext(ctx, &res, ` |
| 293 | SELECT * FROM projects |
| 294 | WHERE id IN ( |
| 295 | SELECT upr.project_id FROM users_projects_roles upr WHERE upr.user_id = $1 |
| 296 | UNION |
| 297 | SELECT ugpr.project_id FROM usergroups_projects_roles ugpr JOIN usergroups_users ugu ON ugpr.usergroup_id = ugu.usergroup_id WHERE ugu.user_id = $1 |
| 298 | ) |
| 299 | `, userID) |
| 300 | if err != nil { |
| 301 | return nil, parseErr("projects", err) |
| 302 | } |
| 303 | return c.projectsFromDTOs(res) |
| 304 | } |
| 305 | |
| 306 | // FindProjectsForUserAndFingerprint returns projects for the user based on fingerprint. |
| 307 | // The fingerprint is simply git_remote + subpath for git based projects. |
nothing calls this directly
no test coverage detected