Пример #1
0
class Map(SQLAlchemyObjectType, MapAttribute):
    """Map node"""
    data_loader_table = utils.DataLoaderOneToOne(models.Map, models.Tables)
    data_loader_tag = utils.DataLoaderOneToOne(models.Map, models.ReleaseTag)

    def resolve_table(self, info):
        return Map.data_loader_table.load(self.map_id)

    def resolve_tag(self, info):
        return Map.data_loader_tag.load(self.map_id)

    class Meta:
        model = models.Map
        interfaces = (relay.Node, )
Пример #2
0
class Processes(SQLAlchemyObjectType, ProcessesAttribute):
    """Processes node"""
    session_loader = utils.DataLoaderOneToOne(models.Processes, models.Session)
    fields_loader = utils.DataLoaderOneToMany(models.Processes,
                                              models.ProcessFields,
                                              models.Fields)
    inputs_loader = utils.DataLoaderOneToMany(models.Processes,
                                              models.ProcessInputs,
                                              models.Products)

    def resolve_session(self, info):
        return Processes.session_loader.load(self.process_id)

    def resolve_fields(self, info):
        return Processes.fields_loader.load(self.process_id)

    def resolve_inputs(self, info):
        return Processes.inputs_loader.load(self.process_id)

    class Meta:
        model = models.Processes
        interfaces = (relay.Node, )
        connection_class = utils.Connection

    def resolve_product_log(self, info):
        """ Mount the product_log link """

        return os.path.join(
            SCIENCE_URL,
            "VP/getViewProcessCon?process_id={}".format(self.process_id))
Пример #3
0
class Mask(SQLAlchemyObjectType, MaskAttribute):
    """Mask node"""
    data_loader_table = utils.DataLoaderOneToOne(models.Mask, models.Tables)
    data_loader_tag = utils.DataLoaderOneToOne(models.Mask, models.ReleaseTag)
    data_loader_field = utils.DataLoaderOneToOne(models.Mask, models.Fields)

    def resolve_table(self, info):
        return Mask.data_loader_table.load(self.mask_id)

    def resolve_tag(self, info):
        return Mask.data_loader_tag.load(self.mask_id)

    def resolve_field(self, info):
        return Mask.data_loader_field.load(self.mask_id)

    class Meta:
        model = models.Mask
        interfaces = (relay.Node, )
Пример #4
0
class Catalog(SQLAlchemyObjectType, CatalogAttribute):
    """Catalog node"""
    data_loader_table = utils.DataLoaderOneToOne(models.Catalog, models.Tables)

    def resolve_table(self, info):
        return Catalog.data_loader_table.load(self.catalog_id)

    class Meta:
        model = models.Catalog
        interfaces = (relay.Node, )
Пример #5
0
class PipelinesModules(SQLAlchemyObjectType, PipelinesModulesAttribute):
    """Pipelines modules node"""
    data_loader_module = utils.DataLoaderOneToOne(
        models.PipelinesModules,
        models.Modules,
        pk_inner_model=models.PipelinesModules.module_id)
    data_loader_pipeline = utils.DataLoaderOneToOne(
        models.PipelinesModules,
        models.Pipelines,
        pk_inner_model=models.PipelinesModules.pipeline_id)

    def resolve_module(self, info):
        return PipelinesModules.data_loader_module.load(self.module_id)

    def resolve_pipeline(self, info):
        return PipelinesModules.data_loader_pipeline.load(self.pipeline_id)

    class Meta:
        model = models.PipelinesModules
        interfaces = (relay.Node, )
Пример #6
0
class Modules(SQLAlchemyObjectType, ModulesAttribute):
    """Modules node"""
    data_loader = utils.DataLoaderOneToOne(models.Modules, models.TgUser)

    def resolve_user(self, info):
        return Modules.data_loader.load(self.module_id)

    class Meta:
        model = models.Modules
        interfaces = (relay.Node, )
        connection_class = utils.Connection
Пример #7
0
class ProductClass(SQLAlchemyObjectType, ProductClassAttribute):
    """Product Class node"""
    data_loader_product_type = utils.DataLoaderOneToOne(
        models.ProductClass, models.ProductType)

    def resolve_product_type(self, info):
        return ProductClass.data_loader_product_type.load(self.class_id)

    class Meta:
        model = models.ProductClass
        interfaces = (relay.Node, )
        connection_class = utils.Connection
Пример #8
0
class Fields(SQLAlchemyObjectType, FieldsAttribute):
    """Fields Tag node"""

    data_loader_release_tag = utils.DataLoaderOneToOne(models.Fields,
                                                       models.ReleaseTag)

    def resolve_release_tag(self, info):
        return Fields.data_loader_release_tag.load(self.field_id)

    class Meta:
        model = models.Fields
        interfaces = (relay.Node, )
        connection_class = utils.Connection