oxid-esales/graphql-configuration-access

OXID eSales GraphQL配置访问模块

安装: 182

依赖者: 0

建议者: 0

安全: 0

星星: 14

关注者: 2

分支: 0

类型:oxideshop-module


README

Development Latest Version PHP Version

Quality Gate Status Coverage Technical Debt

graphql-configuration-access

基于GraphQL的OXAPI访问配置设置

为什么使用此架构

为了获取和更新配置,我们为每个值类型实现了一个不同的查询/突变。我们选择此架构是因为GraphQL的严格性不允许动态类型。如果没有这些类型,API消费者在查询后或突变前始终需要将值进行转换,例如,如果我们决定使用json编码的字符串。

要获取特定配置的类型,我们提供了如shopSettings/moduleSettings/themeSettings之类的查询,以确定配置的类型。结果您将获得设置类型数组

type SettingType {
  name: string!
  type: FieldType!
  isSupported: boolean!
}

enum FieldType {
  'str'
  'select'
  'bool'
  'num
  'arr'
  'aarr'
}

文档

  • 完整文档可在此处找到。

安装

切换到商店根目录(文件composer.json以及目录source/vendor/位于此处)。

# Install desired version of oxid-esales/graphql-configuration-access module, in this case - latest released 1.x version
$ composer require oxid-esales/graphql-configuration-access ^1.0.0

如果您尚未安装oxid-esales/graphql-base模块,Composer将为您安装。

安装模块后,您需要通过OXID eShop管理员或CLI激活它。

$ vendor/bin/oe-console oe:module:activate oe_graphql_base
$ vendor/bin/oe-console oe:module:activate oe_graphql_configuration_access

如何使用

一个好的起点是检查GraphQL Base模块中的“如何使用”部分

通过GraphQL阻止模块的激活/禁用

文件module_blockilst.yaml包含了一组列表,这些模块是必要的,以处理配置或通过GraphQL激活/禁用模块,或者应该被阻止在一般情况下通过GraphQL激活/禁用。例如,oe_graphql_baseoe_graphql_configuration_access被列在其中。

测试

代码风格检查,语法检查,静态分析

$ composer update
$ composer static

单元/集成/验收测试

  • 将此模块安装到运行的OXID eShop
  • 重置商店的数据库
$ bin/oe-console oe:database:reset --db-host=db-host --db-port=db-port --db-name=db-name --db-user=db-user --db-password=db-password --force
  • 运行单元+集成测试
$ composer phpunit
  • 运行单元测试
$ ./vendor/bin/phpunit -c vendor/oxid-esales/graphql-configuration-access/tests/phpunit.xml
  • 运行集成测试
$ ./vendor/bin/phpunit --bootstrap=./source/bootstrap.php -c vendor/oxid-esales/graphql-configuration-access/tests/phpintegration.xml
  • 运行验收测试
$ composer codeception