class Actor(model.Model): first_name = model.TextField() last_name = model.TextField() age = model.IntField(null=True) address = model.RelatedField(Address, null=True) user = model.RelatedField(User, null=True, default=model.session('claims.user_id', 'int')) class Meta: uniques = (('first_name', 'last_name'), ) checks = ('first_name is not null or last_name is not null', )
class Tmpfile(model.Model): key = model.UUIDField(unique=True, default=model.Auto) filename = model.TextField(null=False) initiated = model.DatetimeField(default=model.Auto) class Meta: omit = omit.ALL
class User(model.Model): name = model.TextField() email = model.EmailField(unique=True, null=False) password = model.PasswordField() created = model.DatetimeField(default=Auto) class Meta: app = type('App', (), {'name': 'auth'})
class RegisterInput(model.Type): email = model.EmailField() password = model.PasswordField() password_confirmation = model.PasswordField() token = model.TextField() class Meta: input = True
class Organisation(model.Model): name = model.TextField() entity = model.RelatedField(Entity, related_name='organisations', null=True) # TODO: One-to-one class Meta: policies = (DirectOrganisationMemberPolicy(), )
class Membership(model.Model): user = model.RelatedField(User, related_name='memberships') organisation = model.RelatedField(Organisation, related_name='memberships') role = model.TextField(null=True) active = model.BoolField(default=False) class Meta: # TODO: How to unique only one active per user? Check? uniques = (('user', 'organisation', 'role'), ) policies = (UserPolicy('auth_membership.user'), )
class User(model.Model): name = model.TextField(null=True) email = model.EmailField(null=True, unique=True) password = model.PasswordField(null=True, omit=omit.ALL) logged_out = model.DatetimeField(null=True, omit=omit.ALL) created = model.DatetimeField(default=model.Auto) anonymous = model.BoolField(default=False) entity = model.RelatedField(Entity, related_name='users', null=True) # TODO: One-to-one class Meta: policies = (OwnerPolicy('auth_user.entity'), )
class Store(model.Model): name = model.TextField() parent = model.RelatedField('self') class Meta: mutation_resolvers = [OverrideNameResolver()]
class Movie(model.Model): title = model.TextField(unique=True) star = model.RelatedField(Actor)
class Address(model.Model): country = model.TextField()
class Planet(model.Model): name = model.TextField(null=False) film = model.RelatedField(Film)
class APIToken(model.Model): purpose = model.TextField(null=True)
class DummyModel(model.Model): value = model.TextField()
class User(model.Model): name = model.TextField() email = model.EmailField(unique=True, null=False) password = model.PasswordField()
class Character(model.Model): name = model.TextField(null=False) film = model.RelatedField(Film)
class Film(model.Model): title = model.TextField(null=False)
class JWTType(model.Type): token = model.TextField() user = model.RelatedField(User, null=True) # TODO: Omit reverse relationships organisation = model.RelatedField( Organisation, null=True) # TODO: Omit reverse relationships
class JWTType(model.Type): token = model.TextField()
class RefreshAnonymousUserInput(model.Type): token = model.TextField() class Meta: input = True