Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-vari committed Dec 13, 2024
2 parents 8e6349c + 43124dd commit bb8287e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
37 changes: 37 additions & 0 deletions app/core/management/commands/export_client_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import csv
import sys
import re

from core.models import Issue
from django.core.management.base import BaseCommand

fields = [
"fileref",
"client__first_name",
"client__last_name",
"topic",
"created_at",
"is_open",
"stage",
"provided_legal_services",
"client__email",
"client__phone_number",
"tenancy__address",
"tenancy__suburb",
"tenancy__postcode",
]


class Command(BaseCommand):
help = "Output client information as CSV"

def handle(self, *args, **kwargs):
values = (
Issue.objects.select_related("client", "tenancy")
.values(*fields)
.order_by("-created_at")
)
writer = csv.DictWriter(sys.stdout, fieldnames=fields)
header = dict(zip(fields, [ re.sub('^\w+__', '', x) for x in fields ]))
writer.writerow(header)
writer.writerows(values.iterator())
3 changes: 1 addition & 2 deletions app/core/management/commands/obfuscate_data.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import logging
import os
from io import BytesIO
from random import randint

from accounts.models import CaseGroups, User
from core.models import Client, FileUpload, Issue, IssueNote, Person, Service, Tenancy
Expand All @@ -12,8 +11,8 @@
from django.db import transaction
from django.db.models import Q
from emails.models import Email, EmailAttachment
from utils.signals import disable_signals, restore_signals
from faker import Faker
from utils.signals import disable_signals, restore_signals

logger = logging.getLogger(__name__)

Expand Down
1 change: 1 addition & 0 deletions app/scripts/tasks/staging-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ aws s3 sync --acl public-read s3://anika-clerk/action-documents s3://anika-clerk
aws s3 sync --acl public-read s3://anika-clerk/documents s3://anika-clerk-test/documents
aws s3 sync --acl public-read s3://anika-clerk/images s3://anika-clerk-test/images
aws s3 sync --acl public-read s3://anika-clerk/original_images s3://anika-clerk-test/original_images
aws s3 sync --acl public-read s3://anika-twilio-audio s3://anika-twilio-audio-test

echo -e "\nRunning migrations"
./manage.py migrate
Expand Down

0 comments on commit bb8287e

Please sign in to comment.