Skip to content

Commit 5fdec5f

Browse files
committed
#291 : better name & clean console
1 parent 201d749 commit 5fdec5f

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

api/src/core/adapters/GitLab/api/project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const getLastMergeRequest = async (projectUrl: string) => {
3737
return getApiCallTakeFirst<MergeRequestSchema>(`${projectUrl}/merge_requests?state=closed&sort=desc`);
3838
};
3939

40-
export const projectEndpointMaker = (repoUrl: string | URL) => {
40+
export const projectGitLabApiMaker = (repoUrl: string | URL) => {
4141
const apiProjectEndpoint = repoUrlToAPIUrl(repoUrl);
4242

4343
return {

api/src/core/adapters/hal/getHalSoftwareExternalData.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { HalFetchError } from "./HalAPI/type";
66
import { SILL } from "../../../types/SILL";
77
import { HAL } from "./types/HAL";
88
import { repoAnalyser, RepoType } from "../../../tools/repoAnalyser";
9-
import { projectEndpointMaker } from "../GitLab/api/project";
9+
import { projectGitLabApiMaker } from "../GitLab/api/project";
1010

1111
const buildParentOrganizationTree = async (
1212
structureIdArray: number[] | string[] | undefined
@@ -222,17 +222,19 @@ export const getHalSoftwareExternalData: GetSoftwareExternalData = memoize(
222222
const getRepoMetadata = async (repoType: RepoType | undefined) => {
223223
switch (repoType) {
224224
case "GitLab":
225-
const apiProject = projectEndpointMaker(halRawSoftware?.softCodeRepository_s?.[0]);
226-
const lastCommit = await apiProject.commits.getLastCommit();
227-
const lastIssue = await apiProject.issues.getLastClosedIssue();
228-
const lastMergeRequest = await apiProject.mergeRequests.getLast();
225+
const gitLabProjectapi = projectGitLabApiMaker(halRawSoftware?.softCodeRepository_s?.[0]);
226+
const lastGLCommit = await gitLabProjectapi.commits.getLastCommit();
227+
const lastFLIssue = await gitLabProjectapi.issues.getLastClosedIssue();
228+
const lastGLMergeRequest = await gitLabProjectapi.mergeRequests.getLast();
229229
return {
230230
healthCheck: {
231-
lastCommit: lastCommit ? new Date(lastCommit.created_at).valueOf() : undefined,
231+
lastCommit: lastGLCommit ? new Date(lastGLCommit.created_at).valueOf() : undefined,
232232
lastClosedIssue:
233-
lastIssue && lastIssue.closed_at ? new Date(lastIssue.closed_at).valueOf() : undefined,
234-
lastClosedIssuePullRequest: lastMergeRequest
235-
? new Date(lastMergeRequest.updated_at).valueOf()
233+
lastFLIssue && lastFLIssue.closed_at
234+
? new Date(lastFLIssue.closed_at).valueOf()
235+
: undefined,
236+
lastClosedIssuePullRequest: lastGLMergeRequest
237+
? new Date(lastGLMergeRequest.updated_at).valueOf()
236238
: undefined
237239
}
238240
};

api/src/tools/repoAnalyser.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ export const repoAnalyser = async (url: string | URL | undefined): Promise<RepoT
99
return undefined;
1010
}
1111

12-
const test = urlObj.origin;
13-
console.log(test);
14-
1512
if (urlObj.origin === "https://github.com") {
1613
return "GitHub";
1714
}

0 commit comments

Comments
 (0)