Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Zhang (张涛) committed Jul 22, 2024
1 parent fc54a59 commit 6fdb7de
Showing 1 changed file with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { Injectable, UnauthorizedException } from '@nestjs/common';
import {
HttpException,
Injectable,
UnauthorizedException,
} from '@nestjs/common';
import { PrismaService } from '../../prisma/prisma.service';
import { CoverageClientDto } from '../dto/coverage-client.dto';
import { Coverage } from '@prisma/client';
Expand Down Expand Up @@ -53,6 +57,20 @@ export class CoverageClientService {
}
}

// 3.检验 project 是否存在
const project = await this.prisma.project.findFirst({
where: {
id: coverageClientDto.projectID,
},
select: {
instrumentCwd: true,
},
});
if (!project) {
// 返回错误,项目不存在
throw new HttpException('project not found', 400);
}

coverageClientDto.sha = coverageClientDto.commitSha;

// 注意这里还是小驼峰
Expand Down Expand Up @@ -96,14 +114,6 @@ export class CoverageClientService {
//后加的
coverage: coverageReport.coverage,
};
const project = await this.prisma.project.findFirst({
where: {
id: cov.projectID,
},
select: {
instrumentCwd: true,
},
});
const dataFormatAndCheckQueueDataToBeConsumed =
await this.dataFormatAndCheck(cov, project?.instrumentCwd);

Expand Down

0 comments on commit 6fdb7de

Please sign in to comment.