Rename mapping functions to follow same patterns and conventions

This commit is contained in:
Charis Kyriakou
2023-04-13 09:37:03 +00:00
parent 296cbe1619
commit 05838a0198
3 changed files with 10 additions and 10 deletions

View File

@@ -1,8 +1,8 @@
import { outputJson, readJson } from "fs-extra";
import { VariantAnalysisScannedRepositoryState } from "../shared/variant-analysis";
import { VariantAnalysisScannedRepositoryStateDto } from "./repo-states-dto";
import { mapRepoStateToData } from "./repo-states-to-data-mapper";
import { mapRepoStateToDomain } from "./repo-states-to-domain-mapper";
import { mapRepoStateToDto } from "./repo-states-to-data-mapper";
import { mapRepoStateToDomainModel } from "./repo-states-to-domain-mapper";
export const REPO_STATES_FILENAME = "repo_states.json";
@@ -13,7 +13,7 @@ export async function writeRepoStates(
// Map from repoStates Domain type to the repoStates Data type
const repoStatesData = Object.fromEntries(
Object.entries(repoStates).map(([key, value]) => {
return [key, mapRepoStateToData(value)];
return [key, mapRepoStateToDto(value)];
}),
);
@@ -32,7 +32,7 @@ export async function readRepoStates(
// Map from repoStates Data type to the repoStates Domain type
const repoStates = Object.fromEntries(
Object.entries(repoStatesData).map(([key, value]) => {
return [key, mapRepoStateToDomain(value)];
return [key, mapRepoStateToDomainModel(value)];
}),
);

View File

@@ -8,17 +8,17 @@ import {
VariantAnalysisScannedRepositoryStateDto,
} from "./repo-states-dto";
export function mapRepoStateToData(
export function mapRepoStateToDto(
repoState: VariantAnalysisScannedRepositoryState,
): VariantAnalysisScannedRepositoryStateDto {
return {
repositoryId: repoState.repositoryId,
downloadStatus: processDownloadStatus(repoState.downloadStatus),
downloadStatus: mapDownloadStatusToDto(repoState.downloadStatus),
downloadPercentage: repoState.downloadPercentage,
};
}
function processDownloadStatus(
function mapDownloadStatusToDto(
downloadedStatus: VariantAnalysisScannedRepositoryDownloadStatus,
) {
switch (downloadedStatus) {

View File

@@ -8,17 +8,17 @@ import {
VariantAnalysisScannedRepositoryDownloadDto,
} from "./repo-states-dto";
export function mapRepoStateToDomain(
export function mapRepoStateToDomainModel(
repoState: VariantAnalysisScannedRepositoryStateDto,
): VariantAnalysisScannedRepositoryState {
return {
repositoryId: repoState.repositoryId,
downloadStatus: processDownloadStatus(repoState.downloadStatus),
downloadStatus: mapDownloadStatusToDomainModel(repoState.downloadStatus),
downloadPercentage: repoState.downloadPercentage,
};
}
function processDownloadStatus(
function mapDownloadStatusToDomainModel(
downloadedStatus: VariantAnalysisScannedRepositoryDownloadDto,
) {
switch (downloadedStatus) {