mirror of
https://github.com/barkeser2002/offline-db.git
synced 2026-09-25 00:59:54 +03:00
- Initialized 'aniscrap_core' project. - Implemented 'users', 'content', 'billing', 'scraper_module', 'core' apps. - Added models for Anime, Episode, VideoFile (HLS/Encrypted), User, Wallet, etc. - Implemented Celery tasks for Video Encoding (H.265/HLS) and Revenue Distribution. - Integrated Shopier mock payment flow. - Configured Unfold Admin Dashboard. - Refactored Jikan scraper client. - Added 'init_aniscrap' management command. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
from django.db import models
|
|
from django.conf import settings
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
class SubscriptionPlan(models.Model):
|
|
name = models.CharField(max_length=100)
|
|
price = models.DecimalField(max_digits=6, decimal_places=2)
|
|
duration_days = models.PositiveIntegerField(default=30)
|
|
|
|
def __str__(self):
|
|
return f"{self.name} ({self.price})"
|
|
|
|
class ShopierPayment(models.Model):
|
|
STATUS_CHOICES = (
|
|
('pending', 'Pending'),
|
|
('success', 'Success'),
|
|
('failed', 'Failed'),
|
|
)
|
|
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name='payments')
|
|
plan = models.ForeignKey(SubscriptionPlan, on_delete=models.SET_NULL, null=True)
|
|
amount = models.DecimalField(max_digits=10, decimal_places=2)
|
|
transaction_id = models.CharField(max_length=100, unique=True)
|
|
status = models.CharField(max_length=10, choices=STATUS_CHOICES, default='pending')
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
processed_at = models.DateTimeField(null=True, blank=True)
|
|
is_distributed = models.BooleanField(default=False)
|
|
|
|
def __str__(self):
|
|
return f"{self.user} - {self.amount} - {self.status}"
|