(ctx context.Context)
| 205 | } |
| 206 | |
| 207 | func (c *connection) FindInactiveOrganizations(ctx context.Context) ([]*database.Organization, error) { |
| 208 | // TODO: This definition may change, but for now, we are considering an organization as inactive if it has no users |
| 209 | res := []*database.Organization{} |
| 210 | err := c.getDB(ctx).SelectContext(ctx, &res, ` |
| 211 | SELECT o.* FROM orgs o |
| 212 | WHERE now() - o.updated_on > INTERVAL '1 DAY' |
| 213 | AND NOT EXISTS ( SELECT 1 FROM users_orgs_roles uor WHERE uor.org_id = o.id ) |
| 214 | `) |
| 215 | if err != nil { |
| 216 | return nil, parseErr("orgs", err) |
| 217 | } |
| 218 | return res, nil |
| 219 | } |
| 220 | |
| 221 | func (c *connection) FindProjects(ctx context.Context, afterID string, limit int) ([]*database.Project, error) { |
| 222 | var qry strings.Builder |
nothing calls this directly
no test coverage detected