Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Allen Zhang (张涛) committed Feb 19, 2024
1 parent c93b3ee commit 1cd368d
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions packages/canyon-backend/src/codechange/codechange.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,35 @@ export class CodechangeService {
constructor(private readonly prisma: PrismaService) {}

async getCodechange(sha, filepath) {
return this.prisma.codechange.findMany({
const { compareTarget } = await this.prisma.coverage.findFirst({
where: {
sha: sha,
path: filepath,
covType: 'all',
},
});
return this.prisma.codechange
.findFirst({
where: {
compareTarget,
sha: sha,
path: filepath.replace('~/', ''),
},
})
.then((r) => {
console.log(r);
if (r) {
return r;
} else {
return {
id: '',
projectID: '',
compareTarget: compareTarget,
sha: sha,
path: filepath.replace('~/', ''),
additions: [],
deletions: [],
};
}
});
}
}

0 comments on commit 1cd368d

Please sign in to comment.