✨(backend) search users
We need to search users by their email. For that we will use the trigram similarity algorithm provided by PostgreSQL. To use it we have to activate the pg_trgm extension in postgres db. To query the email we will use the query param `q`. We have another query param `document_id`, it is necessary to exclude the users that have already access to the document.
This commit is contained in:
14
src/backend/core/migrations/0002_create_pg_trgm_extension.py
Normal file
14
src/backend/core/migrations/0002_create_pg_trgm_extension.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from django.db import migrations
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunSQL(
|
||||
"CREATE EXTENSION IF NOT EXISTS pg_trgm;",
|
||||
reverse_sql="DROP EXTENSION IF EXISTS pg_trgm;",
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user