Conviley
03/27/2025, 9:55 AMtypescript
function spiceDbUpsertPromptRelations(prompt: UpsertPromptServiceInput, context: UserContext, promptId: string) {
return setCreator(promptId, context)
.andThen(() => getViewers(promptId))
.andThrough((userViewers) => updatePromptMembers(prompt, promptId, userViewers))
.andThen(() => getGroupViewers(promptId))
.andThrough((groupMemberViewers) => updatePromptGroups(prompt, promptId, groupMemberViewers))
.andThen(() => ok({ id: promptId }));
}
i have one step where i update the members and one step where i update the groups. They are basically duplicates and getViewers and updatePromptMembers work as expected