2023-09-26 07:15:28 +00:00
|
|
|
from django.db import models
|
2023-09-28 09:01:14 +00:00
|
|
|
from django.contrib.auth.models import User as DjangoUser
|
2023-09-26 07:15:28 +00:00
|
|
|
|
2023-09-28 09:01:14 +00:00
|
|
|
|
2023-10-03 03:47:00 +00:00
|
|
|
class AppUser(models.Model):
|
2023-09-28 09:01:14 +00:00
|
|
|
# Ya incluye "first_name", "last_name", "email", y "date_joined" heredando de la clase User de django.
|
|
|
|
# Falta ver que más información hay que añadir a nuestros usuarios, como los roles etc.
|
2023-10-03 03:47:00 +00:00
|
|
|
django_user = models.OneToOneField(DjangoUser, on_delete=models.CASCADE)
|
|
|
|
|
|
|
|
# Extra data, segun entidad/organizacion
|
2023-09-28 09:01:14 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class Event(models.Model):
|
|
|
|
# Para los "audit logs" que se requieren en las pantallas.
|
|
|
|
timestamp = models.DateTimeField()
|
|
|
|
kind = "PLACEHOLDER"
|
|
|
|
|
|
|
|
|
2023-10-03 03:47:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ExternallyStoredModel(models.Model):
|
|
|
|
pass
|
|
|
|
|
|
|
|
# Any models which inherit from this class are stored in wallet-kit, not in the Django ORM
|
|
|
|
class Meta:
|
|
|
|
abstract = True
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def from_json(json_serialization):
|
|
|
|
# Construct an instance of this class by de-serialization from data returned by wallet-kit.
|
|
|
|
# Must be implemented by any deriving class.
|
|
|
|
raise NotImplementedError()
|
|
|
|
|
|
|
|
|
|
|
|
class DID(ExternallyStoredModel):
|
2023-09-28 09:01:14 +00:00
|
|
|
did_string = models.CharField(max_length=250)
|
|
|
|
# kind = "KEY|JWK|WEB|EBSI|CHEQD|IOTA"
|
|
|
|
|
|
|
|
|
2023-10-03 03:47:00 +00:00
|
|
|
class VerifiableCredential(ExternallyStoredModel):
|
2023-09-28 09:01:14 +00:00
|
|
|
id_string = models.CharField(max_length=250)
|
|
|
|
data = models.TextField()
|
|
|
|
verified = models.BooleanField()
|
|
|
|
created_on = models.DateTimeField()
|
2023-10-03 03:47:00 +00:00
|
|
|
did_issuer = models.CharField(max_length=250) # Probably not a FK but the DID directly
|
|
|
|
did_subject = models.CharField(max_length=250) # Probably not a FK but the DID directly
|