mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge of the middleware change to the branch
This commit is contained in:
commit
18cf5ac1b4
@ -1,5 +1,5 @@
|
|||||||
// import jwt from 'jsonwebtoken'
|
// import jwt from 'jsonwebtoken'
|
||||||
import { Resolver, Query, Args, Arg } from 'type-graphql'
|
import { Resolver, Query, Args, Arg, UseMiddleware } from 'type-graphql'
|
||||||
import CONFIG from '../../config'
|
import CONFIG from '../../config'
|
||||||
import { CheckUsernameResponse } from '../models/CheckUsernameResponse'
|
import { CheckUsernameResponse } from '../models/CheckUsernameResponse'
|
||||||
import { LoginResponse } from '../models/LoginResponse'
|
import { LoginResponse } from '../models/LoginResponse'
|
||||||
@ -15,6 +15,7 @@ import {
|
|||||||
} from '../inputs/LoginUserInput'
|
} from '../inputs/LoginUserInput'
|
||||||
import { apiPost, apiGet } from '../../apis/HttpRequest'
|
import { apiPost, apiGet } from '../../apis/HttpRequest'
|
||||||
import { KlicktippController } from '../../apis/KlicktippController'
|
import { KlicktippController } from '../../apis/KlicktippController'
|
||||||
|
import { registerMiddleware } from '../../middleware/registerMiddleware'
|
||||||
|
|
||||||
@Resolver()
|
@Resolver()
|
||||||
export class UserResolver {
|
export class UserResolver {
|
||||||
@ -73,6 +74,7 @@ export class UserResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Query(() => String)
|
@Query(() => String)
|
||||||
|
@UseMiddleware(registerMiddleware)
|
||||||
async create(
|
async create(
|
||||||
@Args() { email, firstName, lastName, password, language }: CreateUserArgs,
|
@Args() { email, firstName, lastName, password, language }: CreateUserArgs,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
|
|||||||
8
backend/src/middleware/registerMiddleware.ts
Normal file
8
backend/src/middleware/registerMiddleware.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { MiddlewareFn } from 'type-graphql'
|
||||||
|
|
||||||
|
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
||||||
|
export const registerMiddleware: MiddlewareFn = async ({ root, args, context, info }, next) => {
|
||||||
|
const result = await next()
|
||||||
|
// do something here
|
||||||
|
return result
|
||||||
|
}
|
||||||
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
/* Basic Options */
|
/* Basic Options */
|
||||||
// "incremental": true, /* Enable incremental compilation */
|
// "incremental": true, /* Enable incremental compilation */
|
||||||
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */
|
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */
|
||||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
||||||
// "lib": [], /* Specify library files to be included in the compilation. */
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user