Add playtime and end_time columns
parent
849b628130
commit
280e02c15a
|
@ -0,0 +1,31 @@
|
|||
# Generated by Django 5.1.2 on 2024-10-26 00:32
|
||||
|
||||
import datetime
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('api', '0004_remove_playermasteravailability_unique_master_availability_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='playerinfo_team',
|
||||
name='playtime',
|
||||
field=models.DurationField(default=datetime.timedelta(0)),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='playermasteravailability',
|
||||
name='end_time',
|
||||
field=models.DateTimeField(default=datetime.datetime(2024, 10, 26, 0, 32, 4, 805564, tzinfo=datetime.timezone.utc)),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='playerteamavailability',
|
||||
name='end_time',
|
||||
field=models.DateTimeField(default=datetime.datetime(2024, 10, 26, 0, 32, 13, 959511, tzinfo=datetime.timezone.utc)),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -1,3 +1,4 @@
|
|||
from datetime import timedelta
|
||||
from typing import override
|
||||
from django.db import models
|
||||
from cpkmodel import CPkModel
|
||||
|
@ -44,6 +45,7 @@ class PlayerInfo_Team(models.Model):
|
|||
choices=TeamRole.choices,
|
||||
default=TeamRole.PLAYER
|
||||
)
|
||||
playtime = models.DurationField(default=timedelta(0))
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
@override
|
||||
|
@ -88,8 +90,8 @@ class PlayerRole(models.Model):
|
|||
|
||||
class PlayerTeamAvailability(models.Model):
|
||||
player_info_team = models.ForeignKey(PlayerInfo_Team, on_delete=models.CASCADE)
|
||||
date = models.DateField()
|
||||
hour = models.SmallIntegerField()
|
||||
start_time = models.DateTimeField()
|
||||
end_time = models.DateTimeField()
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
|
@ -105,8 +107,8 @@ class PlayerTeamAvailability(models.Model):
|
|||
|
||||
class PlayerMasterAvailability(models.Model):
|
||||
player_info = models.ForeignKey(PlayerInfo, on_delete=models.CASCADE)
|
||||
date = models.DateField()
|
||||
hour = models.SmallIntegerField()
|
||||
start_time = models.DateTimeField()
|
||||
end_time = models.DateTimeField()
|
||||
|
||||
class Meta:
|
||||
constraints = [
|
||||
|
|
Loading…
Reference in New Issue