Skip to content

Commit 0365c95

Browse files
committed
🗃️(dashboard) add administration and company fields to consent model
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.
1 parent 6045f07 commit 0365c95

File tree

13 files changed

+873
-2
lines changed

13 files changed

+873
-2
lines changed

.github/workflows/dashboard.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ jobs:
3838
env:
3939
DASHBOARD_DATABASE_URL: psql://qualicharge:pass@postgresql:5432/qualicharge-dashboard
4040
DASHBOARD_SECRET_KEY: the_secret_key
41+
DASHBOARD_CONTROL_AUTHORITY_NAME: QualiCharge
42+
DASHBOARD_CONTROL_AUTHORITY_ADDRESS_1: 1 rue de test
43+
DASHBOARD_CONTROL_AUTHORITY_ZIP_CODE: 75000
44+
DASHBOARD_CONTROL_AUTHORITY_CITY: Paris
45+
DASHBOARD_CONTROL_AUTHORITY_REPRESENTED_BY: John Doe
46+
DASHBOARD_CONTROL_AUTHORITY_EMAIL: [email protected]
47+
DASHBOARD_CONSENT_DONE_AT: Paris
4148
steps:
4249
- uses: actions/checkout@v4
4350
- name: Install pipenv
@@ -95,3 +102,10 @@ jobs:
95102
DASHBOARD_DB_NAME: test-qualicharge-dashboard
96103
DASHBOARD_DATABASE_URL: psql://qualicharge:pass@localhost:5432/test-qualicharge-dashboard
97104
DASHBOARD_SECRET_KEY: the_secret_key
105+
DASHBOARD_CONTROL_AUTHORITY_NAME: QualiCharge
106+
DASHBOARD_CONTROL_AUTHORITY_ADDRESS_1: 1 rue de test
107+
DASHBOARD_CONTROL_AUTHORITY_ZIP_CODE: 75000
108+
DASHBOARD_CONTROL_AUTHORITY_CITY: Paris
109+
DASHBOARD_CONTROL_AUTHORITY_REPRESENTED_BY: John Doe
110+
DASHBOARD_CONTROL_AUTHORITY_EMAIL: [email protected]
111+
DASHBOARD_CONSENT_DONE_AT: Paris

env.d/dashboard

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,13 @@ DJANGO_SUPERUSER_PASSWORD=admin
1919
DJANGO_SUPERUSER_USERNAME=admin
2020
2121

22+
# Control authority contact
23+
DASHBOARD_CONTROL_AUTHORITY_NAME=QualiCharge
24+
DASHBOARD_CONTROL_AUTHORITY_ADDRESS_1=1 rue de test
25+
DASHBOARD_CONTROL_AUTHORITY_ADDRESS_2=
26+
DASHBOARD_CONTROL_AUTHORITY_ZIP_CODE=75000
27+
DASHBOARD_CONTROL_AUTHORITY_CITY=Paris
28+
DASHBOARD_CONTROL_AUTHORITY_REPRESENTED_BY=John Doe
29+
30+
31+
DASHBOARD_CONSENT_DONE_AT=Paris

src/dashboard/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to
2020
- add consent form to manage consents of one or many entities
2121
- add admin integration for Entity, DeliveryPoint and Consent
2222
- add mass admin action (make revoked) for consents
23+
- add validators for SIRET, NAF code and Zip code
2324
- disallow mass action "delete" for consents in admin
2425
- block the updates of all new data if a consent has the status `REVOKED`
2526
- block the updates of all new data if a consent has the status `VALIDATED`

src/dashboard/Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ django-environ = "==0.12.0"
1010
django-extensions = "==3.2.3"
1111
django-stubs = {extras = ["compatible-mypy"], version = "==5.1.2"}
1212
gunicorn = "==23.0.0"
13+
jsonschema = "==4.23.0"
1314
psycopg = {extras = ["pool", "binary"], version = "==3.2.4"}
1415
sentry-sdk = {extras = ["django"], version = "==2.20.0"}
1516
whitenoise = "==6.8.2"

src/dashboard/Pipfile.lock

Lines changed: 143 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Generated by Django 5.1.5 on 2025-01-26 16:01
2+
3+
import apps.consent.validators
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
("qcd_consent", "0003_alter_consent_managers_alter_consent_end_and_more"),
11+
]
12+
13+
operations = [
14+
migrations.AddField(
15+
model_name="consent",
16+
name="allows_daily_index_readings",
17+
field=models.BooleanField(
18+
default=False,
19+
verbose_name="allow history of daily index readings in kWh",
20+
),
21+
),
22+
migrations.AddField(
23+
model_name="consent",
24+
name="allows_load_curve",
25+
field=models.BooleanField(
26+
default=False,
27+
verbose_name="allows history of load curve, at steps returned by Enedis",
28+
),
29+
),
30+
migrations.AddField(
31+
model_name="consent",
32+
name="allows_max_daily_power",
33+
field=models.BooleanField(
34+
default=False,
35+
verbose_name="allows historical maximum daily power in kVa or kWh ",
36+
),
37+
),
38+
migrations.AddField(
39+
model_name="consent",
40+
name="allows_measurements",
41+
field=models.BooleanField(
42+
default=False, verbose_name="allows historical measurements in kWh"
43+
),
44+
),
45+
migrations.AddField(
46+
model_name="consent",
47+
name="allows_technical_contractual_data",
48+
field=models.BooleanField(
49+
default=False,
50+
verbose_name="allows the technical and contractual data available",
51+
),
52+
),
53+
migrations.AddField(
54+
model_name="consent",
55+
name="company",
56+
field=models.JSONField(
57+
blank=True,
58+
default=None,
59+
null=True,
60+
validators=[apps.consent.validators.validate_company_schema],
61+
verbose_name="company informations",
62+
),
63+
),
64+
migrations.AddField(
65+
model_name="consent",
66+
name="company_representative",
67+
field=models.JSONField(
68+
blank=True,
69+
default=None,
70+
null=True,
71+
validators=[apps.consent.validators.validate_representative_schema],
72+
verbose_name="company representative informations",
73+
),
74+
),
75+
migrations.AddField(
76+
model_name="consent",
77+
name="control_authority",
78+
field=models.JSONField(
79+
blank=True,
80+
default=None,
81+
null=True,
82+
validators=[apps.consent.validators.validate_control_authority_schema],
83+
verbose_name="control authority informations",
84+
),
85+
),
86+
migrations.AddField(
87+
model_name="consent",
88+
name="is_authoritative_signatory",
89+
field=models.BooleanField(
90+
default=False,
91+
verbose_name="the signatory has the authority to sign this consent",
92+
),
93+
),
94+
migrations.AddField(
95+
model_name="consent",
96+
name="signature_location",
97+
field=models.CharField(
98+
blank=True, max_length=255, null=True, verbose_name="signature location"
99+
),
100+
),
101+
migrations.AddField(
102+
model_name="consent",
103+
name="signed_at",
104+
field=models.DateTimeField(
105+
blank=True, null=True, verbose_name="signature date"
106+
),
107+
),
108+
]

0 commit comments

Comments
 (0)