-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f5c310
commit 443b0d9
Showing
4 changed files
with
61 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,35 @@ | ||
import { Controller, Get } from "@nestjs/common"; | ||
import {Controller, Get, Query} from "@nestjs/common"; | ||
import {CoverageMapService} from "./services/coverage-map.service"; | ||
import {CoverageSummaryMapService} from "./services/coverage-summary-map.service"; | ||
// import { PrismaService } from "./prisma/prisma.service"; | ||
// import { convertSystemSettingsFromTheDatabase } from "./utils/sys"; | ||
|
||
@Controller() | ||
export class AppController { | ||
constructor(private readonly coverageMapService: CoverageMapService) {} | ||
@Get("api/coverage/map") | ||
async viHealth() { | ||
return this.coverageMapService.invoke(); | ||
} | ||
constructor( | ||
private readonly coverageMapService: CoverageMapService, | ||
private readonly coverageSummaryMapService: CoverageSummaryMapService | ||
) {} | ||
@Get("vi/health") | ||
async viHealth2() { | ||
return "230614"; | ||
} | ||
@Get("api/coverage/map") | ||
async coverageMap() { | ||
return this.coverageMapService.invoke({ | ||
projectID: "1", | ||
sha: "1", | ||
reportID: "1", | ||
// filepath: " | ||
}); | ||
} | ||
@Get("api/coverage/summary/map") | ||
async coverageSummaryMap(@Query() coverageSummaryDto: any) { | ||
const { projectID, sha, reportID } = coverageSummaryDto; | ||
return this.coverageSummaryMapService.invoke({ projectID, | ||
sha, | ||
// reportID, | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {Injectable} from "@nestjs/common"; | ||
import {Repository} from "typeorm"; | ||
import {InjectRepository} from "@nestjs/typeorm"; | ||
import {CoverageUtEntity} from "../entity/coverage-ut.entity"; | ||
import {decompressedData} from "canyon-map"; | ||
|
||
@Injectable() | ||
export class CoverageSummaryMapService { | ||
constructor(@InjectRepository(CoverageUtEntity) private readonly repo: Repository<CoverageUtEntity>) { } | ||
|
||
async invoke({ | ||
projectID, | ||
sha, | ||
// reportID, | ||
}) { | ||
const data = await this.repo.findOne({ | ||
where:{ | ||
projectID, | ||
sha, | ||
} | ||
}); | ||
// console.log(data); | ||
|
||
// @ts-ignore | ||
const res = (await decompressedData(data.summary)) | ||
|
||
return res | ||
} | ||
|
||
} |