(organizationId: string)
| 40 | // read-path healing. |
| 41 | |
| 42 | export const resolveOrganization = (organizationId: string) => |
| 43 | Effect.gen(function* () { |
| 44 | const users = yield* UserStoreService; |
| 45 | const existing = yield* users.use("getOrganization", (s) => s.getOrganization(organizationId)); |
| 46 | if (existing) return existing; |
| 47 | |
| 48 | const workos = yield* WorkOSClient; |
| 49 | const fresh = yield* workos.getOrganization(organizationId); |
| 50 | return yield* users.use("upsertOrganization", (s) => |
| 51 | s.upsertOrganization({ |
| 52 | id: fresh.id, |
| 53 | name: fresh.name, |
| 54 | updatedAt: new Date(fresh.updatedAt), |
| 55 | }), |
| 56 | ); |
| 57 | }); |
| 58 | |
| 59 | // --------------------------------------------------------------------------- |
| 60 | // Deletion mark — the local step that revokes an organization. |
no outgoing calls
no test coverage detected