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
- Missing Invoice
Hi! I need help with billing on my account (marelu@gmail.com). I have never received a single invoice by email. My organization has been on the Pro plan since...
- Appwrite Functions cold start
Hello. I'm seeing really long cold starts on Appwrite Cloud Functions and wanted to know if this is expected. My function just authenticates the user, fetches ...
- Error can not create `tablesdb` event wi...
When i'm trying to add an event with `tablesdb` i get an error message My event value: `tablesdb.mtg-decklist-dev.tables.queue_parsing.rows.*.create` Same err...