Compare commits

...

2 Commits

3 changed files with 6 additions and 3 deletions

View File

@ -3,6 +3,7 @@ import {
IsOptional,
IsString,
IsUrl,
Matches,
MaxLength,
MinLength,
} from 'class-validator';
@ -19,7 +20,9 @@ export class CreateProjectInput {
@MinLength(2)
comment: string;
@IsUrl({ protocols: ['ssh'] })
@Matches(
/^(?:ssh:\/\/)?(?:[\w\d-_]+@)(?:[\w\d-_]+\.)*\w{2,10}(?::\d{1,5})?(?:\/[\w\d-_.]+)*/,
)
@MaxLength(256)
sshUrl: string;

View File

@ -13,7 +13,7 @@ export class ReposResolver {
return await this.service.listLogs(dto);
}
@Query(() => BranchList)
async ListBranchesArgs(
async listBranches(
@Args('listBranchesArgs') dto: ListBranchesArgs,
): Promise<BranchList> {
return await this.service.listBranches(dto).then((data) => {

View File

@ -31,7 +31,7 @@ export class ReposService {
// TODO: 获取锁,失败抛错。
}
async getGit(project: Project, subDir?: string) {
async getGit(project: Project, subDir = 'default') {
const workspaceRoot = this.getWorkspaceRoot(project, subDir);
await this.lockWorkspace(workspaceRoot);