feat(repos): 添加订阅commit log 接口。

This commit is contained in:
Ivan
2021-03-08 11:26:12 +08:00
parent ba0ba46a35
commit 22d3dc299c
6 changed files with 60 additions and 29 deletions

View File

@@ -1,3 +1,4 @@
import { ListLogsOption } from './models/list-logs.options';
import { Pipeline } from './../pipelines/pipeline.entity';
import { PipelineTask } from './../pipeline-tasks/pipeline-task.entity';
import { Injectable, NotFoundException } from '@nestjs/common';
@@ -47,14 +48,9 @@ export class ReposService {
return git;
}
async listLogs(dto: ListLogsArgs) {
const project = await this.projectRepository.findOneOrFail({
id: dto.projectId,
});
async listLogs({ project, branch }: ListLogsOption) {
const git = await this.getGit(project);
return await git.log(
dto.branch ? ['--branches', dto.branch, '--'] : ['--all'],
);
return await git.log(branch ? ['--branches', branch, '--'] : ['--all']);
}
async listBranches(dto: ListBranchesArgs) {