I am currently applying a very ugly way to manage adding and subtracting team members to the team, is there a better way to do this?:
export async function removeMembersFromTeam( teamId: string, memberIds: string[] ): Promise<void> { try { const team = await databases.getDocument( config.databaseId!, config.teamsCollectionId!, teamId );
const updatedMembers = team.members.filter(
(member: any) => !memberIds.includes(member.$id)
);
await databases.updateDocument(
config.databaseId!,
config.teamsCollectionId!,
teamId,
{ members: updatedMembers }
);
console.log("Members removed successfully.");
} catch (error) { console.error("Error removing members from team:", error); throw error; } }
Recommended threads
- Custom domain for Google Auth
Hello! I connected my custom domain to my Appwrite project, but I can't get the Google login/consent screen to show my domain instead of the Appwrite domain. I...
- [SOLVED] Production down - createExecuti...
Hey, Since 1.9.6 rollout in fra (~17:00 UTC, 14 Aug), POST /v1/functions/{functionId}/executions returns a 400 whenever the body includes an empty headers ob...
- Quota not resetting
hi, im using appwrite's free tier plani hit my read limts last month and the billing cycle said it would reset on june 4th but that is today, the billing cycle ...