from django.db import models from oauth2_provider.models import get_application_model from apps.users.models import User Application = get_application_model() class Invoke(models.Model): caller_application = models.ForeignKey(to=Application, on_delete=models.PROTECT) callee_application = models.CharField(to=Application, on_delete=models.PROTECT) caller_user = models.ForeignKey(to=User, on_delete=models.PROTECT) cost = models.DecimalField() created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) # TODO: move to external model request = models.JSONField() response = models.JSONField()