From 65b88ea1317ae82643a2a2453bac6bbc0be5fa38 Mon Sep 17 00:00:00 2001 From: Seung Park Date: Wed, 15 Jan 2025 14:05:18 -0500 Subject: [PATCH] return repo branches displayname from db --- src/services/pool.ts | 4 ++++ tests/sampleData/reposBranches.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/services/pool.ts b/src/services/pool.ts index a2ef3f9..d526388 100644 --- a/src/services/pool.ts +++ b/src/services/pool.ts @@ -30,6 +30,7 @@ interface RepoDocument extends WithId { url: EnvKeyedObject; prefix: EnvKeyedObject; search: Record; + displayName?: string; } interface EnvKeyedURL { @@ -59,6 +60,7 @@ export interface BranchResponse { } export interface RepoResponse { + displayName?: string; repoName: string; project: string; search: Record; @@ -95,6 +97,7 @@ export const findAllRepos = async (options: FindOptions = {}, reqId?: string) => branches: 1, url: 1, prefix: 1, + displayName: 1, }, }; const findOptions = { ...defaultSort, ...options, ...strictOptions }; @@ -152,6 +155,7 @@ const mapDocsetRepo = (docsetRepo: DocsetRepoDocument): RepoResponse => { ? mapBranches(docsetRepo.branches, getRepoUrl(docset.url[ENV_URL_KEY], docset.prefix[ENV_URL_KEY])) : []; return { + displayName: docsetRepo.displayName, repoName: docsetRepo.repoName, project: docsetRepo.project, search: docsetRepo.search, diff --git a/tests/sampleData/reposBranches.ts b/tests/sampleData/reposBranches.ts index c6d13e0..66b2c19 100644 --- a/tests/sampleData/reposBranches.ts +++ b/tests/sampleData/reposBranches.ts @@ -4,6 +4,7 @@ export const sampleReposBranches = [ { _id: new ObjectId('5fc999ce3f17b4e8917e0494'), repoName: 'cloud-docs', + displayName: 'MongoDB Atlas', branches: [ { name: 'master', @@ -51,6 +52,7 @@ export const sampleReposBranches = [ { _id: new ObjectId('5f6aaeb682989d521a60636a'), repoName: 'docs-landing', + displayName: 'MongoDB Documentation', branches: [ { name: 'master', @@ -94,6 +96,7 @@ export const sampleReposBranches = [ { _id: new ObjectId('5fac1ce373a72fca02ec90c5'), repoName: 'docs', + displayName: 'MongoDB Manual', branches: [ { id: new ObjectId('6447e9e7e033e0a801c80f56'), @@ -349,6 +352,7 @@ export const sampleReposBranches = [ { _id: new ObjectId('614b9f5b8d181382ca755ade'), repoName: 'docs-mongodb-internal', + displayName: 'MongoDB Manual', branches: [ { id: new ObjectId('62e293ce8b1d857926ab4cca'),