Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchdawson1982 committed Dec 13, 2024
1 parent 145b145 commit d30fc07
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 12 additions & 0 deletions feedback/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from urllib.parse import quote, urlparse, urlunparse

from django.conf import settings
from django.core.validators import MinLengthValidator
from django.db import models
Expand Down Expand Up @@ -55,3 +57,13 @@ class IssueChoices(models.TextChoices):
entity_name = models.CharField(max_length=250)
entity_url = models.CharField(max_length=250)
data_custodian_email = models.CharField(max_length=250)

@property
def formatted_entity_url(self):
parsed_url = urlparse(self.entity_url)
path = quote(parsed_url.path)
formatted_entity_url = urlunparse(
(parsed_url.scheme, parsed_url.netloc, path, "", "", "")
)
print(f"formatted entity url: {formatted_entity_url}")
return formatted_entity_url
6 changes: 4 additions & 2 deletions feedback/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ def send(

personalisation = {
"assetOwner": (
issue.data_custodian_email if issue.data_custodian_email else "Data Catalog Team"
issue.data_custodian_email
if issue.data_custodian_email
else "Data Catalog Team"
),
"userEmail": issue.created_by.email if issue.created_by else "",
"assetName": issue.entity_name,
"userMessage": issue.additional_info,
"assetUrl": issue.entity_url,
"assetUrl": issue.formatted_entity_url,
}

reference = str(issue.id)
Expand Down

0 comments on commit d30fc07

Please sign in to comment.