diff --git a/api/src/core/adapters/GitLab/api/project.ts b/api/src/core/adapters/GitLab/api/project.ts index a1cff1f4..a281253b 100644 --- a/api/src/core/adapters/GitLab/api/project.ts +++ b/api/src/core/adapters/GitLab/api/project.ts @@ -37,7 +37,7 @@ const getLastMergeRequest = async (projectUrl: string) => { return getApiCallTakeFirst(`${projectUrl}/merge_requests?state=closed&sort=desc`); }; -export const projectEndpointMaker = (repoUrl: string | URL) => { +export const projectGitLabApiMaker = (repoUrl: string | URL) => { const apiProjectEndpoint = repoUrlToAPIUrl(repoUrl); return { diff --git a/api/src/core/adapters/hal/getHalSoftwareExternalData.ts b/api/src/core/adapters/hal/getHalSoftwareExternalData.ts index 268994f9..c4fde1d7 100644 --- a/api/src/core/adapters/hal/getHalSoftwareExternalData.ts +++ b/api/src/core/adapters/hal/getHalSoftwareExternalData.ts @@ -6,7 +6,7 @@ import { HalFetchError } from "./HalAPI/type"; import { SILL } from "../../../types/SILL"; import { HAL } from "./types/HAL"; import { repoAnalyser, RepoType } from "../../../tools/repoAnalyser"; -import { projectEndpointMaker } from "../GitLab/api/project"; +import { projectGitLabApiMaker } from "../GitLab/api/project"; const buildParentOrganizationTree = async ( structureIdArray: number[] | string[] | undefined @@ -222,17 +222,19 @@ export const getHalSoftwareExternalData: GetSoftwareExternalData = memoize( const getRepoMetadata = async (repoType: RepoType | undefined) => { switch (repoType) { case "GitLab": - const apiProject = projectEndpointMaker(halRawSoftware?.softCodeRepository_s?.[0]); - const lastCommit = await apiProject.commits.getLastCommit(); - const lastIssue = await apiProject.issues.getLastClosedIssue(); - const lastMergeRequest = await apiProject.mergeRequests.getLast(); + const gitLabProjectapi = projectGitLabApiMaker(halRawSoftware?.softCodeRepository_s?.[0]); + const lastGLCommit = await gitLabProjectapi.commits.getLastCommit(); + const lastFLIssue = await gitLabProjectapi.issues.getLastClosedIssue(); + const lastGLMergeRequest = await gitLabProjectapi.mergeRequests.getLast(); return { healthCheck: { - lastCommit: lastCommit ? new Date(lastCommit.created_at).valueOf() : undefined, + lastCommit: lastGLCommit ? new Date(lastGLCommit.created_at).valueOf() : undefined, lastClosedIssue: - lastIssue && lastIssue.closed_at ? new Date(lastIssue.closed_at).valueOf() : undefined, - lastClosedIssuePullRequest: lastMergeRequest - ? new Date(lastMergeRequest.updated_at).valueOf() + lastFLIssue && lastFLIssue.closed_at + ? new Date(lastFLIssue.closed_at).valueOf() + : undefined, + lastClosedIssuePullRequest: lastGLMergeRequest + ? new Date(lastGLMergeRequest.updated_at).valueOf() : undefined } }; diff --git a/api/src/tools/repoAnalyser.ts b/api/src/tools/repoAnalyser.ts index d451b007..de2d6b6a 100644 --- a/api/src/tools/repoAnalyser.ts +++ b/api/src/tools/repoAnalyser.ts @@ -9,9 +9,6 @@ export const repoAnalyser = async (url: string | URL | undefined): Promise