feat(repos): 添加提交日志查询和分支查询

This commit is contained in:
Ivan Li
2021-02-19 13:11:03 +08:00
parent c2c5340278
commit dfaee1fb56
20 changed files with 279 additions and 5 deletions

View File

@ -0,0 +1,24 @@
import { ObjectType, Field } from '@nestjs/graphql';
import {
LogResult,
DefaultLogFields,
BranchSummary,
BranchSummaryBranch,
} from 'simple-git';
@ObjectType()
export class Branch implements BranchSummaryBranch {
current: boolean;
name: string;
commit: string;
label: string;
}
@ObjectType()
export class BranchesList {
detached: boolean;
current: string;
all: string[];
@Field(() => [Branch])
branches: Branch[];
}

View File

@ -0,0 +1,8 @@
import { InputType } from '@nestjs/graphql';
import { IsUUID } from 'class-validator';
@InputType()
export class ListBranchesArgs {
@IsUUID()
projectId: string;
}

View File

@ -0,0 +1,12 @@
import { InputType, ObjectType } from '@nestjs/graphql';
import { IsOptional, IsString, IsUUID } from 'class-validator';
@InputType()
export class ListLogsArgs {
@IsUUID()
projectId: string;
@IsString()
@IsOptional()
branch?: string;
}

View File

@ -0,0 +1,21 @@
import { ObjectType, Field } from '@nestjs/graphql';
import { LogResult, DefaultLogFields } from 'simple-git';
@ObjectType()
export class LogFields {
hash: string;
date: string;
message: string;
refs: string;
body: string;
author_name: string;
author_email: string;
}
@ObjectType()
export class LogsList implements LogResult<DefaultLogFields> {
@Field(() => [LogFields])
all: LogFields[];
total: number;
latest: LogFields;
}