Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨(backend) allow to filter member on team access endpoint #200

Merged
merged 1 commit into from
Jul 31, 2024

Conversation

sdemagny
Copy link
Collaborator

@sdemagny sdemagny commented Apr 25, 2024

Purpose

Filter member by main identity name or email.

Proposal

Description...

  • filter members using trigram similarity
  • add tests

Comment on lines 358 to 377
if query := self.request.GET.get("q", ""):
similarity = Max(
TrigramSimilarity(
Coalesce(
Func("user__identities__email", function="unaccent"), Value("")
),
Func(Value(query), function="unaccent"),
)
+ TrigramSimilarity(
Coalesce(
Func("user__identities__name", function="unaccent"), Value("")
),
Func(Value(query), function="unaccent"),
)
)
queryset = (
queryset.annotate(similarity=similarity)
.filter(similarity__gte=SIMILARITY_THRESHOLD)
.order_by("-similarity")
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be a little lower, inside the list/retrieve "if" ?

client.force_login(user)

response = client.get(
f"/api/v1.0/teams/{team.id!s}/accesses/?q=BRU",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't work and I'm not sure why 🤔

@sdemagny sdemagny force-pushed the sdem/teamaccess_filtermb branch from 0a92b13 to 434182b Compare June 4, 2024 09:11
@sdemagny sdemagny removed the WIP label Jun 4, 2024
@sdemagny sdemagny force-pushed the sdem/teamaccess_filtermb branch 5 times, most recently from 9200fa9 to bbdd4e8 Compare July 18, 2024 22:24
@sdemagny sdemagny requested a review from mjeammet July 18, 2024 22:31
@sdemagny sdemagny marked this pull request as ready for review July 18, 2024 22:35
@sdemagny sdemagny force-pushed the sdem/teamaccess_filtermb branch 2 times, most recently from 4620ab1 to 5333e2d Compare July 19, 2024 13:56
@sdemagny sdemagny force-pushed the sdem/teamaccess_filtermb branch from 6c85e91 to 727118a Compare July 31, 2024 13:58
@sdemagny sdemagny force-pushed the sdem/teamaccess_filtermb branch from 727118a to ab54d5a Compare July 31, 2024 14:01
@sdemagny sdemagny merged commit ab54d5a into main Jul 31, 2024
15 checks passed
@sdemagny sdemagny deleted the sdem/teamaccess_filtermb branch July 31, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants