(ctx context.Context, name, userID string)
| 422 | } |
| 423 | |
| 424 | func (c *connection) FindProjectsByNameAndUser(ctx context.Context, name, userID string) ([]*database.Project, error) { |
| 425 | var res []*projectDTO |
| 426 | err := c.getDB(ctx).SelectContext(ctx, &res, ` |
| 427 | SELECT * FROM projects |
| 428 | WHERE id IN ( |
| 429 | SELECT upr.project_id FROM users_projects_roles upr WHERE upr.user_id = $1 |
| 430 | UNION |
| 431 | 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 |
| 432 | ) AND lower(name)=lower($2) |
| 433 | `, userID, name) |
| 434 | if err != nil { |
| 435 | return nil, parseErr("projects", err) |
| 436 | } |
| 437 | return c.projectsFromDTOs(res) |
| 438 | } |
| 439 | |
| 440 | func (c *connection) InsertProject(ctx context.Context, opts *database.InsertProjectOptions) (*database.Project, error) { |
| 441 | if err := database.Validate(opts); err != nil { |
nothing calls this directly
no test coverage detected