Implement Manticore fully and re-theme

This commit is contained in:
2026-03-11 02:19:08 +00:00
parent da044be68c
commit cbedcd67f6
46 changed files with 3444 additions and 944 deletions

View File

@@ -82,6 +82,7 @@ class User(AbstractUser):
customer_id = models.UUIDField(default=uuid.uuid4, null=True, blank=True)
billing_provider_id = models.CharField(max_length=255, null=True, blank=True)
email = models.EmailField(unique=True)
allow_contacts_to_create_tasks = models.BooleanField(default=True)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@@ -397,6 +398,9 @@ class ConversationEvent(models.Model):
("read_receipt", "Read Receipt"),
("typing_started", "Typing Started"),
("typing_stopped", "Typing Stopped"),
("composing_abandoned", "Composing Abandoned"),
("presence_available", "Presence Available"),
("presence_unavailable", "Presence Unavailable"),
("participant_added", "Participant Added"),
("participant_removed", "Participant Removed"),
("delivery_receipt", "Delivery Receipt"),
@@ -2759,108 +2763,6 @@ class ContactAvailabilitySettings(models.Model):
updated_at = models.DateTimeField(auto_now=True)
class ContactAvailabilityEvent(models.Model):
SOURCE_KIND_CHOICES = (
("native_presence", "Native Presence"),
("read_receipt", "Read Receipt"),
("typing_start", "Typing Start"),
("typing_stop", "Typing Stop"),
("message_in", "Message In"),
("message_out", "Message Out"),
("inferred_timeout", "Inferred Timeout"),
)
STATE_CHOICES = (
("available", "Available"),
("unavailable", "Unavailable"),
("unknown", "Unknown"),
("fading", "Fading"),
)
user = models.ForeignKey(
User,
on_delete=models.CASCADE,
related_name="contact_availability_events",
)
person = models.ForeignKey(
Person,
on_delete=models.CASCADE,
related_name="availability_events",
)
person_identifier = models.ForeignKey(
PersonIdentifier,
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="availability_events",
)
service = models.CharField(max_length=255, choices=CHANNEL_SERVICE_CHOICES)
source_kind = models.CharField(max_length=32, choices=SOURCE_KIND_CHOICES)
availability_state = models.CharField(max_length=32, choices=STATE_CHOICES)
confidence = models.FloatField(default=0.0)
ts = models.BigIntegerField(db_index=True)
payload = models.JSONField(default=dict, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
class Meta:
indexes = [
models.Index(fields=["user", "person", "ts"]),
models.Index(fields=["user", "service", "ts"]),
models.Index(fields=["user", "availability_state", "ts"]),
]
class ContactAvailabilitySpan(models.Model):
STATE_CHOICES = ContactAvailabilityEvent.STATE_CHOICES
user = models.ForeignKey(
User,
on_delete=models.CASCADE,
related_name="contact_availability_spans",
)
person = models.ForeignKey(
Person,
on_delete=models.CASCADE,
related_name="availability_spans",
)
person_identifier = models.ForeignKey(
PersonIdentifier,
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="availability_spans",
)
service = models.CharField(max_length=255, choices=CHANNEL_SERVICE_CHOICES)
state = models.CharField(max_length=32, choices=STATE_CHOICES)
start_ts = models.BigIntegerField(db_index=True)
end_ts = models.BigIntegerField(db_index=True)
confidence_start = models.FloatField(default=0.0)
confidence_end = models.FloatField(default=0.0)
opening_event = models.ForeignKey(
ContactAvailabilityEvent,
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="opening_spans",
)
closing_event = models.ForeignKey(
ContactAvailabilityEvent,
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="closing_spans",
)
payload = models.JSONField(default=dict, blank=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
indexes = [
models.Index(fields=["user", "person", "start_ts"]),
models.Index(fields=["user", "person", "end_ts"]),
models.Index(fields=["user", "service", "start_ts"]),
]
class ExternalChatLink(models.Model):
user = models.ForeignKey(
User,