Skip to content

Commit fcb163f

Browse files
authored
Merge pull request #162 from oslabs-beta/v2
Version 2 import tables from existing databases, create a boilerplate for a test_suite in the test view and added Jest testing for some of our utils files/functions. General bug fixes and addressing of issues.
2 parents 2bfc93b + 0e4a629 commit fcb163f

Some content is hidden

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

60 files changed

+1941
-358
lines changed

Diff for: .DS_Store

-6 KB
Binary file not shown.

Diff for: .babelrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
presets: ["@babel/preset-env", "@babel/preset-react"]
3+
}
4+
5+
//hello

Diff for: .bablerc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"presets": [[
3+
"@babel/preset-env", {
4+
"useBuiltIns": "entry"
5+
}],
6+
"@babel/preset-react"],
7+
"plugins": [
8+
"@babel/plugin-proposal-class-properties",
9+
"@babel/plugin-proposal-export-default-from",
10+
"react-hot-loader/babel"
11+
]
12+
}

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ winehq.key
66
out
77
public/bundle.js
88
public/bundle.js.map
9+
dist
910
.DS_Store

Diff for: README.md

+64-55
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,84 @@
11
<p align="center" ><img src="public/assets/pictures/ProtographQLBanner.png" width="800px"></p>
2-
3-
# ProtoGraphQL
4-
5-
ProtoGraphQL is a **prototyping tool** that helps developers build and visualize GraphQL schemas and queries without writing any code. Users simply input their relational database tables and ProtoGraphQL will dynamically create a customized and functional GraphQL Apollo Server readily available for export.
6-
7-
ProtoGraphQL is currently in beta. We would appreciate if you could post any issues to our GitHub – we are actively looking for areas for improvement and we welcome feedback from the community.
8-
9-
Upcoming releases include adding visual indicators for table relationships in the “Schema” view, enabling users to create customizable GraphQL mutations, and extending support for NoSQL databases such as MongoDB.
10-
11-
\* *We recently added support for users to view the structures and relationships of their tables using our GraphQL schema tree visualizer!*
12-
2+
3+
# ProtoGraphQL ver. 2.0
4+
5+
*** The latest release of ProtoGraphQL includes a new view that can jumpstart your query testing with the Jest framework and the ability to import tables from an existing database. ***
6+
7+
ProtoGraphQL is a **prototyping tool** that empowers developers to build and visualize GraphQL schemas and queries without writing any code. Once users import or input their relational database tables, ProtoGraphQL can generate an export package that allows developers to spin up a customized and functional GraphQL Apollo Server as an independent app. (As of version 2.0 custom mutations are also supported!)
8+
9+
ProtoGraphQL is in beta. Please post any issues to our GitHub - we are actively looking for opportunities to improve this tool and we welcome your feedback.
10+
11+
Upcoming releases will improve the “Schema” view and add support for NoSQL databases.
12+
1313
## Getting Started:
14-
15-
1. Download for [Mac](https://github.com/oslabs-beta/protographql/releases/download/v1.0.0-beta/ProtoGraphQL-1.0.0.dmg), [Windows](https://github.com/oslabs-beta/protographql/releases/download/v1.0.0-beta/ProtoGraphQL.Setup.1.0.0.exe), or [Linux](https://github.com/oslabs-beta/protographql/releases/download/v1.0.0-beta/protographql_1.0.0_amd64.deb)
16-
14+
15+
1. Download: [Mac](https://github.com/oslabs-beta/protographql/releases/download/v1.0.0-beta/ProtoGraphQL-1.0.0.dmg), [Windows](https://github.com/oslabs-beta/protographql/releases/download/v1.0.0-beta/ProtoGraphQL.Setup.1.0.0.exe), [Linux](https://github.com/oslabs-beta/protographql/releases/download/v1.0.0-beta/protographql_1.0.0_amd64.deb)
16+
1717
2. Extract file
18-
19-
3. Run app
20-
18+
19+
3. Run application
20+
2121
## How to Use:
22-
23-
1. When the application loads, click on **Add Table** and populate the table form with a name and new fields. Optionally, you may also use the last three inputs in the form to create relationships to other tables. When you are done, click **Save**.
24-
25-
<p align="center"><kbd><img src="public/assets/pictures/add-table demo.mov.gif" width="800px"></kbd><p>
26-
27-
2. Navigate to the **Schema**, **Code**, and **Visualize** tabs to toggle views:
28-
* **Schema** - view, edit, or delete tables you've added
22+
23+
1. When the application starts you will be given the option to either **CREATE YOUR TABLES** or **IMPORT TABLES**. To create your tables, click the “Add Table” button in the lower left corner of the screen. When your config is complete, click **Save**. When importing, simply paste your database URI in the field and click the **Connect** button. In either case, your tables will be displayed in the main view when you are done.
24+
25+
<p align="center"><kbd><img src="public/assets/pictures/v2-add-tables.gif" width="800px"></kbd><p>
26+
27+
2. Navigate to the alternate views within the app using the tabs on the left: **Schema**, **Code**, **Visualize**, and **Tests**
28+
29+
* **Schema** - view, edut or delete tables you've added.
2930

30-
<p align="center"><kbd><img src="public/assets/pictures/Schema_Screenshot.png" width="800px"></kbd></p>
31+
<p align="center"><kbd><img src="public/assets/pictures/v2-schema-view.png" width="800px"></kbd></p>
3132

32-
* **Code** - view generated GraphQL and SQL code before export
33+
* **Code** - view generated GraphQL and SQL code.
3334

34-
<p align="center"><kbd><img src="public/assets/pictures/Code_Screenshot.png" width="800px"></kbd></p>
35+
<p align="center"><kbd><img src="public/assets/pictures/v2-codeview.png" width="800px"></kbd></p>
3536

36-
* **Visualize** - view the GraphQL schema intuitively as a simple tree
37+
* **Visualize** - view the GraphQL schema as a simple tree.
3738

38-
<p align="center" ><kbd><img src="public/assets/pictures/tree visializer demo.gif" width="800px"></kbd></p>
39-
40-
3. Export the code by clicking the **Export** icon.
41-
42-
<p align="center" ><kbd><img src="public/assets/pictures/Export_Screenshot.png" width="800px"></kbd></p>
43-
44-
4. Enter your Postgres database URI and then select the directory you want to save your executable GraphQL server.
45-
39+
<p align="center" ><kbd><img src="public/assets/pictures/v2-visualizer.gif" width="800px"></kbd></p>
40+
41+
* **Tests** - create and export query and response pairs from a custom GraphQL Endpoint.
42+
43+
<p align="center" ><kbd><img src="public/assets/pictures/v2-test-queries.gif" width="800px"></kbd></p>
44+
45+
3. Export your code by clicking the **Export** icon in the upper right.
46+
47+
<p align="center" ><kbd><img src="public/assets/pictures/v2-export.png" width="800px"></kbd></p>
48+
49+
4. Enter your Postgres database URI, then select the directory you want to save your compressed GraphQL server package in.
50+
51+
4652
## How to Run GraphQL Server:
47-
53+
4854
There are several libraries we could have used to create a GraphQL server, but we decided to use Apollo Server – the most popular library to setup an endpoint for responding to incoming GraphQL requests in JavaScript.
49-
50-
1. Extract apollo-server.zip file
51-
55+
56+
1. Extract apollo-server.zip file
57+
5258
2. Open the project
53-
54-
3. Install dependencies
59+
60+
3. Install dependencies
5561
```
5662
npm install
5763
```
58-
59-
4. Run the server and visit localhost:3000
64+
65+
4. Run the server and point your browser to localhost:3000
6066
```
6167
npm start
6268
```
63-
64-
5. Use Apollo Server Playground to mock client GraphQL queries and responses to your server. [Learn more about constructing GraphQL Queries here](https://graphql.org/learn/queries/)
65-
69+
70+
5. Use Apollo Server Playground to mock client GraphQL queries and responses to your server. [Learn more about constructing GraphQL Queries here](https://graphql.org/learn/queries/)
71+
6672
## Contributors:
67-
73+
6874
<img align="right" src="public/assets/pictures/icon/icon.png" width="125px">
69-
70-
- Alena Budzko [@AlenaBudzko](https://github.com/AlenaBudzko)
71-
- Bryan Fong [@bryanfong-dev](https://github.com/bryanfong-dev)
72-
- Rodolfo Guzman [@Rodolfoguzman25](https://github.com/Rodolfoguzman25)
73-
- Jarred Jack Harewood [@jackhajb](https://github.com/jackhajb)
74-
- Geoffrey Lin [@geofflin](https://github.com/geofflin)
75-
75+
76+
- Alena Budzko | [@AlenaBudzko](https://github.com/AlenaBudzko)
77+
- Bryan Fong | [@bryanfong-dev](https://github.com/bryanfong-dev)
78+
- Rodolfo Guzman | [@Rodolfoguzman25](https://github.com/Rodolfoguzman25)
79+
- Haris Hambasic | [@hambasicharis1995](https://github.com/hambasicharis1995)
80+
- Jarred Jack Harewood | [@jackhajb](https://github.com/jackhajb)
81+
- Geoffrey Lin | [@geofflin](https://github.com/geofflin)
82+
- Michele Moody | [@Milmoody](https://github.com/Milmoody)
83+
- Jessica Vaughan | [@jessicavaughan820](https://github.com/jessicavaughan820)
84+
- Vance Wallace | [@Vancito](https://github.com/Vancito)

Diff for: _protographql_tests_/buildENV.test.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import buildEnvURI from '../src/utils/buildENV';
2+
import buildENV from '../src/utils/buildENV';
3+
4+
test('When trying to create the Environment URI the result is not null: ', () => {
5+
expect(buildEnvURI("thisIsNotNull")).not.toBeNull;
6+
});
7+
8+
test('When trying to create the Environment URI the result is a string: ', () => {
9+
expect(typeof((buildENV("thisIsAString")))).toBe('string');
10+
});
11+
12+
test('Create the correct Environment URI given test input: ', () => {
13+
expect(buildEnvURI("theCorrectURIString")).toBe("DB_URI=theCorrectURIString");
14+
});

Diff for: _protographql_tests_/buildGQLInputTypes.test.js

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
import buildGQLInputTypes from '../src/utils/buildGQLInputTypes';
2+
import { build } from 'protobufjs';
3+
4+
const testInput = {
5+
0: {
6+
type: 'FirstTable',
7+
fields: {
8+
0: {
9+
name: 'FirstColumn',
10+
type: 'ID',
11+
primaryKey: true,
12+
unique: true,
13+
required: false,
14+
defaultValue: '1',
15+
relationSelected: false,
16+
relation: {
17+
tableIndex: -1,
18+
fieldIndex: -1,
19+
refType: ''
20+
},
21+
tableNum: 0,
22+
fieldNum: 0,
23+
queryable: false
24+
},
25+
1: {
26+
name: 'SecondColumn',
27+
type: 'String',
28+
primaryKey: false,
29+
unique: false,
30+
required: true,
31+
defaultValue: 'thisIsADefaultValue',
32+
relationSelected: false,
33+
relation: {
34+
tableIndex: -1,
35+
fieldIndex: -1,
36+
refType: ''
37+
},
38+
tableNum: 0,
39+
fieldNum: 1,
40+
queryable: true
41+
},
42+
2: {
43+
name: 'ThirdColumn',
44+
type: 'String',
45+
primaryKey: false,
46+
unique: false,
47+
required: true,
48+
defaultValue: '',
49+
relationSelected: false,
50+
relation: {
51+
tableIndex: -1,
52+
fieldIndex: -1,
53+
refType: ''
54+
},
55+
tableNum: 0,
56+
fieldNum: 2,
57+
queryable: false
58+
}
59+
},
60+
fieldIndex: 3,
61+
tableID: 0
62+
},
63+
1: {
64+
type: 'SecondTable',
65+
fields: {
66+
0: {
67+
name: 'SecondTableFirstColumn',
68+
type: 'ID',
69+
primaryKey: true,
70+
unique: true,
71+
required: false,
72+
defaultValue: '',
73+
relationSelected: false,
74+
relation: {
75+
tableIndex: -1,
76+
fieldIndex: -1,
77+
refType: ''
78+
},
79+
tableNum: 1,
80+
fieldNum: 0,
81+
queryable: true
82+
},
83+
1: {
84+
name: 'SecondSecondColumn',
85+
type: 'String',
86+
primaryKey: false,
87+
unique: false,
88+
required: true,
89+
defaultValue: 'anotherDefaultValue',
90+
relationSelected: false,
91+
relation: {
92+
tableIndex: -1,
93+
fieldIndex: -1,
94+
refType: ''
95+
},
96+
tableNum: 1,
97+
fieldNum: 1,
98+
queryable: true
99+
},
100+
2: {
101+
name: 'SecondThirdColumn',
102+
type: 'ID',
103+
primaryKey: false,
104+
unique: false,
105+
required: true,
106+
defaultValue: '',
107+
relationSelected: true,
108+
relation: {
109+
tableIndex: '0',
110+
fieldIndex: '0',
111+
refType: 'many to one'
112+
},
113+
tableNum: 1,
114+
fieldNum: 2,
115+
queryable: true
116+
}
117+
},
118+
fieldIndex: 3,
119+
tableID: 1
120+
},
121+
};
122+
123+
const testOutput = ` input FirstTableInput {
124+
FirstColumn: ID,
125+
SecondColumn: String!,
126+
ThirdColumn: String!,
127+
}
128+
129+
input SecondTableInput {
130+
SecondTableFirstColumn: ID,
131+
SecondSecondColumn: String!,
132+
firsttable: FirstTableInput,
133+
}
134+
135+
`
136+
137+
test('Building GQL Input Types does not return null: ', () => {
138+
expect(buildGQLInputTypes(testInput)).not.toBeNull;
139+
});
140+
141+
test('When trying to create the GQL Input Types the result is a string: ', () => {
142+
expect(typeof(buildGQLInputTypes(testInput))).toBe('string');
143+
});
144+
145+
test('Building GQL Input Types works given test input: ', () => {
146+
expect(buildGQLInputTypes(testInput)).toBe(testOutput);
147+
});

0 commit comments

Comments
 (0)