-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Move user export task on celery
- Loading branch information
Showing
36 changed files
with
2,502 additions
and
1,528 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
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
14 changes: 14 additions & 0 deletions
14
packages/backend/apps/users/services/export/email_serializers.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,14 @@ | ||
from rest_framework import serializers | ||
|
||
|
||
class UserDataExportEmailBaseSerializer(serializers.Serializer): | ||
email = serializers.CharField() | ||
export_url = serializers.CharField() | ||
|
||
|
||
class UserDataExportEmailSerializer(serializers.Serializer): | ||
data = UserDataExportEmailBaseSerializer() | ||
|
||
|
||
class AdminDataExportEmailSerializer(serializers.Serializer): | ||
data = UserDataExportEmailBaseSerializer(many=True) |
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 |
---|---|---|
@@ -1,11 +1,18 @@ | ||
from common.emails import get_send_email_event | ||
from userauth.constants import UserEmails | ||
from userauth.types import ExportedUserData | ||
from common import emails | ||
from . import email_serializers | ||
from . import constants | ||
|
||
|
||
def get_user_export_email_event(to: str, data: ExportedUserData): | ||
return get_send_email_event(detail_type=UserEmails.USER_EXPORT.value, data={"to": to, "data": data}) | ||
class DataExportEmail(emails.Email): | ||
def __init__(self, to: str, data: dict): | ||
super().__init__(to=to, data=data) | ||
|
||
|
||
def get_admin_export_email_event(to: str, data: list[ExportedUserData]): | ||
return get_send_email_event(detail_type=UserEmails.USER_EXPORT_ADMIN.value, data={"to": to, "data": data}) | ||
class UserDataExportEmail(DataExportEmail): | ||
name = constants.UserEmails.USER_EXPORT | ||
serializer_class = email_serializers.UserDataExportEmailSerializer | ||
|
||
|
||
class AdminDataExportEmail(DataExportEmail): | ||
name = constants.UserEmails.USER_EXPORT_ADMIN | ||
serializer_class = email_serializers.AdminDataExportEmailSerializer |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.