Skip to content

Commit

Permalink
🗃️ [#67] added onderwerpobject and bijlage models
Browse files Browse the repository at this point in the history
  • Loading branch information
bart-maykin committed Oct 19, 2023
1 parent bdde749 commit f77beda
Show file tree
Hide file tree
Showing 5 changed files with 253 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# Generated by Django 3.2.18 on 2023-10-19 14:41

from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):
dependencies = [
("klantinteracties", "0001_initial"),
]

operations = [
migrations.RenameField(
model_name="actor",
old_name="identificator_object_id",
new_name="objectidentificator_object_id",
),
migrations.RenameField(
model_name="actor",
old_name="identificator_objecttype",
new_name="objectidentificator_objecttype",
),
migrations.RenameField(
model_name="actor",
old_name="identificator_register",
new_name="objectidentificator_register",
),
migrations.RenameField(
model_name="actor",
old_name="identificator_soort_object_id",
new_name="objectidentificator_soort_object_id",
),
migrations.CreateModel(
name="Onderwerpobject",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"objectidentificator_objecttype",
models.CharField(
help_text="Type van het object, bijvoorbeeld: 'INGESCHREVEN NATUURLIJK PERSOON'.",
max_length=200,
verbose_name="objecttype",
),
),
(
"objectidentificator_soort_object_id",
models.CharField(
help_text="Naam van de eigenschap die het object identificeert, bijvoorbeeld: 'Burgerservicenummer'.",
max_length=200,
verbose_name="soort object id",
),
),
(
"objectidentificator_object_id",
models.CharField(
help_text="Waarde van de eigenschap die het object identificeert, bijvoorbeeld: '123456788'.",
max_length=200,
verbose_name="object id",
),
),
(
"objectidentificator_register",
models.CharField(
help_text="Binnen het landschap van registers unieke omschrijving van het register waarin het object is geregistreerd, bijvoorbeeld: 'BRP'.",
max_length=200,
verbose_name="register",
),
),
(
"uuid",
models.UUIDField(
default=uuid.uuid4,
help_text="Unieke (technische) identificatiecode van het onderwerpdeel.",
unique=True,
),
),
(
"klantcontact",
models.ForeignKey(
help_text="'Klantcontact' ging over 'Onderwerpobject'",
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="klantinteracties.klantcontact",
verbose_name="klantcontact",
),
),
(
"was_klantcontact",
models.ForeignKey(
help_text="'Onderwerpobject' was 'Klantcontact'",
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="was_onderwerpobject",
to="klantinteracties.klantcontact",
verbose_name="was klantcontact",
),
),
],
options={
"verbose_name": "onderwerpobject",
"verbose_name_plural": "onderwerpobjecten",
},
),
migrations.CreateModel(
name="Bijlage",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"objectidentificator_objecttype",
models.CharField(
help_text="Type van het object, bijvoorbeeld: 'INGESCHREVEN NATUURLIJK PERSOON'.",
max_length=200,
verbose_name="objecttype",
),
),
(
"objectidentificator_soort_object_id",
models.CharField(
help_text="Naam van de eigenschap die het object identificeert, bijvoorbeeld: 'Burgerservicenummer'.",
max_length=200,
verbose_name="soort object id",
),
),
(
"objectidentificator_object_id",
models.CharField(
help_text="Waarde van de eigenschap die het object identificeert, bijvoorbeeld: '123456788'.",
max_length=200,
verbose_name="object id",
),
),
(
"objectidentificator_register",
models.CharField(
help_text="Binnen het landschap van registers unieke omschrijving van het register waarin het object is geregistreerd, bijvoorbeeld: 'BRP'.",
max_length=200,
verbose_name="register",
),
),
(
"uuid",
models.UUIDField(
default=uuid.uuid4,
help_text="Unieke (technische) identificatiecode van het inhoudsdeel.",
unique=True,
),
),
(
"klantcontact",
models.ForeignKey(
help_text="'Klantcontact' omvatte 'Bijlage'",
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="klantinteracties.klantcontact",
verbose_name="klantcontact",
),
),
],
options={
"verbose_name": "bijlage",
"verbose_name_plural": "bijlagen",
},
),
]
4 changes: 2 additions & 2 deletions src/openklant/components/klantinteracties/models/actoren.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from django.utils.translation import gettext_lazy as _

from .constants import SoortActor
from .mixins import IdentificatorMixin
from .mixins import ObjectidentificatorMixin


class Actor(IdentificatorMixin):
class Actor(ObjectidentificatorMixin):
uuid = models.UUIDField(
unique=True,
default=uuid.uuid4,
Expand Down
57 changes: 53 additions & 4 deletions src/openklant/components/klantinteracties/models/klantcontacten.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
from .actoren import Actor
from .constants import Klantcontrol
from .digitaal_adres import DigitaalAdres
from .mixins import BezoekAdresMixin, ContactNaamMixin, CorrespondentieAdresMixin
from .mixins import (
BezoekadresMixin,
ContactnaamMixin,
CorrespondentieadresMixin,
ObjectidentificatorMixin,
)


class Klantcontact(models.Model):
Expand All @@ -28,8 +33,6 @@ class Klantcontact(models.Model):
),
blank=False,
)
# TODO: add fk to Onderwerpobject
# TODO: add fk to Inhoudsobject
nummer = models.CharField(
_("nummer"),
help_text=_(
Expand Down Expand Up @@ -95,7 +98,7 @@ class Meta:
verbose_name_plural = _("klantcontacten")


class Betrokkene(BezoekAdresMixin, CorrespondentieAdresMixin, ContactNaamMixin):
class Betrokkene(BezoekadresMixin, CorrespondentieadresMixin, ContactnaamMixin):
uuid = models.UUIDField(
unique=True,
default=uuid.uuid4,
Expand Down Expand Up @@ -139,3 +142,49 @@ class Betrokkene(BezoekAdresMixin, CorrespondentieAdresMixin, ContactNaamMixin):

class Meta:
verbose_name = _("betrokkene bij klantcontact")


class Onderwerpobject(ObjectidentificatorMixin):
uuid = models.UUIDField(
unique=True,
default=uuid.uuid4,
help_text=_("Unieke (technische) identificatiecode van het onderwerpdeel."),
)
klantcontact = models.ForeignKey(
Klantcontact,
on_delete=models.CASCADE,
verbose_name=_("klantcontact"),
help_text=_("'Klantcontact' ging over 'Onderwerpobject'"),
null=True,
)
was_klantcontact = models.ForeignKey(
Klantcontact,
on_delete=models.CASCADE,
verbose_name=_("was klantcontact"),
related_name="was_onderwerpobject",
help_text=_("'Onderwerpobject' was 'Klantcontact'"),
null=True,
)

class Meta:
verbose_name = _("onderwerpobject")
verbose_name_plural = _("onderwerpobjecten")


class Bijlage(ObjectidentificatorMixin):
uuid = models.UUIDField(
unique=True,
default=uuid.uuid4,
help_text=_("Unieke (technische) identificatiecode van het inhoudsdeel."),
)
klantcontact = models.ForeignKey(
Klantcontact,
on_delete=models.CASCADE,
verbose_name=_("klantcontact"),
help_text=_("'Klantcontact' omvatte 'Bijlage'"),
null=True,
)

class Meta:
verbose_name = _("bijlage")
verbose_name_plural = _("bijlagen")
26 changes: 13 additions & 13 deletions src/openklant/components/klantinteracties/models/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from vng_api_common.descriptors import GegevensGroepType


class BezoekAdresMixin(models.Model):
class BezoekadresMixin(models.Model):
# TODO: Check if this is correct.
bezoekadres_nummeraanduiding_id = models.CharField(
_("nummeraanduiding id"),
Expand Down Expand Up @@ -67,7 +67,7 @@ class Meta:
abstract = True


class CorrespondentieAdresMixin(models.Model):
class CorrespondentieadresMixin(models.Model):
# TODO: Check if this is correct.
correspondentieadres_nummeraanduiding_id = models.CharField(
_("nummeraanduiding ID"),
Expand Down Expand Up @@ -129,7 +129,7 @@ class Meta:
abstract = True


class ContactNaamMixin(models.Model):
class ContactnaamMixin(models.Model):
contactnaam_voorletters = models.CharField(
_("voorletters"),
help_text=_(
Expand Down Expand Up @@ -177,32 +177,32 @@ class Meta:
abstract = True


class IdentificatorMixin(models.Model):
identificator_objecttype = models.CharField(
class ObjectidentificatorMixin(models.Model):
objectidentificator_objecttype = models.CharField(
_("objecttype"),
help_text=_(
"Type van het object, bijvoorbeeld: 'INGESCHREVEN NATUURLIJK PERSOON'."
),
max_length=200,
blank=False,
)
identificator_soort_object_id = models.CharField(
objectidentificator_soort_object_id = models.CharField(
_("soort object id"),
help_text=_(
"Naam van de eigenschap die het object identificeert, bijvoorbeeld: 'Burgerservicenummer'."
),
max_length=200,
blank=False,
)
identificator_object_id = models.CharField(
objectidentificator_object_id = models.CharField(
_("object id"),
help_text=_(
"Waarde van de eigenschap die het object identificeert, bijvoorbeeld: '123456788'."
),
max_length=200,
blank=False,
)
identificator_register = models.CharField(
objectidentificator_register = models.CharField(
_("register"),
help_text=_(
"Binnen het landschap van registers unieke omschrijving van het register waarin "
Expand All @@ -212,12 +212,12 @@ class IdentificatorMixin(models.Model):
blank=False,
)

identificator = GegevensGroepType(
objectidentificator = GegevensGroepType(
{
"objecttype": identificator_objecttype,
"soort_object_id": identificator_soort_object_id,
"object_id": identificator_object_id,
"register": identificator_register,
"objecttype": objectidentificator_objecttype,
"soort_object_id": objectidentificator_soort_object_id,
"object_id": objectidentificator_object_id,
"register": objectidentificator_register,
}
)

Expand Down
8 changes: 4 additions & 4 deletions src/openklant/components/klantinteracties/models/partijen.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from .constants import SoortPartij
from .digitaal_adres import DigitaalAdres
from .klantcontacten import Betrokkene
from .mixins import BezoekAdresMixin, ContactNaamMixin, CorrespondentieAdresMixin
from .mixins import BezoekadresMixin, ContactnaamMixin, CorrespondentieadresMixin


class Partij(BezoekAdresMixin, CorrespondentieAdresMixin):
class Partij(BezoekadresMixin, CorrespondentieadresMixin):
uuid = models.UUIDField(
unique=True,
default=uuid.uuid4,
Expand Down Expand Up @@ -119,7 +119,7 @@ def __str__(self) -> str:
return self.naam


class Persoon(ContactNaamMixin):
class Persoon(ContactnaamMixin):
partij = models.ForeignKey(
Partij,
on_delete=models.CASCADE,
Expand All @@ -135,7 +135,7 @@ def __str__(self) -> str:
return self.contactnaam_voorletters


class Contactpersoon(ContactNaamMixin):
class Contactpersoon(ContactnaamMixin):
partij = models.ForeignKey(
Partij,
on_delete=models.CASCADE,
Expand Down

0 comments on commit f77beda

Please sign in to comment.