robosats/chat/models.py

43 lines
1.2 KiB
Python
Raw Normal View History

2022-01-13 11:07:20 +00:00
from django.db import models
2022-03-10 21:35:16 +00:00
from api.models import User, Order
2022-01-13 11:07:20 +00:00
2022-03-10 21:35:16 +00:00
class ChatRoom(models.Model):
'''
Simple ChatRoom model. Needed to facilitate communication: Is my counterpart in the room?
'''
id = models.PositiveBigIntegerField(primary_key=True, null=False,default=None, blank=True)
order = models.ForeignKey(
Order,
related_name="order",
on_delete=models.SET_NULL,
null=True,
default=None)
maker = models.ForeignKey(
User,
related_name="chat_maker",
on_delete=models.SET_NULL,
null=True,
default=None)
taker = models.ForeignKey(
User,
related_name="chat_taker",
on_delete=models.SET_NULL,
null=True,
default=None,
blank=True,
)
maker_connected = models.BooleanField(default=False, null=False)
taker_connected = models.BooleanField(default=False, null=False)
maker_connect_date = models.DateTimeField(auto_now_add=True)
taker_connect_date = models.DateTimeField(auto_now_add=True)
room_group_name = models.CharField(
max_length=50,
null=True,
default=None,
blank=True,
)