( userId: string )
| 20 | * (signup always creates a personal account). |
| 21 | */ |
| 22 | export const resolveActiveAccountId = async ( |
| 23 | userId: string |
| 24 | ): Promise<string> => { |
| 25 | const memberships = await accountsService.getMembershipsForUser(userId); |
| 26 | const first = memberships[0]; |
| 27 | |
| 28 | if (first === undefined) { |
| 29 | throw ApiErrors.internal(`User ${userId} has no active memberships`); |
| 30 | } |
| 31 | |
| 32 | return first.accountId; |
| 33 | }; |
no test coverage detected