# API model extension
* adds model ExternalIdentifier to support linking between external ids and internal ids
This commit is contained in:
@@ -5,4 +5,5 @@ Contact: michel.peltriaux@sgdnord.rlp.de
|
||||
Created on: 21.01.22
|
||||
|
||||
"""
|
||||
from .token import *
|
||||
from .token import *
|
||||
from .external_identifier import *
|
||||
33
api/models/external_identifier.py
Normal file
33
api/models/external_identifier.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Created on: 10.05.26
|
||||
|
||||
"""
|
||||
from django.db import models
|
||||
|
||||
|
||||
class ExternalIdentifier(models.Model):
|
||||
""" Holds a lookup to match a given external identifier against the internal identifier in konova.
|
||||
|
||||
Relevant in cases of API transmitted entries, which are updates using external identifiers instead of
|
||||
the internal ones directly.
|
||||
|
||||
"""
|
||||
external_id = models.CharField(
|
||||
max_length=255,
|
||||
primary_key=True,
|
||||
db_comment="Identifier from a source system"
|
||||
)
|
||||
internal_id = models.UUIDField(
|
||||
db_comment="Identifier in konova"
|
||||
)
|
||||
created = models.ForeignKey(
|
||||
"user.UserActionLogEntry",
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
related_name='+'
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.external_id} -> {self.internal_id}"
|
||||
Reference in New Issue
Block a user