class PrimaryKey(Base, PrimaryKeyBase): pass class PrimaryKeyGenerator(PrimaryKeyGeneratorBase): PRIMARY_KEY: Type = PrimaryKey QUERY_CLASSES: Set[Type] = { Issue, IssueInstance, IssueInstanceFixInfo, SharedText, Run, TraceFrame, TraceFrameAnnotation, } def create(db: DB): try: Base.metadata.create_all(db.engine) except NoSuchTableError: pass convert_sqlalchemy_type.register(SourceLocationType)(convert_column_to_string) convert_sqlalchemy_type.register(BIGDBIDType)(convert_column_to_int_or_id)
CreateGaugeVoteSpecification, UpdateGaugeVoteSpecification, CreateNumberGaugeVoteSpecification, UpdateNumberGaugeVoteSpecification, UpdateTokenVoteSpecification, DeleteVoteSpecification, CreateProposal, UpdateProposal, DeleteProposal) from assembl.graphql.utils import get_fields, get_root_thematic_for_phase from assembl.graphql.preferences import UpdateHarvestingTranslationPreference from assembl.lib.locale import strip_country from assembl.lib.sqla_types import EmailString from assembl.models.action import SentimentOfPost from assembl.models.post import countable_publication_states from assembl.nlp.translation_service import DummyGoogleTranslationService from assembl.graphql.permissions_helpers import require_instance_permission from assembl.auth import CrudPermissions from assembl.utils import get_ideas, get_posts_for_phases convert_sqlalchemy_type.register(EmailString)(convert_column_to_string) models.Base.query = models.Base.default_db.query_property() log = logging.getLogger() # For security, always use only_fields in the Meta class to be sure we don't # expose every fields and relations. You need at least only_fields = ('id', ) # to take effect. # Auto exposing everything will automatically convert relations # like AgentProfile.posts_created and create dynamically the # object types Post, PostConnection which will conflict with those added # manually. class Query(graphene.ObjectType): node = Node.Field(description=docs.Schema.node)
CreateProposal, UpdateProposal, DeleteProposal ) from assembl.graphql.utils import get_fields, get_root_thematic_for_phase from assembl.graphql.preferences import UpdateHarvestingTranslationPreference from assembl.lib.locale import strip_country from assembl.lib.sqla_types import EmailString from assembl.models.action import SentimentOfPost from assembl.models.post import countable_publication_states from assembl.nlp.translation_service import DummyGoogleTranslationService from assembl.graphql.permissions_helpers import require_instance_permission from assembl.auth import CrudPermissions from assembl.utils import get_ideas, get_posts_for_phases # from assembl.models.timeline import get_phase_by_identifier, Phases convert_sqlalchemy_type.register(EmailString)(convert_column_to_string) models.Base.query = models.Base.default_db.query_property() log = logging.getLogger() # For security, always use only_fields in the Meta class to be sure we don't # expose every fields and relations. You need at least only_fields = ('id', ) # to take effect. # Auto exposing everything will automatically convert relations # like AgentProfile.posts_created and create dynamically the # object types Post, PostConnection which will conflict with those added # manually. class Query(graphene.ObjectType): node = Node.Field(description=docs.Schema.node)
from graphene_sqlalchemy.converter import convert_sqlalchemy_type from passlib.hash import pbkdf2_sha256 from loguru import logger from backend.misc import convert_column_to_string from backend.model import AxUser, GUID, AxGroup2Users, AxRole2Users import backend.model as ax_model import backend.cache as ax_cache import backend.dialects as ax_dialects # import backend.pubsub as ax_pubsub import backend.auth as ax_auth from backend.schemas.types import User from backend.auth import ax_admin_only import backend.misc as ax_misc convert_sqlalchemy_type.register(GUID)(convert_column_to_string) class CreateUser(graphene.Mutation): """ Creates AxUser """ class Arguments: # pylint: disable=missing-docstring email = graphene.String() name = graphene.String() short_name = graphene.String() password = graphene.String() avatar_tmp = graphene.String() info = graphene.String() is_blocked = graphene.Boolean() ok = graphene.Boolean() user = graphene.Field(User)
from graphene import relay from sqlalchemy.orm import joinedload from graphene_sqlalchemy import (SQLAlchemyObjectType, SQLAlchemyConnectionField, get_session) from graphene_sqlalchemy.converter import (convert_sqlalchemy_type, convert_json_to_string) from .model import (db, Layout as LayoutModel, Cabinet as CabinetModel, LayoutItem as LayoutItemModel, Location as LocationModel, Drawer as DrawerModel, Collection as CollectionModel, JSONEncodedDict) # Tell graphene sqlalchemy about our custom JSON type convert_sqlalchemy_type.register(JSONEncodedDict)(convert_json_to_string) class Cabinet(SQLAlchemyObjectType): class Meta: model = CabinetModel interfaces = (relay.Node, ) class Layout(SQLAlchemyObjectType): class Meta: model = LayoutModel interfaces = (relay.Node, ) class LayoutItem(SQLAlchemyObjectType):