#31 API basic implementation

* adds new app to project
* adds relation between User model and new APIUserToken model
* adds first implementation for GET of intervention
* adds basic code layout for future extension by having new versions
This commit is contained in:
2022-01-21 15:26:08 +01:00
parent d8b503f2b5
commit 134651c8f7
20 changed files with 314 additions and 0 deletions

8
api/models/__init__.py Normal file
View File

@@ -0,0 +1,8 @@
"""
Author: Michel Peltriaux
Organization: Struktur- und Genehmigungsdirektion Nord, Rhineland-Palatinate, Germany
Contact: michel.peltriaux@sgdnord.rlp.de
Created on: 21.01.22
"""
from .token import *

23
api/models/token.py Normal file
View File

@@ -0,0 +1,23 @@
from django.db import models
from konova.utils.generators import generate_token
class APIUserToken(models.Model):
token = models.CharField(
primary_key=True,
max_length=1000,
default=generate_token,
)
valid_until = models.DateField(
blank=True,
null=True,
help_text="Token is only valid until this date",
)
is_active = models.BooleanField(
default=False,
help_text="Must be activated by an admin"
)
def __str__(self):
return self.token