History

feat(cloud): add team management page (#157)

* feat(cloud): add team management page with WorkOS org members Custom team page using WorkOS API for listing members, inviting, removing, and changing roles. Admin-gated write operations with server-side role checks. Uses Effect API layer pattern with typed endpoints and effect-atom for client-side state. Also fixes Sonner toaster to use system theme detection instead of next-themes, removes next-themes dependency. * style: format * chore: remove unused widget token endpoint and getWidgetToken * fix: remove any types from team handler tests * style: format * fix: add @types/node to storage-postgres for tsgo compat * fix: resolve merge conflict in test file * style: format * fix: resolve tsgo typecheck errors in billing and test files * fix: add explicit Plan types for tsgo compatibility * style: format * fix: cast empty array for tsgo type inference

Rhys Sullivan committed 7 months ago

Commit ec8d8861 parent 261c7b219 files · +1079 −16Browse files

Showing the changes to apps/cloud/src/auth (1 of 19 files). Show all

Unified · Split

apps/cloud/src/auth/workos.ts+39−1
@@ -138,10 +138,48 @@ const make = Effect.gen(function* () { · 137 unmodified lines
138 if (!sessionData) return null;138 if (!sessionData) return null;
139 return yield* authenticateSealedSession(sessionData);139 return yield* authenticateSealedSession(sessionData);
140 }),140 }),
141
142 /** List organization memberships with user details. */
143 listOrgMembers: (organizationId: string) =>
144 use((wos) =>
145 wos.userManagement.listOrganizationMemberships({
146 organizationId,
147 statuses: ["active", "pending"],
148 }),
149 ),
150
151 /** Get a user by ID. */
152 getUser: (userId: string) => use((wos) => wos.userManagement.getUser(userId)),
153
154 /** Send an organization invitation. */
155 sendInvitation: (params: { email: string; organizationId: string; roleSlug?: string }) =>
156 use((wos) =>
157 wos.userManagement.sendInvitation({
158 email: params.email,
159 organizationId: params.organizationId,
160 roleSlug: params.roleSlug,
161 }),
162 ),
163
164 /** Remove an organization membership. */
165 deleteOrgMembership: (membershipId: string) =>
166 use((wos) => wos.userManagement.deleteOrganizationMembership(membershipId)),
167
168 /** Get the role for a membership. */
169 getOrgMembership: (membershipId: string) =>
170 use((wos) => wos.userManagement.getOrganizationMembership(membershipId)),
171
172 /** Update a membership's role. */
173 updateOrgMembershipRole: (membershipId: string, roleSlug: string) =>
174 use((wos) => wos.userManagement.updateOrganizationMembership(membershipId, { roleSlug })),
175
176 /** List available roles for an organization. */
177 listOrgRoles: (organizationId: string) =>
178 use((wos) => wos.organizations.listOrganizationRoles({ organizationId })),
141 };179 };
142});180});
143 181
144type WorkOSAuthService = Effect.Effect.Success<typeof make>;182export type WorkOSAuthService = Effect.Effect.Success<typeof make>;
145 183
146export class WorkOSAuth extends Context.Tag("@executor/cloud/WorkOSAuth")<184export class WorkOSAuth extends Context.Tag("@executor/cloud/WorkOSAuth")<
147 WorkOSAuth,185 WorkOSAuth,