mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Refactor of method name, adding Authorized in before response Type, KlickTipp check on Subscribed instead of not Unsubscribed.
This commit is contained in:
parent
123f45c853
commit
d5317c258a
@ -5,7 +5,7 @@ import { ObjectType, Field } from 'type-graphql'
|
||||
@ObjectType()
|
||||
export class KlickTipp {
|
||||
constructor(json: any) {
|
||||
this.newsletterState = json.status !== 'unsubscribed'
|
||||
this.newsletterState = json.status === 'Subscribed'
|
||||
}
|
||||
|
||||
@Field(() => Boolean)
|
||||
|
||||
@ -12,26 +12,26 @@ import { SubscribeNewsletterArguments } from '../inputs/KlickTippInputs'
|
||||
|
||||
@Resolver()
|
||||
export class KlicktippResolver {
|
||||
@Query(() => String)
|
||||
@Authorized()
|
||||
@Query(() => String)
|
||||
async getKlicktippUser(@Arg('email') email: string): Promise<string> {
|
||||
return await getKlickTippUser(email)
|
||||
}
|
||||
|
||||
@Query(() => String)
|
||||
@Authorized()
|
||||
@Query(() => String)
|
||||
async getKlicktippTagMap(): Promise<string> {
|
||||
return await getKlicktippTagMap()
|
||||
}
|
||||
|
||||
@Mutation(() => Boolean)
|
||||
@Authorized()
|
||||
@Mutation(() => Boolean)
|
||||
async unsubscribeNewsletter(@Arg('email') email: string): Promise<boolean> {
|
||||
return await unsubscribe(email)
|
||||
}
|
||||
|
||||
@Mutation(() => Boolean)
|
||||
@Authorized()
|
||||
@Mutation(() => Boolean)
|
||||
async subscribeNewsletter(
|
||||
@Args() { email, language }: SubscribeNewsletterArguments,
|
||||
): Promise<boolean> {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { MiddlewareFn } from 'type-graphql'
|
||||
import { signin, getKlickTippUser } from '../apis/KlicktippController'
|
||||
import { signIn, getKlickTippUser } from '../apis/KlicktippController'
|
||||
import { KlickTipp } from '../graphql/models/KlickTipp'
|
||||
|
||||
export const klicktippRegistrationMiddleware: MiddlewareFn = async (
|
||||
@ -11,11 +11,12 @@ export const klicktippRegistrationMiddleware: MiddlewareFn = async (
|
||||
// Do Something here before resolver is called
|
||||
const result = await next()
|
||||
// Do Something here after resolver is completed
|
||||
signin(result.email, result.language, result.firstName, result.lastName)
|
||||
await signIn(result.email, result.language, result.firstName, result.lastName)
|
||||
return result
|
||||
}
|
||||
|
||||
export const klicktippNewsletterStateMiddleware: MiddlewareFn = async (
|
||||
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
||||
{ root, args, context, info },
|
||||
next,
|
||||
) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user