feat(pipelines): 添加流水线模块。
This commit is contained in:
44
src/pipelines/pipelines.resolver.ts
Normal file
44
src/pipelines/pipelines.resolver.ts
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user