https://github.com/fabien0102/gcf-versioning-poc
Just a POC of a versioning system based on graphcool-framework
https://github.com/fabien0102/gcf-versioning-poc
graphcool poc typescript
Last synced: 7 months ago
JSON representation
Just a POC of a versioning system based on graphcool-framework
- Host: GitHub
- URL: https://github.com/fabien0102/gcf-versioning-poc
- Owner: fabien0102
- Created: 2018-01-19T13:29:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-19T13:50:27.000Z (over 7 years ago)
- Last Synced: 2025-03-20T03:01:57.310Z (7 months ago)
- Topics: graphcool, poc, typescript
- Language: TypeScript
- Homepage:
- Size: 5.86 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Graphcool versioning POC
Just a little POC to add a versioning system with graphcool.
The trick is to add a `beforeOperation` hook that save the last state into a separate collection.
## Getting started
1. clone the repo
1. `gcf deploy`
1. `gcf playground`## Classic use case
Create a user
```graphql
mutation {
createUser( name: "fabien0102") {
id
}
}
```Create a post
```graphql
mutation {
createPost(title: "test", authorId: "cjclxr2wg006b0102d50flrwn") {
id
title
}
}
```Update a post
```graphql
mutation {
updatePost(id: "cjclxs4vw006h0102por7sy81", title: "po po po") {
id
title
}
}
```Get the generated history
```graphql
{
allPosts {
id
author {
id
}
title
history {author {id} title}
}
}
```