From baf797f427d524424356a426781b24661d631ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Allen=20Zhang=20=28=E5=BC=A0=E6=B6=9B=29?= Date: Thu, 22 Feb 2024 14:39:09 +0800 Subject: [PATCH] feat: hard code filepath --- .../src/sourcecode/sourcecode.service.ts | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/packages/canyon-backend/src/sourcecode/sourcecode.service.ts b/packages/canyon-backend/src/sourcecode/sourcecode.service.ts index 6c6c48fb..9c329305 100644 --- a/packages/canyon-backend/src/sourcecode/sourcecode.service.ts +++ b/packages/canyon-backend/src/sourcecode/sourcecode.service.ts @@ -7,14 +7,27 @@ export class SourcecodeService { constructor(private readonly prisma: PrismaService) {} getsourcecode(projectID, sha, filepath): Promise { - // return this.prisma.'' - return getFileInfo( - { - projectID, - filepath: encodeURIComponent(filepath.replace('~/', '')), - commitSha: sha, - }, - 'accessToken', - ); + // 实在不想硬编码 + if (projectID === '100807') { + return getFileInfo( + { + projectID, + filepath: encodeURIComponent( + filepath.replace('~/src/taro/pages/tnt', 'src/pages/tnt'), + ), + commitSha: sha, + }, + 'accessToken', + ); + } else { + return getFileInfo( + { + projectID, + filepath: encodeURIComponent(filepath.replace('~/', '')), + commitSha: sha, + }, + 'accessToken', + ); + } } }