BUG: teams.listMemberships returns 404 when team exists but using query to filter users
- 0
- Teams
- Flutter
- Cloud
using sdk for Flutter. my code:
Future<models.Membership?> getMembership(String teamId, String userId) async {
try {
final models.MembershipList list = await teams.listMemberships(
teamId: teamId,
queries: [
Query.equal('userId', userId)
]
);
return list.total > 0 ? list.memberships[0] : null;
} catch (e) {
print("ERROR getMembership: $e");
return null;
}
}
expected: 200 OK with MembershipList.total = 0 actual: AppwriteException: team_not_found, Team with the requested ID could not be found. (404). server version: Cloud (1.1.2). SDK Flutter 8.1.0 <#1102936099745177700>
according to the source (master branch) probably was resolved later 1.1.2. could anyone confirm this?
make sure to use 3 backticks when formatting multiline code
what happens if you run teams.list()
?
Returns $.total=0 if the user not belongs to the group (great). But I need to return the membership to validate the roles
So if they aren't in the team, it'll return 404. That's expected
I agree to be disagree. The name of the endpoint is membership, no team. Membership is a sub resource of team. So the right answer should be total=0 because is returning a list of memberships
Like team.list return total=0 too
Yes, because the user isn't in any teams
The API lists the memberships of a team, but the team doesn't exist
Recommended threads
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- Our Appwrite organization is suspended
Please give support regarding this , no app is working now , please solve my issue and give support , no one is replying in message section or email.
- Project in AppWrite Cloud doesn't allow ...
I have a collection where the data can't be opened. When I check the functions, there are three instances of a function still running that can't be deleted. The...