This repository has been archived by the owner on Jun 11, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat($gateway): authentication module has coming now
Whats new: - Now we can login after registration - Now we can detecting for any action using queryMap based on userToken - Now client side can integrating from gateway - Preparing for intl integration Whats next: - 2FA in testing stage - Resetting and changing password on the queue Whats still needed: - Setting up mailer service (DevOps) - Setting up sqs or equal service for tasks queue (DevOps) - Text for License Agreement (Marketing) - Admin dashboard (Design) - ACL list and features for each (Marketing) Signed-off-by: Andrew Ghostuhin <[email protected]> ## For normal working still need working subdomains on 80 port
- Loading branch information
1 parent
2fdf1db
commit ba74844
Showing
16 changed files
with
184 additions
and
22 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
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 |
---|---|---|
@@ -1,9 +1,4 @@ | ||
import { Transform } from 'class-transformer' | ||
import { normalizePhone } from '@er/common' | ||
|
||
export class LoginDto { | ||
@Transform(normalizePhone) | ||
readonly phone: string | ||
|
||
readonly email: string | ||
readonly password: string | ||
} |
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 |
---|---|---|
@@ -1,12 +1,8 @@ | ||
import { defineMessages } from '@er/intl' | ||
|
||
export default defineMessages({ | ||
phoneNotFound: { | ||
id: 'api.auth.phone_not_found', | ||
defaultMessage: 'Пользователь с таким номером телефона не зарегистрирован', | ||
}, | ||
invalidPassword: { | ||
id: 'api.auth.invalid_password', | ||
defaultMessage: 'Неверный пароль', | ||
invalidEmailOrPassword: { | ||
id: 'api.invalid_email_or_password', | ||
defaultMessage: 'Невалидный Email адрес или пароль', | ||
}, | ||
}) |
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,5 @@ | ||
{ | ||
"cli": { | ||
"migrationsDir": "migrations" | ||
} | ||
} |
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,38 @@ | ||
{ | ||
"name": "@er/swt-gateway", | ||
"version": "1.0.0", | ||
"main": "src/index.ts", | ||
"license": "MIT", | ||
"scripts": { | ||
"dev": "nodemon --exec node -r ts-node/register --watch ../users/src --watch ../auth/src --watch ../verify/src --watch src src/index.ts", | ||
"typecheck": "tsc --target es2015 --module es2015 --moduleResolution node", | ||
"lint": "tslint --project tsconfig.json -c tslint.json -t codeFrame src/**/*.ts{,x}" | ||
}, | ||
"dependencies": { | ||
"@nestjs/common": "^5.2.2", | ||
"@nestjs/core": "^5.2.2", | ||
"@nestjs/graphql": "^3.0.0", | ||
"@nestjs/typeorm": "^5.2.0", | ||
"apollo-server-express": "^1.3.2", | ||
"apollo-upload-server": "^7.0.0", | ||
"class-validator": "^0.9.1", | ||
"graphql": "^0.13.2", | ||
"graphql-iso-date": "^3.5.0", | ||
"graphql-playground-middleware-express": "^1.7.3", | ||
"graphql-tools": "^3.1.1", | ||
"luxon": "^1.3.3", | ||
"pg": "^7.4.3", | ||
"reflect-metadata": "^0.1.12", | ||
"rxjs": "^6.1.0", | ||
"typeorm": "^0.2.7" | ||
}, | ||
"devDependencies": { | ||
"@types/graphql": "^0.13.4", | ||
"@types/node": "^10.9.3", | ||
"intl-tools": "^0.1.12", | ||
"nodemon": "^1.18.4", | ||
"ts-node": "^7.0.1", | ||
"tslint": "^5.9.1", | ||
"typescript": "^3.0.3" | ||
} | ||
} |
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,64 @@ | ||
import { Module, NestModule, MiddlewareConsumer } from '@nestjs/common' | ||
import { TypeOrmModule } from '@nestjs/typeorm' | ||
import { CoreModule } from './core' | ||
import { GraphQLModule, GraphQLFactory } from '@nestjs/graphql' | ||
import { UsersModule } from '@er/users' | ||
import { AccountModule } from '@er/account' | ||
import { GraphQLDate, GraphQLTime, GraphQLDateTime } from 'graphql-iso-date' | ||
import { graphqlExpress } from 'apollo-server-express' | ||
import graphqlPlayground from 'graphql-playground-middleware-express' | ||
import { AuthModule, AuthMiddleware } from '@er/auth' | ||
import { VerifyModule } from '@er/verify' | ||
|
||
@Module({ | ||
imports: [ | ||
TypeOrmModule.forRoot({ | ||
type: 'postgres', | ||
host: process.env.DB_HOST || 'db', | ||
database: process.env.DB_NAME || 'er', | ||
username: process.env.DB_USERNAME || 'root', | ||
password: process.env.DB_PASSWORD || 'root', | ||
entities: [ | ||
'../**/src/**/entities/**.ts', | ||
], | ||
migrations: [ | ||
'../**/migrations/**.ts', | ||
], | ||
migrationsRun: false, | ||
synchronize: true, | ||
logging: false, | ||
}), | ||
CoreModule, | ||
GraphQLModule, | ||
AuthModule, | ||
AccountModule, | ||
UsersModule, | ||
VerifyModule, | ||
], | ||
providers: [], | ||
}) | ||
export class ApplicationModule implements NestModule { | ||
constructor( | ||
private readonly graphQLFactory: GraphQLFactory, | ||
private readonly authMiddleware: AuthMiddleware, | ||
) {} | ||
|
||
configure(consumer: MiddlewareConsumer) { | ||
const schema = this.graphQLFactory.createSchema({ | ||
typeDefs: this.graphQLFactory.mergeTypesByPaths('../../**/*.graphql'), | ||
resolvers: { | ||
Date: GraphQLDate, | ||
Time: GraphQLTime, | ||
DateTime: GraphQLDateTime, | ||
}, | ||
}) | ||
|
||
consumer | ||
.apply(this.authMiddleware.resolve()) | ||
.forRoutes('/graphql') | ||
.apply(graphqlExpress(request => ({ schema, context: { user: request.user }, rootValue: request }))) | ||
.forRoutes('/graphql') | ||
.apply(graphqlPlayground({ endpoint: '/graphql' })) | ||
.forRoutes('/graphiql') | ||
} | ||
} |
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,13 @@ | ||
import { Module, Global } from '@nestjs/common' | ||
import { GlobalPubSub } from '@er/cqrs' | ||
|
||
@Global() | ||
@Module({ | ||
providers: [ | ||
GlobalPubSub, | ||
], | ||
exports: [ | ||
GlobalPubSub, | ||
], | ||
}) | ||
export class CoreModule {} |
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,18 @@ | ||
import { NestFactory } from '@nestjs/core' | ||
import { useContainer } from 'class-validator' | ||
import { MapErrorCodes } from '@er/common' | ||
import { ApplicationModule } from './app' | ||
|
||
async function bootstrap() { | ||
const app = await NestFactory.create(ApplicationModule) | ||
|
||
app.enableCors() | ||
|
||
useContainer(app, { fallback: true }) | ||
|
||
app.useGlobalInterceptors(new MapErrorCodes()) | ||
|
||
await app.listen(process.env.PORT || 3000) | ||
} | ||
|
||
bootstrap() |
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 @@ | ||
scalar DateTime | ||
scalar Date | ||
scalar Time |
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,6 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./dist" | ||
} | ||
} |
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,16 @@ | ||
{ | ||
"extends": ["tslint:latest"], | ||
"rules": { | ||
"quotemark": [true, "single"], | ||
"semicolon": [true, "never"], | ||
"object-literal-sort-keys": false, | ||
"object-literal-key-quotes": [true, "as-needed"], | ||
"member-access": false, | ||
"ordered-imports": false, | ||
"no-submodule-imports": false, | ||
"no-implicit-dependencies": false, | ||
"interface-name": false, | ||
"no-unused-variable": true, | ||
"arrow-parens": [true, "ban-single-arg-parens"] | ||
} | ||
} |