feat: add field in infra type
This commit is contained in:
@@ -1,4 +1,10 @@
|
|||||||
import { ObjectType } from '@nestjs/graphql';
|
import { Field, ObjectType } from '@nestjs/graphql';
|
||||||
|
import { Admin } from './admin.model';
|
||||||
|
|
||||||
@ObjectType()
|
@ObjectType()
|
||||||
export class Infra {}
|
export class Infra {
|
||||||
|
@Field(() => Admin, {
|
||||||
|
description: 'Admin who executed the action',
|
||||||
|
})
|
||||||
|
executedBy: Admin;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,12 +1,5 @@
|
|||||||
import { UseGuards } from '@nestjs/common';
|
import { UseGuards } from '@nestjs/common';
|
||||||
import {
|
import { Args, ID, Query, ResolveField, Resolver } from '@nestjs/graphql';
|
||||||
Args,
|
|
||||||
ID,
|
|
||||||
Parent,
|
|
||||||
Query,
|
|
||||||
ResolveField,
|
|
||||||
Resolver,
|
|
||||||
} from '@nestjs/graphql';
|
|
||||||
import { GqlThrottlerGuard } from 'src/guards/gql-throttler.guard';
|
import { GqlThrottlerGuard } from 'src/guards/gql-throttler.guard';
|
||||||
import { Infra } from './infra.model';
|
import { Infra } from './infra.model';
|
||||||
import { AdminService } from './admin.service';
|
import { AdminService } from './admin.service';
|
||||||
@@ -29,11 +22,12 @@ export class InfraResolver {
|
|||||||
constructor(private adminService: AdminService) {}
|
constructor(private adminService: AdminService) {}
|
||||||
|
|
||||||
@Query(() => Infra, {
|
@Query(() => Infra, {
|
||||||
description: 'Gives details of the infra executing this query',
|
description: 'Fetch details of the Infrastructure',
|
||||||
})
|
})
|
||||||
@UseGuards(GqlAuthGuard, GqlAdminGuard)
|
@UseGuards(GqlAuthGuard, GqlAdminGuard)
|
||||||
infra(@GqlAdmin() admin: Admin) {
|
infra(@GqlAdmin() admin: Admin) {
|
||||||
return admin;
|
const infra: Infra = { executedBy: admin };
|
||||||
|
return infra;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResolveField(() => [User], {
|
@ResolveField(() => [User], {
|
||||||
|
|||||||
Reference in New Issue
Block a user