feat: added graphql for AGW module with auth

pull/1/head
Artem-Darius Weber 2 years ago
parent 903db55e5c
commit a9f5e760fd

@ -0,0 +1,5 @@
PGADMIN_DEFAULT_EMAIL: placeholder@example.com
PGADMIN_DEFAULT_PASSWORD: fakepassword123!
POSTGRES_USER=root
POSTGRES_PASSWORD=root
POSTGRES_DB=root

@ -0,0 +1,15 @@
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
@Module({
imports: [
GraphQLModule.forRoot<ApolloDriverConfig>({
driver: ApolloDriver,
typePaths: ['./**/*.gql'],
context: ({ req }) => ({ req }),
playground: true,
}),
],
})
export class ApiGatewayModule {}

@ -2,9 +2,10 @@ import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import {ApiGatewayModule} from "../api-gateway/api-gateway.module";
@Module({
imports: [],
imports: [ApiGatewayModule],
controllers: [AppController],
providers: [AppService],
})

@ -0,0 +1,36 @@
type User {
id: ID!
name: String!
email: String!
password: String!
createdAt: String!
updatedAt: String!
}
type AuthPayload {
token: String!
user: User!
}
input SignUpInput {
name: String!
email: String!
password: String!
}
input SignInInput {
email: String!
password: String!
}
type Query {
me: User! @authenticated
}
type Mutation {
signUp(input: SignUpInput!): AuthPayload!
signIn(input: SignInInput!): AuthPayload!
signOut: Boolean! @authenticated
}
directive @authenticated on FIELD_DEFINITION

1261
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -5,11 +5,16 @@
"scripts": {},
"private": true,
"dependencies": {
"@apollo/server": "^4.7.5",
"@nestjs/apollo": "^12.0.3",
"@nestjs/common": "^10.0.2",
"@nestjs/core": "^10.0.2",
"@nestjs/graphql": "^12.0.3",
"@nestjs/platform-express": "^10.0.2",
"@nestjs/typeorm": "^10.0.0",
"@swc/helpers": "~0.5.0",
"axios": "^1.0.0",
"graphql": "^16.7.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"reflect-metadata": "^0.1.13",

Loading…
Cancel
Save