-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Places interface graphql terminated
- Loading branch information
Showing
38 changed files
with
646 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from "./exceptions"; | ||
export * from "./filters"; | ||
export * from "./server"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
max_line_length = off | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
parser: "@typescript-eslint/parser" | ||
parserOptions: | ||
project: "tsconfig.json" | ||
sourceType: "module" | ||
plugins: | ||
- "@typescript-eslint/eslint-plugin" | ||
- "simple-import-sort" | ||
extends: | ||
- plugin:@typescript-eslint/eslint-recommended | ||
- plugin:@typescript-eslint/recommended | ||
- prettier | ||
- prettier/@typescript-eslint | ||
env: | ||
node: true | ||
jest: true | ||
rules: | ||
"@typescript-eslint/interface-name-prefix": 0 | ||
"@typescript-eslint/explicit-function-return-type": 0 | ||
"@typescript-eslint/no-explicit-any": 0 | ||
"simple-import-sort/sort": 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules/ | ||
reports/ | ||
lib/ | ||
cert/ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"endOfLine": "auto", | ||
"semi": true, | ||
"singleQuote": false, | ||
"tabWidth": 2, | ||
"trailingComma": "es5" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Luis Diego | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"transform": { | ||
"^.+\\.ts?$": "ts-jest" | ||
}, | ||
"testRegex": ".spec.ts$", | ||
"testEnvironment": "node", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"js", | ||
"json" | ||
], | ||
"collectCoverage": true, | ||
"coverageReporters": [ | ||
"json", | ||
"text", | ||
"html" | ||
], | ||
"coverageDirectory": "reports" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"name": "@micro/places-graphql", | ||
"version": "1.0.0", | ||
"description": "Places GraphQL Interface", | ||
"author": { | ||
"name": "Luis Diego", | ||
"email": "[email protected]", | ||
"url": "http://github.com/ldiego73" | ||
}, | ||
"license": "MIT", | ||
"main": "lib/app.js", | ||
"types": "lib/app.d.ts", | ||
"files": [ | ||
"lib/" | ||
], | ||
"scripts": { | ||
"clean": "rimraf lib", | ||
"format": "prettier --write \"src/**/*.ts\" --loglevel silent", | ||
"lint": "eslint \"{src,test}/**/*.ts\" -f stylish", | ||
"develop": "nest start --watch", | ||
"prebuild": "yarn clean", | ||
"build": "nest build", | ||
"test": "jest --passWithNoTests" | ||
}, | ||
"dependencies": { | ||
"@micro/places-config": "^1.0.0", | ||
"@micro/places-core": "^1.0.0", | ||
"@micro/kernel": "^1.0.0", | ||
"@micro/logger": "^1.0.0", | ||
"@micro/server": "^1.0.0", | ||
"@micro/server-graphql": "^1.0.0", | ||
"fastify-cors": "^3.0.3", | ||
"fastify-rate-limit": "^3.0.1" | ||
}, | ||
"devDependencies": { | ||
"@nestjs/cli": "^7.2.0", | ||
"@nestjs/testing": "^7.1.3", | ||
"@types/node": "^14.0.13", | ||
"@types/supertest": "^2.0.9", | ||
"@typescript-eslint/eslint-plugin": "^3.2.0", | ||
"@typescript-eslint/parser": "^3.2.0", | ||
"eslint": "^7.2.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-import": "^2.21.2", | ||
"eslint-plugin-simple-import-sort": "^5.0.3", | ||
"jest": "^26.0.1", | ||
"prettier": "^2.0.5", | ||
"rimraf": "^3.0.2", | ||
"supertest": "^4.0.2", | ||
"ts-jest": "^26.1.0", | ||
"ts-node": "^8.10.2", | ||
"typescript": "^3.9.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* eslint @typescript-eslint/no-non-null-assertion:0 */ | ||
|
||
import { MicroApplication } from "@micro/kernel"; | ||
import { readEnv } from "@micro/places-config"; | ||
import { Server } from "@micro/server-graphql"; | ||
import cors from "fastify-cors"; | ||
import rateLimit from "fastify-rate-limit"; | ||
|
||
import { AppModule } from "./modules/app.module"; | ||
|
||
export class PlaceGraphqlApplication extends MicroApplication { | ||
async start(): Promise<void> { | ||
const env = readEnv(); | ||
const { key, cert } = env.server.https!; | ||
const server = Server.create(AppModule, { | ||
port: env.server.port, | ||
https: { key, cert }, | ||
}); | ||
|
||
server.register(cors); | ||
server.register(rateLimit, { max: 100, timeWindow: "1 minute" }); | ||
|
||
await server.start(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { PlaceGraphqlApplication } from "./app"; | ||
|
||
new PlaceGraphqlApplication().start(); |
25 changes: 25 additions & 0 deletions
25
microservices/places/interfaces/graphql/src/models/address.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Field, ObjectType } from "@nestjs/graphql"; | ||
|
||
@ObjectType("Location") | ||
export class LocationSchema { | ||
@Field({ nullable: true }) | ||
lat?: string; | ||
|
||
@Field({ nullable: true }) | ||
lng?: string; | ||
} | ||
|
||
@ObjectType("Address") | ||
export class AddressSchema { | ||
@Field({ nullable: true }) | ||
id?: string; | ||
|
||
@Field({ nullable: true }) | ||
country?: string; | ||
|
||
@Field({ nullable: true }) | ||
description?: string; | ||
|
||
@Field((type) => LocationSchema, { nullable: true }) | ||
latLng?: LocationSchema; | ||
} |
Oops, something went wrong.