Skip to content

Commit 4971711

Browse files
author
Enda Phelan
committed
feat: use graphback
1 parent fae6593 commit 4971711

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+13995
-7188
lines changed

advanced/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
PRISMA_SECRET="mysecret123"
22
APP_SECRET="jwtsecret123"
3+
MONGODB_CONNECTION_URL="mongodb://mongodb:mongo@localhost:27017/admin"

advanced/.graphqlrc.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
schema: ./src/schema/**/*.graphql
2+
extensions:
3+
# Graphback configuration
4+
graphback:
5+
## Input schema
6+
model: ./model
7+
## Global configuration for CRUD generator
8+
crud:
9+
create: true
10+
update: true
11+
findAll: true
12+
find: true
13+
delete: true
14+
subCreate: true
15+
subUpdate: true
16+
subDelete: true
17+
## Codegen plugins
18+
plugins:
19+
graphback-schema:
20+
format: 'graphql'
21+
outputPath: ./src/schema
22+
graphback-resolvers:
23+
format: ts
24+
outputPath: ./src/resolvers

advanced/.install/index.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

advanced/.install/package.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

advanced/.install/yarn.lock

Lines changed: 0 additions & 110 deletions
This file was deleted.

advanced/docker-compose.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: '3'
2+
services:
3+
mongodb:
4+
image: mongo:latest
5+
container_name: "mongodb"
6+
environment:
7+
- MONGO_DATA_DIR=/data/db
8+
- MONGO_LOG_DIR=/dev/null
9+
- MONGO_INITDB_DATABASE=users
10+
- MONGO_INITDB_ROOT_USERNAME=mongodb
11+
- MONGO_INITDB_ROOT_PASSWORD=mongo
12+
volumes:
13+
- ./data/db:/data/db
14+
ports:
15+
- 27017:27017
16+
command: mongod

advanced/model/datamodel.graphql

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
scalar DateTime
2+
3+
"""
4+
@model
5+
"""
6+
type Post {
7+
id: ID!
8+
createdAt: DateTime
9+
updatedAt: DateTime
10+
published: Boolean!
11+
title: String!
12+
content: String!
13+
}
14+
15+
"""
16+
@model
17+
"""
18+
type User {
19+
id: ID!
20+
email: String!
21+
password: String!
22+
name: String!
23+
"""
24+
@oneToMany field: 'author'
25+
"""
26+
posts: [Post!]!
27+
}

advanced/package.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,27 @@
33
"scripts": {
44
"start": "dotenv -- nodemon -e ts,graphql -x ts-node src/index.ts",
55
"debug": "dotenv -- nodemon -e ts,graphql -x ts-node --inspect src/index.ts",
6-
"build": "rimraf dist && tsc"
6+
"build": "rimraf dist && tsc",
7+
"generate": "graphback generate"
78
},
89
"dependencies": {
10+
"@graphback/runtime-mongo": "0.11.2",
11+
"apollo-server-express": "2.11.0",
912
"bcryptjs": "2.4.3",
10-
"graphql-yoga": "1.18.3",
11-
"jsonwebtoken": "8.5.1"
13+
"graphql": "14.6.0",
14+
"graphql-iso-date": "^3.6.1",
15+
"jsonwebtoken": "8.5.1",
16+
"mongodb": "3.5.5"
1217
},
1318
"devDependencies": {
1419
"@types/bcryptjs": "2.4.2",
1520
"@types/node": "10.17.17",
1621
"dotenv-cli": "1.4.0",
22+
"graphback-cli": "0.11.4",
23+
"graphql-config": "3.0.0-alpha.23",
1724
"nodemon": "1.19.4",
18-
"prisma": "1.34.10",
1925
"rimraf": "2.7.1",
26+
"schemats": "3.0.3",
2027
"ts-node": "7.0.1",
2128
"typescript": "3.2.2"
2229
}

advanced/prisma/datamodel.prisma

Lines changed: 0 additions & 17 deletions
This file was deleted.

advanced/prisma/prisma.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)