Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion advanced/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
PRISMA_SECRET="mysecret123"
APP_SECRET="jwtsecret123"
MONGODB_CONNECTION_URL="mongodb://mongodb:mongo@localhost:27017/admin"
24 changes: 24 additions & 0 deletions advanced/.graphqlrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
schema: ./src/schema/**/*.graphql
extensions:
# Graphback configuration
graphback:
## Input schema
model: ./model
## Global configuration for CRUD generator
crud:
create: true
update: true
findAll: true
find: true
delete: true
subCreate: true
subUpdate: true
subDelete: true
## Codegen plugins
plugins:
graphback-schema:
format: 'graphql'
outputPath: ./src/schema
graphback-resolvers:
format: ts
outputPath: ./src/resolvers
32 changes: 0 additions & 32 deletions advanced/.install/index.js

This file was deleted.

7 changes: 0 additions & 7 deletions advanced/.install/package.json

This file was deleted.

110 changes: 0 additions & 110 deletions advanced/.install/yarn.lock

This file was deleted.

16 changes: 16 additions & 0 deletions advanced/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3'
services:
mongodb:
image: mongo:latest
container_name: "mongodb"
environment:
- MONGO_DATA_DIR=/data/db
- MONGO_LOG_DIR=/dev/null
- MONGO_INITDB_DATABASE=users
- MONGO_INITDB_ROOT_USERNAME=mongodb
- MONGO_INITDB_ROOT_PASSWORD=mongo
volumes:
- ./data/db:/data/db
ports:
- 27017:27017
command: mongod
27 changes: 27 additions & 0 deletions advanced/model/datamodel.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
scalar DateTime

"""
@model
"""
type Post {
id: ID!
createdAt: DateTime
updatedAt: DateTime
published: Boolean!
title: String!
content: String!
}

"""
@model
"""
type User {
id: ID!
email: String!
password: String!
name: String!
"""
@oneToMany field: 'author'
"""
posts: [Post!]!
}
15 changes: 11 additions & 4 deletions advanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,27 @@
"scripts": {
"start": "dotenv -- nodemon -e ts,graphql -x ts-node src/index.ts",
"debug": "dotenv -- nodemon -e ts,graphql -x ts-node --inspect src/index.ts",
"build": "rimraf dist && tsc"
"build": "rimraf dist && tsc",
"generate": "graphback generate"
},
"dependencies": {
"@graphback/runtime-mongo": "0.11.2",
"apollo-server-express": "2.11.0",
"bcryptjs": "2.4.3",
"graphql-yoga": "1.18.3",
"jsonwebtoken": "8.5.1"
"graphql": "14.6.0",
"graphql-config": "3.0.0-alpha.23",
"graphql-iso-date": "^3.6.1",
"jsonwebtoken": "8.5.1",
"mongodb": "3.5.5"
},
"devDependencies": {
"@types/bcryptjs": "2.4.2",
"@types/node": "10.17.18",
"dotenv-cli": "1.4.0",
"graphback-cli": "0.11.4",
"nodemon": "1.19.4",
"prisma": "1.34.10",
"rimraf": "2.7.1",
"schemats": "3.0.3",
"ts-node": "7.0.1",
"typescript": "3.2.2"
}
Expand Down
17 changes: 0 additions & 17 deletions advanced/prisma/datamodel.prisma

This file was deleted.

24 changes: 0 additions & 24 deletions advanced/prisma/prisma.yml

This file was deleted.

34 changes: 0 additions & 34 deletions advanced/prisma/seed.graphql

This file was deleted.

36 changes: 36 additions & 0 deletions advanced/seed.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Write your query or mutation here
mutation {
user1: createUser(input: {
email: "[email protected]"
name: "Alan"
password: "$2b$10$dqyYw5XovLjpmkYNiRDEWuwKaRAvLaG45fnXE5b3KTccKZcRPka2m" # "secret42"
}) {
id
}

user1Post: createPost(input: {
title: "Graphback - the evolution of the GraphQL ecosystem"
content: "https://graphback.dev/blog/2019/08/21/introduction"
published: true
}) {
title
content
}

user2: createUser(input: {
email: "[email protected]"
name: "Siobhan"
password: "$2b$10$o6KioO.taArzboM44Ig85O3ZFZYZpR3XD7mI8T29eP4znU/.xyJbW" # "secret43"
}) {
id
}

user2Post: createPost(input: {
title: "Graphback - Low Code, GraphQL based API suited for your needs"
content: "https://graphback.dev/blog/2020/02/06/graphback-plugins"
published: true
}) {
title
content
}
}
Loading