Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/graphql backend #34

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
12 changes: 12 additions & 0 deletions Phonebook.Backend/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Phonebook Backend

> Attention! Work in Progress.

This is the Phonebook Backend. It is designed as a middleware to have a unified API for the frontend while supporting multiple types of sources for people to search for and other resources, such as user settings, skills (check out SKOOP)

## Todo

- Use Prisma as Database provider (for user settings)
- write an OpenAPI schema for the peopleSource Backend
- remove faker dependency
- https://graphql-inspector.com/docs/
3,939 changes: 3,939 additions & 0 deletions Phonebook.Backend/package-lock.json

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions Phonebook.Backend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "phonebook-backend",
"version": "1.0.0",
"description": "The Phonebook Backend - A GraphQL Middleware",
"main": "index.js",
"license": "MIT",
"dependencies": {
"apollo-server-express": "^2.3.1",
"axios": "^0.19.0",
"express": "^4.16.4",
"faker": "^4.1.0",
"graphql": "^14.0.2",
"reflect-metadata": "^0.1.12",
"rxjs": "^6.5.2",
"type-graphql": "^0.16.0"
},
"devDependencies": {
"@openapitools/openapi-generator-cli": "0.0.14-4.0.2",
"@types/express": "^4.16.0",
"@types/faker": "^4.1.5",
"@types/graphql": "^14.0.4",
"@types/node": "^10.12.18",
"nodemon": "^1.18.9",
"ts-node": "^7.0.1",
"tsconfig-paths": "^3.8.0",
"typescript": "^3.2.2"
},
"scripts": {
"start": "nodemon --exec ts-node -r tsconfig-paths/register src/index.ts",
"generate": "openapi-generator generate -g typescript-axios -o src/connectors/generated/people-source -i ../Phonebook.Source/openapi.yaml --additional-properties=modelPropertyNaming=original,supportsES6=true"
}
}
51 changes: 51 additions & 0 deletions Phonebook.Backend/schema.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# -----------------------------------------------
# !!! THIS FILE WAS GENERATED BY TYPE-GRAPHQL !!!
# !!! DO NOT MODIFY THIS FILE BY YOURSELF !!!
# -----------------------------------------------

type Building {
id: ID!
}

type ContactInformation {
mobile: String!
phone: String!
fax: String!
email: String!
}

type Person {
id: ID!
type: String!
title: String!
firstName: String!
lastName: String!
role: String!
picture: Picture!
costCenter: String!
room: Room!
contactInformation: ContactInformation!
supervisors: [Person!]!
teamAssistants: [Person!]!
organizationUnits: [String!]!
}

type Picture {
exists: Boolean!
resourceUrl: String!
}

type Query {
buildings: [Building!]!
building(id: ID!): Building!
getPersons(searchString: String, filter: String): [Person!]!
getPerson(id: ID!): Person!
rooms: [Room!]!
}

type Room {
id: ID!
number: String!
roomPlanUrl: String!
occupiedByPersons: [Person!]!
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.0.2
Loading