silverstripe / silverstripe-graphql

Serves Silverstripe data as GraphQL representations
BSD 3-Clause "New" or "Revised" License
52 stars 61 forks source link

API Migrate code and docs from other modules #596

Closed emteknetnz closed 2 weeks ago

emteknetnz commented 1 month ago

Issue https://github.com/silverstripe/silverstripe-admin/issues/1799

Have validated that the front end schema is still usable:

composer require silverstripe/graphql-devtools

app/_config/graphql.yml

---
name: app-graphql
after: "*"
---
SilverStripe\Control\Director:
  rules:
    'graphql': '%$SilverStripe\GraphQL\Controller.default'

SilverStripe\GraphQL\Schema\Schema:
  schemas:
    default:
      src:
       - "app/_graphql"

app/_graphql/models.yml

Page:
  fields: '*'
  operations: '*'

dev/build flush=1

Test using graphql devtool

https://mysite.test/dev/graphql/ide

Test a query

query {
  readPages {
    nodes {
      title
      content
    }
  }
}

Test migrated versioning plugin

(Make draft changes on page ID = 2 in the CMS)

mutation {
  publishPage(id: 2) {
    id
  }
}

Refersh the CMS - page has been published