(op: string, where: AdapterWhere)
| 124 | // member whose user row is gone is not reported — there is no principal |
| 125 | // behind it to name. |
| 126 | const load = (op: string, where: AdapterWhere) => |
| 127 | Effect.gen(function* () { |
| 128 | const rows = yield* memberRows(op, where); |
| 129 | const users = yield* userRows( |
| 130 | op, |
| 131 | rows.map((row) => row.userId), |
| 132 | ); |
| 133 | const members: DirectoryMember[] = []; |
| 134 | for (const row of rows) { |
| 135 | const user = users.get(row.userId); |
| 136 | if (user === undefined) continue; |
| 137 | members.push({ |
| 138 | accountId: row.userId, |
| 139 | membershipId: row.id, |
| 140 | organizationId: row.organizationId, |
| 141 | email: user.email, |
| 142 | name: user.name ?? null, |
| 143 | avatarUrl: user.image ?? null, |
| 144 | role: row.role, |
| 145 | status: "active", |
| 146 | lastActiveAt: null, |
| 147 | }); |
| 148 | } |
| 149 | return members; |
| 150 | }); |
| 151 | |
| 152 | const orgWhere = (organizationId: string): AdapterWhere => [ |
| 153 | { field: "organizationId", value: organizationId }, |
no test coverage detected