fix: Graphql 类型报错
This commit is contained in:
@ -4,7 +4,7 @@ import { IsOptional, IsString, IsUUID } from 'class-validator';
|
||||
@InputType()
|
||||
export class CheckoutInput {
|
||||
@IsUUID()
|
||||
projectId: string;
|
||||
pipelineId: string;
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
|
@ -1,18 +1,13 @@
|
||||
import { Args, Mutation, Query, Resolver } from '@nestjs/graphql';
|
||||
import { Args, Query, Resolver } from '@nestjs/graphql';
|
||||
import { ListLogsArgs } from './dtos/list-logs.args';
|
||||
import { ReposService } from './repos.service';
|
||||
import { LogList } from './dtos/log-list.model';
|
||||
import { ListBranchesArgs } from './dtos/list-branches.args';
|
||||
import { BranchList } from './dtos/branch-list.model';
|
||||
import { CheckoutInput } from './dtos/checkout.input';
|
||||
import { ProjectsService } from '../projects/projects.service';
|
||||
|
||||
@Resolver()
|
||||
export class ReposResolver {
|
||||
constructor(
|
||||
private readonly service: ReposService,
|
||||
private readonly projectService: ProjectsService,
|
||||
) {}
|
||||
constructor(private readonly service: ReposService) {}
|
||||
@Query(() => LogList)
|
||||
async listLogs(@Args('listLogsArgs') dto: ListLogsArgs) {
|
||||
return await this.service.listLogs(dto);
|
||||
@ -28,10 +23,4 @@ export class ReposResolver {
|
||||
};
|
||||
});
|
||||
}
|
||||
@Mutation(() => Boolean)
|
||||
async checkout(@Args('checkoutInput') dto: CheckoutInput): Promise<true> {
|
||||
const project = await this.projectService.findOne(dto.projectId);
|
||||
await this.service.checkoutCommit(project, dto.commitNumber);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user