✨ Dont show inactive users in register view
This commit is contained in:
1 parent
46c52b7618
commit
350d31d8d8
8 files changed
+221
-68
No files matched your search
+2
-16
@@ -1,27 +1,13 @@
|
||||
import strawberry
|
||||
import strawberry_django
|
||||
from strawberry_django import auto
|
||||
|
||||
from main import models
|
||||
|
||||
|
||||
@strawberry_django.filters.filter(models.Product)
|
||||
class ProductFilter:
|
||||
id: auto
|
||||
active: auto
|
||||
|
||||
|
||||
@strawberry_django.type(models.Product, filters=ProductFilter)
|
||||
class Product:
|
||||
id: auto
|
||||
name: auto
|
||||
sale_price_int: auto
|
||||
sale_price_ext: auto
|
||||
from main.api.types import Product, User
|
||||
|
||||
|
||||
@strawberry.type
|
||||
class Query:
|
||||
all_products: list[Product] = strawberry_django.field()
|
||||
all_users: list[User] = strawberry_django.field()
|
||||
|
||||
|
||||
schema = strawberry.Schema(query=Query)
|
||||
@@ -0,0 +1,44 @@
|
||||
from datetime import datetime
|
||||
|
||||
import strawberry
|
||||
import strawberry_django
|
||||
from django.contrib.auth import get_user_model
|
||||
from strawberry_django import auto
|
||||
|
||||
from main import models
|
||||
|
||||
UserModel = get_user_model()
|
||||
|
||||
|
||||
@strawberry_django.filters.filter(models.Product)
|
||||
class ProductFilter:
|
||||
id: auto
|
||||
active: auto
|
||||
|
||||
|
||||
@strawberry_django.type(models.Product, filters=ProductFilter)
|
||||
class Product:
|
||||
id: auto
|
||||
name: auto
|
||||
sale_price_int: auto
|
||||
sale_price_ext: auto
|
||||
|
||||
|
||||
@strawberry_django.type(models.UserProfile)
|
||||
class UserProfile:
|
||||
id: auto
|
||||
balance: auto
|
||||
image: auto
|
||||
|
||||
@strawberry.field()
|
||||
def last_purchase_date(self) -> datetime:
|
||||
return self.last_purchase_date()
|
||||
|
||||
|
||||
@strawberry_django.type(UserModel)
|
||||
class User:
|
||||
id: auto
|
||||
first_name: auto
|
||||
last_name: auto
|
||||
profile: UserProfile
|
||||
# todo
|
||||
Reference in new issue
Block a user