Skip to content

Commit

Permalink
Merge branch 'feature/filter-repositories' into enhancement/adds-avat…
Browse files Browse the repository at this point in the history
…ars-to-logins
  • Loading branch information
simonbs committed Jul 25, 2024
2 parents 724e63d + dcb2fba commit 4fc36ba
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ import { splitOwnerAndRepository } from "@/common"

export default class FilteringGitHubRepositoryDataSource implements IGitHubRepositoryDataSource {
private readonly dataSource: IGitHubRepositoryDataSource
private readonly hiddenRepositories: string[]
private readonly rawHiddenRepositories: string[]

constructor(config: {
dataSource: IGitHubRepositoryDataSource,
hiddenRepositories: string[]
}) {
this.dataSource = config.dataSource
this.hiddenRepositories = config.hiddenRepositories
this.rawHiddenRepositories = config.hiddenRepositories
}

async getRepositories(): Promise<GitHubRepository[]> {
const repositories = await this.dataSource.getRepositories()
const hiddenOwnerAndRepoNameList = this.hiddenRepositories
const hiddenRepositories = this.rawHiddenRepositories
.map(splitOwnerAndRepository)
.filter(e => e !== undefined)
return repositories.filter(repository => {
const hiddenMatch = hiddenOwnerAndRepoNameList.find(e =>
const hiddenMatch = hiddenRepositories.find(e =>
e.owner == repository.owner && e.repository == repository.name
)
return hiddenMatch === undefined
Expand Down

0 comments on commit 4fc36ba

Please sign in to comment.