2026-03-15 00:29:17 +05:30
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
|
|
PARTNER_TYPE_CHOICES = (
|
|
|
|
|
('venue', 'Venue'),
|
|
|
|
|
('promoter', 'Promoter'),
|
|
|
|
|
('sponsor', 'Sponsor'),
|
|
|
|
|
('vendor', 'Vendor'),
|
|
|
|
|
('affiliate', 'Affiliate'),
|
|
|
|
|
('other', 'Other'),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
KYC_DOCUMENT_TYPE_CHOICES = (
|
|
|
|
|
('aadhaar', 'Aadhaar'),
|
|
|
|
|
('pan', 'PAN'),
|
|
|
|
|
('driving_license', 'Driving License'),
|
|
|
|
|
('voter_id', 'Voter ID'),
|
|
|
|
|
('passport', 'Passport'),
|
|
|
|
|
('other', 'Other'),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
KYC_COMPLIANCE_STATUS_CHOICES = (
|
|
|
|
|
('pending', 'Pending'),
|
|
|
|
|
('approved', 'Approved'),
|
|
|
|
|
('rejected', 'Rejected'),
|
|
|
|
|
('high_risk', 'High Risk'),
|
|
|
|
|
('low_risk', 'Low Risk'),
|
|
|
|
|
('medium_risk', 'Medium Risk'),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
STATUS_CHOICES = (
|
|
|
|
|
('active', 'Active'),
|
|
|
|
|
('inactive', 'Inactive'),
|
|
|
|
|
('pending', 'Pending'),
|
|
|
|
|
('suspended', 'Suspended'),
|
|
|
|
|
('deleted', 'Deleted'),
|
|
|
|
|
('archived', 'Archived'),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Partner(models.Model):
|
|
|
|
|
name = models.CharField(max_length=250)
|
|
|
|
|
partner_type = models.CharField(max_length=250, choices=PARTNER_TYPE_CHOICES)
|
|
|
|
|
|
|
|
|
|
primary_contact_person_name = models.CharField(max_length=250)
|
|
|
|
|
primary_contact_person_email = models.EmailField()
|
|
|
|
|
primary_contact_person_phone = models.CharField(max_length=15)
|
|
|
|
|
|
feat: Phase 1+2 - JWT auth, dashboard metrics API, DB indexes
Phase 1 - JWT Auth Foundation:
- Replace token auth with djangorestframework-simplejwt
- POST /api/v1/admin/auth/login/ - returns access + refresh JWT
- POST /api/v1/auth/refresh/ - JWT refresh
- GET /api/v1/auth/me/ - current admin profile
- GET /api/v1/health/ - DB health check
- Add ledger app to INSTALLED_APPS
Phase 2 - Dashboard Metrics API:
- GET /api/v1/dashboard/metrics/ - revenue, partners, events, tickets
- GET /api/v1/dashboard/revenue/ - 7-day revenue vs payouts chart data
- GET /api/v1/dashboard/activity/ - last 10 platform events feed
- GET /api/v1/dashboard/actions/ - KYC queue, flagged events, pending payouts
DB Indexes (dashboard query optimisation):
- RazorpayTransaction: status, captured_at
- Partner: status, kyc_compliance_status
- Event: event_status, start_date, created_date
- Booking: created_date
- PaymentTransaction: payment_type, payment_transaction_status, payment_transaction_date
Infra:
- Add Dockerfile for eventify-backend container
- Add simplejwt to requirements.txt
- All 4 dashboard views use IsAuthenticated permission class
2026-03-24 17:46:41 +00:00
|
|
|
status = models.CharField(max_length=250, choices=STATUS_CHOICES, default='active', db_index=True)
|
2026-03-15 00:29:17 +05:30
|
|
|
|
|
|
|
|
address = models.TextField(blank=True, null=True)
|
|
|
|
|
city = models.CharField(max_length=250, blank=True, null=True)
|
|
|
|
|
state = models.CharField(max_length=250, blank=True, null=True)
|
|
|
|
|
country = models.CharField(max_length=250, blank=True, null=True)
|
|
|
|
|
website_url = models.URLField(blank=True, null=True)
|
|
|
|
|
|
|
|
|
|
pincode = models.CharField(max_length=10, blank=True, null=True)
|
|
|
|
|
latitude = models.DecimalField(max_digits=9, decimal_places=6, blank=True, null=True)
|
|
|
|
|
longitude = models.DecimalField(max_digits=9, decimal_places=6, blank=True, null=True)
|
|
|
|
|
|
|
|
|
|
is_kyc_compliant = models.BooleanField(default=False)
|
feat: Phase 1+2 - JWT auth, dashboard metrics API, DB indexes
Phase 1 - JWT Auth Foundation:
- Replace token auth with djangorestframework-simplejwt
- POST /api/v1/admin/auth/login/ - returns access + refresh JWT
- POST /api/v1/auth/refresh/ - JWT refresh
- GET /api/v1/auth/me/ - current admin profile
- GET /api/v1/health/ - DB health check
- Add ledger app to INSTALLED_APPS
Phase 2 - Dashboard Metrics API:
- GET /api/v1/dashboard/metrics/ - revenue, partners, events, tickets
- GET /api/v1/dashboard/revenue/ - 7-day revenue vs payouts chart data
- GET /api/v1/dashboard/activity/ - last 10 platform events feed
- GET /api/v1/dashboard/actions/ - KYC queue, flagged events, pending payouts
DB Indexes (dashboard query optimisation):
- RazorpayTransaction: status, captured_at
- Partner: status, kyc_compliance_status
- Event: event_status, start_date, created_date
- Booking: created_date
- PaymentTransaction: payment_type, payment_transaction_status, payment_transaction_date
Infra:
- Add Dockerfile for eventify-backend container
- Add simplejwt to requirements.txt
- All 4 dashboard views use IsAuthenticated permission class
2026-03-24 17:46:41 +00:00
|
|
|
kyc_compliance_status = models.CharField(max_length=250, choices=KYC_COMPLIANCE_STATUS_CHOICES, default='pending', db_index=True)
|
2026-03-15 00:29:17 +05:30
|
|
|
kyc_compliance_reason = models.TextField(blank=True, null=True)
|
|
|
|
|
kyc_compliance_document_type = models.CharField(max_length=250, choices=KYC_DOCUMENT_TYPE_CHOICES, blank=True, null=True)
|
|
|
|
|
kyc_compliance_document_other_type = models.CharField(max_length=250, blank=True, null=True)
|
|
|
|
|
kyc_compliance_document_file = models.FileField(upload_to='kyc_documents/', blank=True, null=True)
|
|
|
|
|
kyc_compliance_document_number = models.CharField(max_length=250, blank=True, null=True)
|
|
|
|
|
|
feat(partner-portal): Sprint 1 — partner-me settings endpoints
Add 4 self-service endpoints under /api/v1/partners/me/:
- GET/PUT /partners/me/profile/ → name, email, phone, website, bio
- GET/PUT /partners/me/notifications/ → 4 boolean notification prefs
- GET/PUT /partners/me/payout/ → bank account + payout schedule
- POST /partners/me/change-password/ → current+new password change
Model changes (partner/models.py + migration 0002):
- Partner.bio TextField
- Partner.payout_* fields (holder name, account number, IFSC, bank name, schedule)
- Partner.notif_* boolean fields (new_booking, event_status, payout_update, weekly_report)
Auth: simplejwt Bearer token (same as all admin_api views).
Role guard: _require_partner() enforces partner/partner_manager/partner_staff
and verifies user.partner FK is non-null.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 11:02:34 +05:30
|
|
|
# Profile extras
|
|
|
|
|
bio = models.TextField(blank=True, null=True)
|
|
|
|
|
|
|
|
|
|
# Payout settings
|
|
|
|
|
PAYOUT_SCHEDULE_CHOICES = (
|
|
|
|
|
('weekly', 'Weekly'),
|
|
|
|
|
('biweekly', 'Bi-weekly'),
|
|
|
|
|
('monthly', 'Monthly'),
|
|
|
|
|
)
|
|
|
|
|
payout_account_holder_name = models.CharField(max_length=250, blank=True, null=True)
|
|
|
|
|
payout_account_number = models.CharField(max_length=50, blank=True, null=True)
|
|
|
|
|
payout_ifsc_code = models.CharField(max_length=20, blank=True, null=True)
|
|
|
|
|
payout_bank_name = models.CharField(max_length=250, blank=True, null=True)
|
|
|
|
|
payout_schedule = models.CharField(
|
|
|
|
|
max_length=20, choices=PAYOUT_SCHEDULE_CHOICES, default='monthly'
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Notification preferences
|
|
|
|
|
notif_new_booking = models.BooleanField(default=True)
|
|
|
|
|
notif_event_status = models.BooleanField(default=True)
|
|
|
|
|
notif_payout_update = models.BooleanField(default=True)
|
|
|
|
|
notif_weekly_report = models.BooleanField(default=False)
|
|
|
|
|
|
2026-03-15 00:29:17 +05:30
|
|
|
def __str__(self):
|
|
|
|
|
return self.name
|