feat(repos): 添加提交日志查询和分支查询
This commit is contained in:
24
src/repos/dtos/branches-list.model.ts
Normal file
24
src/repos/dtos/branches-list.model.ts
Normal 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[];
|
||||
}
|
8
src/repos/dtos/list-branches.args.ts
Normal file
8
src/repos/dtos/list-branches.args.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { InputType } from '@nestjs/graphql';
|
||||
import { IsUUID } from 'class-validator';
|
||||
|
||||
@InputType()
|
||||
export class ListBranchesArgs {
|
||||
@IsUUID()
|
||||
projectId: string;
|
||||
}
|
12
src/repos/dtos/list-logs.args.ts
Normal file
12
src/repos/dtos/list-logs.args.ts
Normal 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;
|
||||
}
|
21
src/repos/dtos/logs-list.model.ts
Normal file
21
src/repos/dtos/logs-list.model.ts
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user