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
- {"code": 1008, "message": "Invalid Origi...
Nothing has changed in my application or console settings so I'm curious as to what I need to do to fix this. I already have the client registered so I'm not en...
- React Native/iOS platform integrations h...
Anyone else have this issue where platform identifiers have been lost/wiped and no option/field available to update them in the console?
- Issue with Appwrite Read Request Limit b...
Hi Team, My coding terminal connected to the Appwrite CLI blew through my Projects Read request limit with in a day! and thats a large limit! I'm not sure how...