Skip to content

Commit

Permalink
IMN-862 Fix consumerDocument for bff (#1045)
Browse files Browse the repository at this point in the history
  • Loading branch information
rGregnanin authored Oct 1, 2024
1 parent 166703b commit 6c85746
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
12 changes: 12 additions & 0 deletions packages/backend-for-frontend/src/api/agreementApiConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,15 @@ export function toBffCompactAgreement(
canBeUpgraded: isAgreementUpgradable(eservice, agreement),
};
}

export function toBffAgreementConsumerDocument(
doc: agreementApi.Document
): bffApi.Document {
return {
id: doc.id,
name: doc.name,
prettyName: doc.prettyName,
contentType: doc.contentType,
createdAt: doc.createdAt,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
toCompactDescriptor,
} from "../api/catalogApiConverter.js";
import {
toBffAgreementConsumerDocument,
toBffCompactOrganization,
toCompactEserviceLight,
} from "../api/agreementApiConverter.js";
Expand Down Expand Up @@ -697,7 +698,9 @@ export async function enrichAgreement(
suspendedByProducer: agreement.suspendedByProducer,
suspendedByPlatform: agreement.suspendedByPlatform,
isContractPresent: agreement.contract !== undefined,
consumerDocuments: agreement.consumerDocuments,
consumerDocuments: agreement.consumerDocuments.map((doc) =>
toBffAgreementConsumerDocument(doc)
),
createdAt: agreement.createdAt,
updatedAt: agreement.updatedAt,
suspendedAt: agreement.suspendedAt,
Expand Down

0 comments on commit 6c85746

Please sign in to comment.