feat_the_progress_of_tasks #5
@ -2,4 +2,6 @@ import { InputType } from '@nestjs/graphql';
|
|||||||
import { CreatePipelineInput } from './create-pipeline.input';
|
import { CreatePipelineInput } from './create-pipeline.input';
|
||||||
|
|
||||||
@InputType()
|
@InputType()
|
||||||
export class UpdatePipelineInput extends CreatePipelineInput {}
|
export class UpdatePipelineInput extends CreatePipelineInput {
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
@ -9,12 +9,12 @@ import { ListPipelineArgs } from './dtos/list-pipelines.args';
|
|||||||
export class PipelinesResolver {
|
export class PipelinesResolver {
|
||||||
constructor(private readonly service: PipelinesService) {}
|
constructor(private readonly service: PipelinesService) {}
|
||||||
@Query(() => [Pipeline])
|
@Query(() => [Pipeline])
|
||||||
async listPipelines(@Args() dto: ListPipelineArgs) {
|
async pipelines(@Args() dto: ListPipelineArgs) {
|
||||||
return await this.service.list(dto);
|
return await this.service.list(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Query(() => Pipeline)
|
@Query(() => Pipeline)
|
||||||
async findPipeline(@Args('id', { type: () => String }) id: string) {
|
async pipeline(@Args('id', { type: () => String }) id: string) {
|
||||||
return await this.service.findOne(id);
|
return await this.service.findOne(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,12 +27,11 @@ export class PipelinesResolver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Mutation(() => Pipeline)
|
@Mutation(() => Pipeline)
|
||||||
async modifyPipeline(
|
async updatePipeline(
|
||||||
@Args('id', { type: () => String }) id: string,
|
|
||||||
@Args('Pipeline', { type: () => UpdatePipelineInput })
|
@Args('Pipeline', { type: () => UpdatePipelineInput })
|
||||||
dto: UpdatePipelineInput,
|
dto: UpdatePipelineInput,
|
||||||
) {
|
) {
|
||||||
const tmp = await this.service.update(id, dto);
|
const tmp = await this.service.update(dto);
|
||||||
console.log(tmp);
|
console.log(tmp);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -31,9 +31,9 @@ export class PipelinesService extends BaseDbService<Pipeline> {
|
|||||||
return await this.repository.save(this.repository.create(dto));
|
return await this.repository.save(this.repository.create(dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(id: string, dto: UpdatePipelineInput) {
|
async update(dto: UpdatePipelineInput) {
|
||||||
await this.isDuplicateEntityForUpdate(id, dto);
|
await this.isDuplicateEntityForUpdate(dto.id, dto);
|
||||||
const old = await this.findOne(id);
|
const old = await this.findOne(dto.id);
|
||||||
return await this.repository.save(this.repository.merge(old, dto));
|
return await this.repository.save(this.repository.merge(old, dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user