* dev: init github importer * dev: add endpoint for creating import * dev: create endpoint to bulk create issues * dev: bulk issue importer * dev: bulk create endpoints for labels and updates in issue bulk create endpoint to create labels and links * dev: add comments in bluk create * dev: status import endpoint and user invitaion workflow * dev: initiate github repo sync * dev: bulk issue sync endpoint and fix key issue in bg task * dev: update endpoints for service imports * dev: update labels logic * dev: update importer task * dev: bulk issue activities * dev: update importer task for mapped users * dev: update importer endpoint to send github token * dev: update bulk import endpoint * fix: workspace get query * dev: update bulk import endpoints
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
# Django imports
|
|
from django.db import models
|
|
from django.conf import settings
|
|
|
|
# Module imports
|
|
from . import ProjectBaseModel
|
|
|
|
|
|
class Importer(ProjectBaseModel):
|
|
service = models.CharField(max_length=50, choices=(("github", "GitHub"),))
|
|
status = models.CharField(
|
|
max_length=50,
|
|
choices=(
|
|
("queued", "Queued"),
|
|
("processing", "Processing"),
|
|
("completed", "Completed"),
|
|
("failed", "Failed"),
|
|
),
|
|
default="queued",
|
|
)
|
|
initiated_by = models.ForeignKey(
|
|
settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="imports"
|
|
)
|
|
metadata = models.JSONField(default=dict)
|
|
config = models.JSONField(default=dict)
|
|
data = models.JSONField(default=dict)
|
|
token = models.ForeignKey(
|
|
"db.APIToken", on_delete=models.CASCADE, related_name="importer"
|
|
)
|
|
|
|
class Meta:
|
|
verbose_name = "Importer"
|
|
verbose_name_plural = "Importers"
|
|
db_table = "importers"
|
|
ordering = ("-created_at",)
|
|
|
|
def __str__(self):
|
|
"""Return name of the service"""
|
|
return f"{self.service} <{self.project.name}>"
|