Django 6 + DRF resource server against the Gooyal accounts OAuth2 service, matching the Winsoo ecosystem's conventions. Covers locations, stores, catalog, cart, checkout/orders (with the multi-store-cart split and the status stepper), reviews, and notifications, plus a demo-data seed command. Payment integration (wallet debits, online gateway, seller payouts) is intentionally left out here — see feature/payment. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
# models
|
|
import uuid
|
|
from django.db import models
|
|
from oauth2_provider.models import AbstractApplication, AbstractAccessToken, AbstractGrant, AbstractRefreshToken, \
|
|
AbstractIDToken
|
|
|
|
|
|
class AccessToken(AbstractAccessToken):
|
|
id = None
|
|
uuid = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4, unique=True, db_index=True)
|
|
detail = models.JSONField(null=True, blank=True)
|
|
client_id = models.CharField(max_length=255, null=True, blank=True)
|
|
client_owner = models.ForeignKey('users.User', on_delete=models.PROTECT, null=True, blank=True)
|
|
|
|
class Meta:
|
|
abstract = False
|
|
|
|
|
|
class Application(AbstractApplication):
|
|
id = None
|
|
uuid = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4, unique=True, db_index=True)
|
|
|
|
class Meta:
|
|
abstract = False
|
|
|
|
|
|
class Grant(AbstractGrant):
|
|
id = None
|
|
uuid = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4, unique=True, db_index=True)
|
|
|
|
class Meta:
|
|
abstract = False
|
|
|
|
|
|
class RefreshToken(AbstractRefreshToken):
|
|
id = None
|
|
uuid = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4, unique=True, db_index=True)
|
|
|
|
class Meta:
|
|
abstract = False
|
|
|
|
|
|
class IDToken(AbstractIDToken):
|
|
id = None
|
|
uuid = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4, unique=True, db_index=True)
|
|
|
|
class Meta:
|
|
abstract = False
|