-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Inbound Parsing] Modification du format d'email (#901)
* add two new fields for uuids * update logic email * update migrations * add tests and rename * improve tests lisibility * clean from review
- Loading branch information
1 parent
6a46a71
commit 2e14a8a
Showing
6 changed files
with
200 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...conversations/migrations/0010_conversation_uuid_sender_conversation_uuid_siae_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Generated by Django 4.2.2 on 2023-09-05 18:03 | ||
import uuid | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def set_uuids(apps, schema_editor): | ||
Conversation = apps.get_model("conversations", "Conversation") | ||
for conversation in Conversation.objects.all(): | ||
siae = conversation.siae | ||
conversation.sender_encoded = ( | ||
f"{conversation.sender_first_name}_{conversation.sender_last_name}_{str(uuid.uuid4())[:4]}" | ||
) | ||
conversation.siae_encoded = f"{siae.contact_first_name}_{siae.contact_last_name}_{str(uuid.uuid4())[:4]}" | ||
conversation.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("conversations", "0009_conversation_validated_at"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="conversation", | ||
name="sender_encoded", | ||
field=models.CharField(db_index=True, default="", max_length=255, verbose_name="Identifiant initiateur"), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name="conversation", | ||
name="siae_encoded", | ||
field=models.CharField(db_index=True, default="", max_length=255, verbose_name="Identifiant structure"), | ||
preserve_default=False, | ||
), | ||
migrations.AlterField( | ||
model_name="conversation", | ||
name="version", | ||
field=models.PositiveIntegerField(default=1, verbose_name="Version"), | ||
), | ||
migrations.RunPython(set_uuids, migrations.RunPython.noop), | ||
] |
22 changes: 22 additions & 0 deletions
22
lemarche/conversations/migrations/0011_conversation_sender_siae_encoded_unique.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 4.2.2 on 2023-09-05 18:19 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("conversations", "0010_conversation_uuid_sender_conversation_uuid_siae_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="conversation", | ||
name="sender_encoded", | ||
field=models.CharField(db_index=True, max_length=255, unique=True, verbose_name="Identifiant initiateur"), | ||
), | ||
migrations.AlterField( | ||
model_name="conversation", | ||
name="siae_encoded", | ||
field=models.CharField(db_index=True, max_length=255, unique=True, verbose_name="Identifiant structure"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters