import { Args, Mutation, Query, Resolver } from '@nestjs/graphql'; import { CreatePipelineInput } from './dtos/create-pipeline.input'; import { UpdatePipelineInput } from './dtos/update-pipeline.input'; import { Pipeline } from './pipeline.entity'; import { PipelinesService } from './pipelines.service'; import { ListPipelineArgs } from './dtos/list-pipelines.args'; @Resolver() export class PipelinesResolver { constructor(private readonly service: PipelinesService) {} @Query(() => [Pipeline]) async pipelines(@Args() dto: ListPipelineArgs) { return await this.service.list(dto); } @Query(() => Pipeline) async pipeline(@Args('id', { type: () => String }) id: string) { return await this.service.findOne(id); } @Mutation(() => Pipeline) async createPipeline( @Args('pipeline', { type: () => CreatePipelineInput }) dto: CreatePipelineInput, ) { return await this.service.create(dto); } @Mutation(() => Pipeline) async updatePipeline( @Args('pipeline', { type: () => UpdatePipelineInput }) dto: UpdatePipelineInput, ) { const tmp = await this.service.update(dto); console.log(tmp); return tmp; } @Mutation(() => Number) async deletePipeline(@Args('id', { type: () => String }) id: string) { return await this.service.remove(id); } }