Skip to content

Commit

Permalink
🗃️(dashboard) add administration and company fields to consent model
Browse files Browse the repository at this point in the history
Introduced new fields in the Consent model to handle company and administration information, including validation for SIRET, NAF code, and zip code.
Updated settings with configurable default values for these fields.
Added core validators for ensuring data integrity in relevant fields.
  • Loading branch information
ssorin committed Jan 27, 2025
1 parent 6045f07 commit 003f9ce
Show file tree
Hide file tree
Showing 13 changed files with 873 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ jobs:
env:
DASHBOARD_DATABASE_URL: psql://qualicharge:pass@postgresql:5432/qualicharge-dashboard
DASHBOARD_SECRET_KEY: the_secret_key
DASHBOARD_CONTROL_AUTHORITY_NAME: QualiCharge
DASHBOARD_CONTROL_AUTHORITY_ADDRESS_1: 1 rue de test
DASHBOARD_CONTROL_AUTHORITY_ZIP_CODE: 75000
DASHBOARD_CONTROL_AUTHORITY_CITY: Paris
DASHBOARD_CONTROL_AUTHORITY_REPRESENTED_BY: John Doe
DASHBOARD_CONTROL_AUTHORITY_EMAIL: [email protected]
DASHBOARD_CONSENT_DONE_AT: Paris
steps:
- uses: actions/checkout@v4
- name: Install pipenv
Expand Down Expand Up @@ -95,3 +102,10 @@ jobs:
DASHBOARD_DB_NAME: test-qualicharge-dashboard
DASHBOARD_DATABASE_URL: psql://qualicharge:pass@localhost:5432/test-qualicharge-dashboard
DASHBOARD_SECRET_KEY: the_secret_key
DASHBOARD_CONTROL_AUTHORITY_NAME: QualiCharge
DASHBOARD_CONTROL_AUTHORITY_ADDRESS_1: 1 rue de test
DASHBOARD_CONTROL_AUTHORITY_ZIP_CODE: 75000
DASHBOARD_CONTROL_AUTHORITY_CITY: Paris
DASHBOARD_CONTROL_AUTHORITY_REPRESENTED_BY: John Doe
DASHBOARD_CONTROL_AUTHORITY_EMAIL: [email protected]
DASHBOARD_CONSENT_DONE_AT: Paris
10 changes: 10 additions & 0 deletions env.d/dashboard
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,13 @@ DJANGO_SUPERUSER_PASSWORD=admin
DJANGO_SUPERUSER_USERNAME=admin
[email protected]

# Control authority contact
DASHBOARD_CONTROL_AUTHORITY_NAME=QualiCharge
DASHBOARD_CONTROL_AUTHORITY_ADDRESS_1=1 rue de test
DASHBOARD_CONTROL_AUTHORITY_ADDRESS_2=
DASHBOARD_CONTROL_AUTHORITY_ZIP_CODE=75000
DASHBOARD_CONTROL_AUTHORITY_CITY=Paris
DASHBOARD_CONTROL_AUTHORITY_REPRESENTED_BY=John Doe
[email protected]

DASHBOARD_CONSENT_DONE_AT=Paris
1 change: 1 addition & 0 deletions src/dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to
- add consent form to manage consents of one or many entities
- add admin integration for Entity, DeliveryPoint and Consent
- add mass admin action (make revoked) for consents
- add validators for SIRET, NAF code and Zip code
- disallow mass action "delete" for consents in admin
- block the updates of all new data if a consent has the status `REVOKED`
- block the updates of all new data if a consent has the status `VALIDATED`
Expand Down
1 change: 1 addition & 0 deletions src/dashboard/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ django-environ = "==0.12.0"
django-extensions = "==3.2.3"
django-stubs = {extras = ["compatible-mypy"], version = "==5.1.2"}
gunicorn = "==23.0.0"
jsonschema = "==4.23.0"
psycopg = {extras = ["pool", "binary"], version = "==3.2.4"}
sentry-sdk = {extras = ["django"], version = "==2.20.0"}
whitenoise = "==6.8.2"
Expand Down
144 changes: 143 additions & 1 deletion src/dashboard/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Generated by Django 5.1.5 on 2025-01-26 16:01

import apps.consent.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("qcd_consent", "0003_alter_consent_managers_alter_consent_end_and_more"),
]

operations = [
migrations.AddField(
model_name="consent",
name="allows_daily_index_readings",
field=models.BooleanField(
default=False,
verbose_name="allow history of daily index readings in kWh",
),
),
migrations.AddField(
model_name="consent",
name="allows_load_curve",
field=models.BooleanField(
default=False,
verbose_name="allows history of load curve, at steps returned by Enedis",
),
),
migrations.AddField(
model_name="consent",
name="allows_max_daily_power",
field=models.BooleanField(
default=False,
verbose_name="allows historical maximum daily power in kVa or kWh ",
),
),
migrations.AddField(
model_name="consent",
name="allows_measurements",
field=models.BooleanField(
default=False, verbose_name="allows historical measurements in kWh"
),
),
migrations.AddField(
model_name="consent",
name="allows_technical_contractual_data",
field=models.BooleanField(
default=False,
verbose_name="allows the technical and contractual data available",
),
),
migrations.AddField(
model_name="consent",
name="company",
field=models.JSONField(
blank=True,
default=None,
null=True,
validators=[apps.consent.validators.validate_company_schema],
verbose_name="company informations",
),
),
migrations.AddField(
model_name="consent",
name="company_representative",
field=models.JSONField(
blank=True,
default=None,
null=True,
validators=[apps.consent.validators.validate_representative_schema],
verbose_name="company representative informations",
),
),
migrations.AddField(
model_name="consent",
name="control_authority",
field=models.JSONField(
blank=True,
default=None,
null=True,
validators=[apps.consent.validators.validate_control_authority_schema],
verbose_name="control authority informations",
),
),
migrations.AddField(
model_name="consent",
name="is_authoritative_signatory",
field=models.BooleanField(
default=False,
verbose_name="the signatory has the authority to sign this consent",
),
),
migrations.AddField(
model_name="consent",
name="signature_location",
field=models.CharField(
blank=True, max_length=255, null=True, verbose_name="signature location"
),
),
migrations.AddField(
model_name="consent",
name="signed_at",
field=models.DateTimeField(
blank=True, null=True, verbose_name="signature date"
),
),
]
Loading

0 comments on commit 003f9ce

Please sign in to comment.