feat(pipelines): 添加流水线模块。

This commit is contained in:
Ivan
2021-03-01 15:22:45 +08:00
parent ea4ca724e3
commit e3e698b8cb
11 changed files with 208 additions and 1 deletions

View File

@@ -0,0 +1,44 @@
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 findPipelines(@Args('listPipelineArgs') dto: ListPipelineArgs) {
return await this.service.list(dto);
}
@Query(() => Pipeline)
async findPipeline(@Args('id', { type: () => String }) id: string) {
return await this.service.findOne(id);
}
@Mutation(() => Pipeline)
async createPipeline(
@Args('Pipeline', { type: () => CreatePipelineInput })
dto: UpdatePipelineInput,
) {
return await this.service.create(dto);
}
@Mutation(() => Pipeline)
async modifyPipeline(
@Args('id', { type: () => String }) id: string,
@Args('Pipeline', { type: () => UpdatePipelineInput })
dto: UpdatePipelineInput,
) {
const tmp = await this.service.update(id, dto);
console.log(tmp);
return tmp;
}
@Mutation(() => Number)
async deletePipeline(@Args('id', { type: () => String }) id: string) {
return await this.service.remove(id);
}
}