20 lines
838 B
Python
Executable File
20 lines
838 B
Python
Executable File
from django.db import models
|
|
from django.utils import timezone
|
|
|
|
from fwd_api.constant.common import EntityStatus
|
|
from fwd_api.models import UserProfile
|
|
from fwd_api.models.PricingPlan import PricingPlan
|
|
|
|
|
|
class Subscription(models.Model):
|
|
id = models.AutoField(primary_key=True)
|
|
current_token: int = models.IntegerField(default=0)
|
|
limit_token: int = models.IntegerField(default=0)
|
|
pricing_plan = models.ForeignKey(PricingPlan, on_delete=models.CASCADE)
|
|
user = models.ForeignKey(UserProfile, on_delete=models.CASCADE)
|
|
status = models.IntegerField(default=EntityStatus.INACTIVE.value)
|
|
start_at = models.DateTimeField(default=timezone.now)
|
|
expired_at = models.DateTimeField(default=timezone.now)
|
|
created_at = models.DateTimeField(default=timezone.now)
|
|
updated_at = models.DateTimeField(auto_now=True)
|