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
- Production down - createExecution return...
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 ...
- Student plan issue
I am using GitHub student plan, I even got access to appwrite's mock phone number. but when I try to use it, it says the phone number limit has reached