diff --git a/backend/src/graphql/model/User.ts b/backend/src/graphql/model/User.ts index 496f263d9..3558a0840 100644 --- a/backend/src/graphql/model/User.ts +++ b/backend/src/graphql/model/User.ts @@ -1,3 +1,4 @@ +import { ROLE_NAMES } from '@/auth/ROLES' import { User as dbUser } from '@entity/User' import { ObjectType, Field, Int } from 'type-graphql' @@ -19,7 +20,17 @@ export class User { this.language = user.language this.publisherId = user.publisherId if (user.userRole) { - this.isAdmin = user.userRole.createdAt + switch (user.userRole.role) { + case ROLE_NAMES.ROLE_NAME_ADMIN: + this.isAdmin = user.userRole.createdAt + break + case ROLE_NAMES.ROLE_NAME_MODERATOR: + this.isModerator = user.userRole.createdAt + break + default: + this.isAdmin = null + this.isModerator = null + } } this.klickTipp = null this.hasElopage = null @@ -67,6 +78,9 @@ export class User { @Field(() => Date, { nullable: true }) isAdmin: Date | null + @Field(() => Date, { nullable: true }) + isModerator: Date | null + @Field(() => KlickTipp, { nullable: true }) klickTipp: KlickTipp | null