Skip to content

Commit

Permalink
[GENERAL]: Add contracts
Browse files Browse the repository at this point in the history
Fixes #157
  • Loading branch information
StevenHosper committed Dec 18, 2024
1 parent c0b8d92 commit 424f757
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,26 @@ def __str__(self) -> str:
return self.name


class Contract(models.Model):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
organisation = models.ForeignKey(
Organisation, on_delete=models.CASCADE, null=False, unique=True
)
start_date = models.DateTimeField(null=False, blank=False)
end_date = models.DateTimeField()
nr_of_messages = models.BigIntegerField(null=False, blank=False, default=0)
description = models.TextField()
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)

def __str__(self) -> str:
return f"{self.organisation} ({self.start_date} - {self.end_date if self.end_date else 'onbepaald'})"

class Meta:
verbose_name = "Contract"
verbose_name_plural = "Contracts"


class UserProfile(models.Model):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
user = models.OneToOneField(User, on_delete=models.CASCADE)
Expand Down

0 comments on commit 424f757

Please sign in to comment.