2024-12-19 21:01:18 +01:00
|
|
|
from django.db import models
|
|
|
|
|
2024-12-20 10:17:10 +01:00
|
|
|
|
|
|
|
class Game(models.Model):
|
|
|
|
name = models.CharField(max_length=255)
|
|
|
|
friendly_name = models.CharField(max_length=255)
|
|
|
|
# command_line = models.CharField(max_length=255)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.friendly_name
|
|
|
|
|
|
|
|
|
2024-12-19 21:01:18 +01:00
|
|
|
class Server(models.Model):
|
2024-12-20 10:17:10 +01:00
|
|
|
game = models.ForeignKey(Game, on_delete=models.CASCADE)
|
|
|
|
port = models.IntegerField()
|
|
|
|
game_type = models.CharField(max_length=255)
|
|
|
|
mod = models.ForeignKey('Mod', on_delete=models.CASCADE)
|
|
|
|
players = models.ManyToManyField('Player')
|
|
|
|
# spawned_at_utc = models.DateTimeField(auto_now_add=True)
|
|
|
|
# last_collection_utc = models.DateTimeField(null=True, blank=True)
|
|
|
|
# last_heartbeat_utc = models.DateTimeField()
|
|
|
|
# process_id = models.IntegerField()
|
|
|
|
# port = models.IntegerField()
|
|
|
|
# is_started = models.BooleanField()
|
|
|
|
# is_private = models.BooleanField()
|
|
|
|
# current_players = models.IntegerField()
|
|
|
|
# maximum_players = models.IntegerField()
|
|
|
|
|
|
|
|
|
|
|
|
class Player(models.Model):
|
|
|
|
name = models.CharField(max_length=255)
|
|
|
|
score = models.IntegerField()
|
|
|
|
|
|
|
|
class Mod(models.Model):
|
|
|
|
name = models.CharField(max_length=255)
|
|
|
|
friendly_name = models.CharField(max_length=255)
|
|
|
|
# command_line = models.CharField(max_length=255)
|
|
|
|
|
|
|
|
# class SpawnedServerInfo(models.Model):
|
|
|
|
# process_id = models.IntegerField()
|
|
|
|
# port = models.IntegerField()
|
|
|
|
# mod = models.ForeignKey('Mod', on_delete=models.CASCADE)
|
|
|
|
|
|
|
|
# class StateResponse(models.Model):
|
|
|
|
# servers = models.ManyToManyField('Server')
|
|
|
|
# man_minutes_played = models.IntegerField()
|
|
|
|
# running_since_utc = models.DateTimeField()
|
|
|
|
|
|
|
|
# class State(models.Model):
|
|
|
|
# servers = models.ManyToManyField('Server')
|
|
|
|
# created_at_utc = models.DateTimeField(auto_now_add=True)
|
|
|
|
# playtime = models.DurationField(default='00:00:00')
|
|
|
|
|
|
|
|
# def increase_playtime(self, time_to_add):
|
|
|
|
# self.playtime += time_to_add
|