Skip to content

Commit

Permalink
Tracking pull request to merge release-1.3.0 to main (#163)
Browse files Browse the repository at this point in the history
* update to 1.3.0

* add CORS_ORIGIN_WHITELIST fr task queue (#164)

* Itvr 343 , itvr 342 (#165)

* -fixes complete your application text

* -moves bceid button into a paragraph below login banner
-removes padding on whats-needed
-fixes login square margins and height for small screens

* -adds id prop so redirect works for household

* -title change on form (#166)

* itvr 334 - email changes (#167)

* itvr-334--email-changes

* more email changes

* rebase to release-1.3.0 (#171)

* -changes wording to add 'pre-approval' to titles and login (#172)

* limit DOB year to 4 char (#170)

* NCDA - notify of newly issued rebate. (#169)

* update admin panel

* still trying to see what's wrong here

* format payload for odata

* comment out response printing

* remove duplicate model

* itvr-346--prevent-duplicate-rebates (#173)

* itvr-347--restrict-file-uploads-to-exactly-2 (#176)

* add household initiated (#174)

* add household initiated

* update constraint

* Add NCDA secret (#175)

* add NCDA secret

* update readme

* itvr-308--tracking--test-site-only (#177)

* -removes 'responsive' text from date input (#178)

-adds new date input to spouse form

* manually send rebate signal (#179)

* update resource (#181)

* update spilo resource and add one test (#182)

* fix rebate tests (#180)

* Fix/ncda tidy (#183)

* save id of sharepoint item

* fix comment

* -removes logout button from index (#184)

-adds media queries to footer
-cleans up footer css

* add address and postal fields to household (#185)

* household_member_bcsc_address (#186)

* Fix/contact us (#187)

* link to general bc gov contact us

* update description

* fix backend dl check (#188)

* fix backend dl check

* add household_initiated status

* itvr-333 - partial changes to console (#168)

* -updates approve/reject buttons
-adds some code to change template for change_list

* -removes extra code

* Clamav 1.3.0 (#189)

* upgrade backend cpu or workers have issue

Co-authored-by: Emily <[email protected]>
Co-authored-by: tim738745 <[email protected]>
Co-authored-by: vibhiquartech <[email protected]>
Co-authored-by: Naomi <[email protected]>
  • Loading branch information
5 people authored Jun 22, 2022
1 parent 7ab9c15 commit 0021a0a
Show file tree
Hide file tree
Showing 51 changed files with 1,226 additions and 293 deletions.
22 changes: 11 additions & 11 deletions .pipeline/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,45 +39,45 @@ const phases = {
instance: `${name}-dev-${changeId}` , version:`${version}-${changeId}`, tag:`dev-${version}-${changeId}`,
host: `itvr-dev-${changeId}.${ocpName}.gov.bc.ca`, djangoDebug: 'True', logoutHostName: 'logontest.gov.bc.ca',
metabaseCpuRequest: '200m', metabaseCpuLimit: '300m', metabaseMemoryRequest: '500Mi', metabaseMemoryLimit: '2Gi', metabaseReplicas: 1,
frontendCpuRequest: '70m', frontendCpuLimit: '210m', frontendMemoryRequest: '300Mi', frontendMemoryLimit: '600Mi', frontendReplicas: 1,
frontendCpuRequest: '30m', frontendCpuLimit: '60m', frontendMemoryRequest: '30Mi', frontendMemoryLimit: '60Mi', frontendReplicas: 1,
reactAppBCSCKeycloakClientId: 'itvr', reactAppBCSCKeycloakRealm: 'rzh2zkjq', reactAppBCSCKeycloakUrl: 'https://dev.oidc.gov.bc.ca/auth/', reactAppApiBase: `https://itvr-backend-dev-${changeId}.apps.silver.devops.gov.bc.ca`,
reactAppBCeIDKeycloakClientId: 'itvr-2674', reactAppBCeIDKeycloakRealm: 'onestopauth-basic', reactAppBCeIDKeycloakUrl: 'https://dev.oidc.gov.bc.ca/auth/',
backendCpuRequest: '60m', backendCpuLimit: '120m', backendMemoryRequest: '120Mi', backendMemoryLimit: '240Mi', backendHealthCheckDelay: 30, backendHost: `itvr-backend-dev-${changeId}.${ocpName}.gov.bc.ca`, backendReplicas: 1, backendDjangoDebug: 'True', bucketName: 'itvrdv',
minioCpuRequest: '30m', minioCpuLimit: '100m', minioMemoryRequest: '150Mi', minioMemoryLimit: '300Mi', minioPvcSize: '3Gi',
schemaspyCpuRequest: '50m', schemaspyCpuLimit: '200m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
rabbitmqCpuRequest: '250m', rabbitmqCpuLimit: '700m', rabbitmqMemoryRequest: '500M', rabbitmqMemoryLimit: '1G', rabbitmqPvcSize: '1G', rabbitmqReplica: 1, rabbitmqPostStartSleep: 120, storageClass: 'netapp-block-standard',
patroniCpuRequest: '30m', patroniCpuLimit: '60m', patroniMemoryRequest: '80Mi', patroniMemoryLimit: '160Mi', patroniPvcSize: '2G', patroniReplica: 2, storageClass: 'netapp-block-standard', ocpName: `${ocpName}`,
taskQueueCpuRequest: '40m', taskQueueCpuLimit: '120m', taskQueueMemoryRequest: '120Mi', taskQueueMemoryLimit: '240Mi', taskQueueReplicas: 1, taskQueueDjangoDebug: 'True',},
patroniCpuRequest: '60m', patroniCpuLimit: '120m', patroniMemoryRequest: '200Mi', patroniMemoryLimit: '400Mi', patroniPvcSize: '2G', patroniReplica: 2, storageClass: 'netapp-block-standard', ocpName: `${ocpName}`,
taskQueueCpuRequest: '60m', taskQueueCpuLimit: '120m', taskQueueMemoryRequest: '200Mi', taskQueueMemoryLimit: '400Mi', taskQueueReplicas: 1, taskQueueDjangoDebug: 'True',},

test: {namespace:'ac294c-test', name: `${name}`, ssoSuffix:'-test',
ssoName:'test.oidc.gov.bc.ca', phase: 'test' , changeId:`${changeId}`, suffix: `-test`,
instance: `${name}-test`, version:`${version}`, tag:`test-${version}`,
host: `itvr-test.${ocpName}.gov.bc.ca`, djangoDebug: 'False', logoutHostName: 'logontest.gov.bc.ca',
metabaseCpuRequest: '200m', metabaseCpuLimit: '300m', metabaseMemoryRequest: '500Mi', metabaseMemoryLimit: '2Gi', metabaseReplicas: 1,
frontendCpuRequest: '70m', frontendCpuLimit: '210m', frontendMemoryRequest: '300Mi', frontendMemoryLimit: '600Mi', frontendReplicas: 2, frontendMinReplicas: 1, frontendMaxReplicas: 3,
frontendCpuRequest: '30m', frontendCpuLimit: '60m', frontendMemoryRequest: '30Mi', frontendMemoryLimit: '60Mi', frontendReplicas: 2, frontendMinReplicas: 1, frontendMaxReplicas: 3,
reactAppBCSCKeycloakClientId: 'itvr', reactAppBCSCKeycloakRealm: 'rzh2zkjq', reactAppBCSCKeycloakUrl: 'https://test.oidc.gov.bc.ca/auth/', reactAppApiBase: `https://itvr-backend-test.apps.silver.devops.gov.bc.ca`,
reactAppBCeIDKeycloakClientId: 'itvr-2674', reactAppBCeIDKeycloakRealm: 'onestopauth-basic', reactAppBCeIDKeycloakUrl: 'https://test.oidc.gov.bc.ca/auth/',
backendCpuRequest: '40m', backendCpuLimit: '120m', backendMemoryRequest: '120Mi', backendMemoryLimit: '240Mi', backendHealthCheckDelay: 30, backendReplicas: 2, backendMinReplicas: 1, backendMaxReplicas: 3, backendHost: `itvr-backend-test.${ocpName}.gov.bc.ca`, backendDjangoDebug: 'False', bucketName: 'itvrts',
backendCpuRequest: '30m', backendCpuLimit: '60m', backendMemoryRequest: '120Mi', backendMemoryLimit: '240Mi', backendHealthCheckDelay: 30, backendReplicas: 2, backendMinReplicas: 1, backendMaxReplicas: 3, backendHost: `itvr-backend-test.${ocpName}.gov.bc.ca`, backendDjangoDebug: 'False', bucketName: 'itvrts',
minioCpuRequest: '30m', minioCpuLimit: '100m', minioMemoryRequest: '150Mi', minioMemoryLimit: '300Mi', minioPvcSize: '3G',
schemaspyCpuRequest: '20m', schemaspyCpuLimit: '200m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
rabbitmqCpuRequest: '250m', rabbitmqCpuLimit: '700m', rabbitmqMemoryRequest: '500M', rabbitmqMemoryLimit: '700M', rabbitmqPvcSize: '1G', rabbitmqReplica: 2, rabbitmqPostStartSleep: 120, storageClass: 'netapp-block-standard',
patroniCpuRequest: '200m', patroniCpuLimit: '400m', patroniMemoryRequest: '250Mi', patroniMemoryLimit: '500Mi', patroniPvcSize: '5G', patroniReplica: 2, storageClass: 'netapp-block-standard', ocpName: `${ocpName}`,
taskQueueCpuRequest: '40m', taskQueueCpuLimit: '120m', taskQueueMemoryRequest: '120Mi', taskQueueMemoryLimit: '240Mi', taskQueueReplicas: 1, taskQueueDjangoDebug: 'False',},
patroniCpuRequest: '60m', patroniCpuLimit: '120m', patroniMemoryRequest: '200Mi', patroniMemoryLimit: '400Mi', patroniPvcSize: '5G', patroniReplica: 2, storageClass: 'netapp-block-standard', ocpName: `${ocpName}`,
taskQueueCpuRequest: '60m', taskQueueCpuLimit: '120m', taskQueueMemoryRequest: '200Mi', taskQueueMemoryLimit: '400Mi', taskQueueReplicas: 1, taskQueueDjangoDebug: 'False',},

prod: {namespace:'ac294c-prod', name: `${name}`, ssoSuffix:'',
ssoName:'oidc.gov.bc.ca', phase: 'prod' , changeId:`${changeId}`, suffix: `-prod`,
instance: `${name}-prod`, version:`${version}`, tag:`prod-${version}`,
metabaseCpuRequest: '200m', metabaseCpuLimit: '300m', metabaseMemoryRequest: '500Mi', metabaseMemoryLimit: '2Gi', metabaseReplicas: 1,
host: `itvr-prod.${ocpName}.gov.bc.ca`, djangoDebug: 'False', logoutHostName: 'logon7.gov.bc.ca',
frontendCpuRequest: '140m', frontendCpuLimit: '280m', frontendMemoryRequest: '600Mi', frontendMemoryLimit: '1200Mi', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5,
frontendCpuRequest: '30m', frontendCpuLimit: '60m', frontendMemoryRequest: '30Mi', frontendMemoryLimit: '60Mi', frontendReplicas: 2, frontendMinReplicas: 2, frontendMaxReplicas: 5,
reactAppBCSCKeycloakClientId: 'itvr', reactAppBCSCKeycloakRealm: 'rzh2zkjq', reactAppBCSCKeycloakUrl: 'https://oidc.gov.bc.ca/auth/', reactAppApiBase: `https://itvr-backend-prod.apps.silver.devops.gov.bc.ca`,
reactAppBCeIDKeycloakClientId: 'itvr-2674', reactAppBCeIDKeycloakRealm: 'onestopauth-basic', reactAppBCeIDKeycloakUrl: 'https://oidc.gov.bc.ca/auth/',
backendCpuRequest: '80m', backendCpuLimit: '160m', backendMemoryRequest: '240Mi', backendMemoryLimit: '480Mi', backendHealthCheckDelay: 30, backendReplicas: 3, backendMinReplicas: 3, backendMaxReplicas: 5, backendHost: `itvr-backend-prod.${ocpName}.gov.bc.ca`, backendDjangoDebug: 'False', bucketName: 'itvrpr',
backendCpuRequest: '30m', backendCpuLimit: '60m', backendMemoryRequest: '240Mi', backendMemoryLimit: '480Mi', backendHealthCheckDelay: 30, backendReplicas: 3, backendMinReplicas: 3, backendMaxReplicas: 5, backendHost: `itvr-backend-prod.${ocpName}.gov.bc.ca`, backendDjangoDebug: 'False', bucketName: 'itvrpr',
minioCpuRequest: '30m', minioCpuLimit: '100m', minioMemoryRequest: '150Mi', minioMemoryLimit: '300Mi', minioPvcSize: '3G',
schemaspyCpuRequest: '50m', schemaspyCpuLimit: '400m', schemaspyMemoryRequest: '150M', schemaspyMemoryLimit: '300M', schemaspyHealthCheckDelay: 160,
rabbitmqCpuRequest: '250m', rabbitmqCpuLimit: '700m', rabbitmqMemoryRequest: '500M', rabbitmqMemoryLimit: '1G', rabbitmqPvcSize: '5G', rabbitmqReplica: 2, rabbitmqPostStartSleep: 120, storageClass: 'netapp-block-standard',
patroniCpuRequest: '200m', patroniCpuLimit: '400m', patroniMemoryRequest: '250Mi', patroniMemoryLimit: '500Mi', patroniPvcSize: '8G', patroniReplica: 3, storageClass: 'netapp-block-standard', ocpName: `${ocpName}`,
taskQueueCpuRequest: '80m', taskQueueCpuLimit: '160m', taskQueueMemoryRequest: '150Mi', taskQueueMemoryLimit: '300Mi', taskQueueReplicas: 1, taskQueueDjangoDebug: 'False',}
patroniCpuRequest: '60m', patroniCpuLimit: '120m', patroniMemoryRequest: '200Mi', patroniMemoryLimit: '400Mi', patroniPvcSize: '5G', patroniReplica: 3, storageClass: 'netapp-block-standard', ocpName: `${ocpName}`,
taskQueueCpuRequest: '60m', taskQueueCpuLimit: '120m', taskQueueMemoryRequest: '200Mi', taskQueueMemoryLimit: '400Mi', taskQueueReplicas: 1, taskQueueDjangoDebug: 'False',}

};

Expand Down
8 changes: 4 additions & 4 deletions chart/itvr/charts/itvr-spilo/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ spilo:

resources:
limits:
cpu: 240m
memory: 800Mi
requests:
cpu: 120m
memory: 400Mi
memory: 400Mi
requests:
cpu: 60m
memory: 200Mi

podDisruptionBudget:
enabled: false
Expand Down
9 changes: 9 additions & 0 deletions django/api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
SubmittedGoElectricRebateApplication,
)
from .models.household_member import HouseholdMember
from .models.go_electric_rebate import GoElectricRebate


class HouseholdApplicationInline(admin.StackedInline):
Expand All @@ -15,6 +16,9 @@ class HouseholdApplicationInline(admin.StackedInline):
"first_name",
"middle_names",
"date_of_birth",
"bcsc_address",
"bcsc_city",
"bcsc_postal_code",
"doc1_tag",
"doc2_tag",
"consent_personal",
Expand Down Expand Up @@ -89,3 +93,8 @@ def response_change(self, request, obj):
obj.status = GoElectricRebateApplication.Status.DECLINED
obj.save(update_fields=["status"])
return ret


@admin.register(GoElectricRebate)
class GoElectricRebateAdmin(admin.ModelAdmin):
pass
16 changes: 12 additions & 4 deletions django/api/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.0.1 on 2022-06-12 23:01
# Generated by Django 4.0.1 on 2022-06-21 17:05

import api.validators
from django.conf import settings
Expand Down Expand Up @@ -59,6 +59,9 @@ class Migration(migrations.Migration):
('first_name', models.CharField(max_length=250)),
('middle_names', models.CharField(blank=True, max_length=250, null=True)),
('date_of_birth', models.DateField(validators=[api.validators.validate_driving_age])),
('bcsc_address', models.CharField(blank=True, max_length=250, null=True)),
('bcsc_city', models.CharField(blank=True, max_length=250, null=True)),
('bcsc_postal_code', models.CharField(blank=True, max_length=6, null=True)),
('doc1', models.ImageField(blank=True, null=True, upload_to='docs')),
('doc2', models.ImageField(blank=True, null=True, upload_to='docs')),
('consent_personal', models.BooleanField(validators=[api.validators.validate_consent])),
Expand All @@ -73,14 +76,15 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='GoElectricRebate',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', django_extensions.db.fields.CreationDateTimeField(auto_now_add=True, verbose_name='created')),
('modified', django_extensions.db.fields.ModificationDateTimeField(auto_now=True, verbose_name='modified')),
('id', models.AutoField(primary_key=True, serialize=False)),
('drivers_licence', models.CharField(max_length=8, validators=[django.core.validators.MinLengthValidator(7)])),
('drivers_licence', models.CharField(max_length=8, unique=True, validators=[django.core.validators.MinLengthValidator(7)])),
('last_name', models.CharField(max_length=250)),
('expiry_date', models.DateField()),
('rebate_max_amount', models.IntegerField(default=0)),
('rebate_state', models.BooleanField(default=False)),
('redeemed', models.BooleanField(default=False)),
('ncda_id', models.IntegerField(blank=True, null=True)),
('application', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='api.goelectricrebateapplication')),
],
options={
Expand All @@ -99,4 +103,8 @@ class Migration(migrations.Migration):
},
bases=('api.goelectricrebateapplication',),
),
migrations.AddConstraint(
model_name='goelectricrebateapplication',
constraint=models.UniqueConstraint(condition=models.Q(('status__in', ['household_initiated', 'submitted', 'approved', 'redeemed', 'verified'])), fields=('drivers_licence',), name='verify_rebate_status'),
),
]
14 changes: 9 additions & 5 deletions django/api/models/go_electric_rebate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@
BooleanField,
PROTECT,
ForeignKey,
AutoField,
UUIDField,
)

from django.core.validators import MinLengthValidator

from django_extensions.db.models import TimeStampedModel
from django.utils.translation import gettext_lazy as _
from api.models.go_electric_rebate_application import GoElectricRebateApplication


class GoElectricRebate(TimeStampedModel):
id = AutoField(primary_key=True)
application = ForeignKey(
GoElectricRebateApplication, on_delete=PROTECT, blank=True, null=True
)
drivers_licence = CharField(
max_length=8, unique=False, validators=[MinLengthValidator(7)]
max_length=8, unique=True, validators=[MinLengthValidator(7)]
)
last_name = CharField(max_length=250, unique=False)
expiry_date = DateField()
rebate_max_amount = IntegerField(default=0)
rebate_state = BooleanField(default=False)
redeemed = BooleanField(default=False)
# sharepoint id. If something goes wrong with notification we can find
# issued rebates with blank NCDA ids to try resending.
ncda_id = IntegerField(blank=True, null=True)

def __str__(self):
return "DL: " + self.drivers_licence + ", $" + str(self.rebate_max_amount)
17 changes: 17 additions & 0 deletions django/api/models/go_electric_rebate_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
ForeignKey,
TextChoices,
Manager,
Q,
UniqueConstraint,
)
from encrypted_fields.fields import EncryptedCharField
from django.utils.html import mark_safe
Expand Down Expand Up @@ -103,6 +105,21 @@ def __str__(self):

class Meta:
db_table = "go_electric_rebate_application"
constraints = [
UniqueConstraint(
fields=["drivers_licence"],
condition=Q(
status__in=[
"household_initiated",
"submitted",
"approved",
"redeemed",
"verified",
]
),
name="verify_rebate_status",
)
]


# This is for the admin panel
Expand Down
3 changes: 3 additions & 0 deletions django/api/models/household_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class HouseholdMember(TimeStampedModel):
first_name = CharField(max_length=250, unique=False)
middle_names = CharField(max_length=250, unique=False, blank=True, null=True)
date_of_birth = DateField(validators=[validate_driving_age])
bcsc_address = CharField(max_length=250, unique=False, blank=True, null=True)
bcsc_city = CharField(max_length=250, unique=False, blank=True, null=True)
bcsc_postal_code = CharField(max_length=6, unique=False, blank=True, null=True)
doc1 = ImageField(upload_to="docs", blank=True, null=True)

def doc1_tag(self):
Expand Down
44 changes: 24 additions & 20 deletions django/api/serializers/application_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
from rest_framework.parsers import FormParser, MultiPartParser
from datetime import date
from django.core.exceptions import ValidationError

from rest_framework.response import Response
from rest_framework import status

class ApplicationFormCreateSerializer(ModelSerializer):
parser_classes = (
Expand Down Expand Up @@ -88,25 +89,28 @@ def create(self, validated_data):
user = request.user
spouse_email = request.data.get("spouse_email")

obj = GoElectricRebateApplication.objects.create(
sin=validated_data["sin"],
status=self._get_status(validated_data),
email=validated_data["email"],
drivers_licence=validated_data["drivers_licence"],
last_name=user.last_name,
first_name=user.first_name,
date_of_birth=user.date_of_birth,
address=user.street_address,
city=user.locality,
postal_code=user.postal_code,
tax_year=self._get_tax_year(),
application_type=validated_data["application_type"],
spouse_email=spouse_email,
user=user,
consent_personal=validated_data["consent_personal"],
consent_tax=validated_data["consent_tax"],
)
return obj
try:
obj = GoElectricRebateApplication.objects.create(
sin=validated_data["sin"],
status=self._get_status(validated_data),
email=validated_data["email"],
drivers_licence=validated_data["drivers_licence"],
last_name=user.last_name,
first_name=user.first_name,
date_of_birth=user.date_of_birth,
address=user.street_address,
city=user.locality,
postal_code=user.postal_code,
tax_year=self._get_tax_year(),
application_type=validated_data["application_type"],
spouse_email=spouse_email,
user=user,
consent_personal=validated_data["consent_personal"],
consent_tax=validated_data["consent_tax"],
)
return obj
except Exception as e:
return Response({"response": str(e)}, status=status.HTTP_400_BAD_REQUEST)

def _get_status(self, validated_data):
application_type = validated_data["application_type"]
Expand Down
5 changes: 4 additions & 1 deletion django/api/serializers/household_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class HouseholdMemberApplicationCreateSerializer(ModelSerializer):

class Meta:
model = HouseholdMember
exclude = ["user"]
exclude = ["user", "bcsc_address", "bcsc_city", "bcsc_postal_code"]


class HouseholdMemberApplicationCreateSerializerDefault(
Expand Down Expand Up @@ -67,6 +67,9 @@ def create(self, validated_data):
last_name=user.last_name,
first_name=user.first_name,
date_of_birth=user.date_of_birth,
bcsc_address=user.street_address,
bcsc_city=user.locality,
bcsc_postal_code=user.postal_code,
user=user,
consent_personal=validated_data["consent_personal"],
consent_tax=validated_data["consent_tax"],
Expand Down
Loading

0 comments on commit 0021a0a

Please sign in to comment.