Skip to content

Commit

Permalink
chore: rename functions and variables
Browse files Browse the repository at this point in the history
  • Loading branch information
deeonwuli committed Jun 3, 2024
1 parent 1b3a3bf commit b6a1ce1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/domain/usecases/metadata/GetSharingSummaryUseCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { NamedRef } from "../../entities/Ref";
export class GetSharingSummaryUseCase {
constructor(private metadataRepository: MetadataRepository) {}

public execute(update: SharingUpdate, payload: MetadataPayload): FutureData<SharingSummary> {
public execute(update: SharingUpdate, updatedMetadata: MetadataPayload): FutureData<SharingSummary> {
const { baseElements, excludedDependencies } = update;

return this.metadataRepository.getMetadataWithChildren(baseElements).flatMap(selectedMetadata => {
const payloadsSummary = this.getPayloadsSummary(selectedMetadata, payload);
const metadataWithDifferentSharing = this.getMetadataWithDifferentSharing(payloadsSummary, baseElements);
const sharingWarnings = this.cleanMetadataSharing(metadataWithDifferentSharing);
const sharingPayload = this.getSharingPayload(payload, excludedDependencies);
return this.metadataRepository.getMetadataWithChildren(baseElements).flatMap(currentMetadata => {
const payloadsSummary = this.getPayloadsSummary(currentMetadata, updatedMetadata);
const metadataTree = this.buildMetadataTreeFromPayload(payloadsSummary, baseElements);
const sharingWarnings = this.getMetadataWithDifferentSharing(metadataTree);
const sharingPayload = this.getSharingPayload(updatedMetadata, excludedDependencies);

return this.metadataRepository.getMetadataFromIds(excludedDependencies).flatMap(excludedPayload => {
const excludedMetadata = this.getMetadataFromPayload(excludedPayload);
Expand Down Expand Up @@ -85,8 +85,8 @@ export class GetSharingSummaryUseCase {
return _.pickBy(sharingPayload, value => !_.isEmpty(value));
}

private cleanMetadataSharing(metadataSharingWithChildren: SharingWarning[]): SharingWarning[] {
return metadataSharingWithChildren
private getMetadataWithDifferentSharing(metadataTree: SharingWarning[]): SharingWarning[] {
return metadataTree
.map(item => {
const children = item.children.filter(child => {
const childSharing = {
Expand All @@ -111,7 +111,7 @@ export class GetSharingSummaryUseCase {
.filter(item => !_.isEmpty(item.children));
}

private getMetadataWithDifferentSharing(payload: MetadataPayload[], parentIds: string[]): SharingWarning[] {
private buildMetadataTreeFromPayload(payload: MetadataPayload[], parentIds: string[]): SharingWarning[] {
return _(payload)
.flatMap(payloadGroup =>
parentIds.map(parentId => {
Expand Down

0 comments on commit b6a1ce1

Please sign in to comment.