2025-07-26

This commit is contained in:
2025-07-26 14:52:54 -05:00
parent 55c03bcafb
commit c543c98bf3
28 changed files with 2779 additions and 146 deletions

34
draft/models.py Normal file
View File

@@ -0,0 +1,34 @@
from django.db.models import ForeignKey, Model, IntegerField, BooleanField, CASCADE, PROTECT
from boxofficefantasy.models import Season, User, Movie
from boxofficefantasy_project.utils import encode_id, decode_id
# Create your models here.
class DraftSession(Model):
season = ForeignKey(Season, on_delete=CASCADE)
is_active = BooleanField()
current_nomination_index = IntegerField()
@property
def hashed_id(self):
return f"{encode_id(self.pk)}"
@classmethod
def decode_id(cls, hashed_id:str) -> id:
return decode_id(hashed_id)
class DraftParticipant(Model):
draft = ForeignKey(DraftSession, on_delete=CASCADE)
user = ForeignKey(User, on_delete=CASCADE)
budget = IntegerField()
class DraftMoviePool(Model):
draft = ForeignKey(DraftSession, on_delete=CASCADE)
movie = ForeignKey(Movie, on_delete=CASCADE)
nominated = BooleanField()
class DraftPick(Model):
draft = ForeignKey(DraftSession, on_delete=CASCADE)
movie = ForeignKey(Movie, on_delete=CASCADE)
winner = ForeignKey(User, on_delete=CASCADE)
bid_amount = IntegerField()
nomination_order = IntegerField()