Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Zhang (张涛) committed Sep 12, 2024
1 parent 60f9cf9 commit 8fceffb
Showing 1 changed file with 54 additions and 2 deletions.
56 changes: 54 additions & 2 deletions packages/canyon-backend/src/coverage/coverage.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { CoverageService } from "./services/coverage.service";
import { PrismaService } from "../prisma/prisma.service";
import { CoverageReportsService } from "./services/coverage-reports.service";
import { ConsumerCoverageService } from "./services/core/consumer-coverage.service";
import { undefined } from "zod";

@Controller()
export class CoverageController {
Expand Down Expand Up @@ -63,7 +64,58 @@ export class CoverageController {
// /api/coverage
@Post("api/coverage/recalculation")
async recalculation(@Body() body): Promise<any> {
// return this.coverageService.recalculation(body);
return {};
console.log(body);
const pros = await this.prisma.project.findMany({
where: {
bu: "商旅",
},
});

const coverages = await this.prisma.coverage.findMany({
where: {
projectID: {
in: pros.map((item) => item.id),
},
covType: "agg",
updatedAt: {
gte: new Date("2024-09-09"),
},
},
select: {
branch: true,
buildID: true,
buildProvider: true,
compareTarget: true,
projectID: true,
reporter: true,
sha: true,
reportID: true,
updatedAt: true,
createdAt: true,
},
});

// for (let i = 0; i < coverages.length; i++) {
// const cov = coverages[i];
// await this.coverageClientService.invoke(cov.reporter, {
// branch: cov.branch,
// buildID: cov.buildID,
// buildProvider: cov.buildProvider,
// compareTarget: cov.compareTarget,
// key: "",
// tags: undefined,
// coverage: {},
// projectID: cov.projectID,
// instrumentCwd: "/builds",
// sha: cov.sha,
// reportID: cov.reportID,
// updatedAt: cov.updatedAt,
// createdAt: cov.createdAt,
// });
// }

return {
len: coverages.length,
};
}
}

0 comments on commit 8fceffb

Please sign in to comment.