ethereum-oasis-op / baseline

The Baseline Protocol is an open source initiative that combines advances in cryptography, messaging, and distributed ledger technology to enable confidential and complex coordination between enterprises while keeping data in systems of record. This repo serves as the main repo for the Baseline Protocol, containing core packages, examples, and reference implementations.
https://docs.baseline-protocol.org
Other
577 stars 235 forks source link

SRI - Fix mapping from Prisma models to domain objects #740

Closed ognjenkurtic closed 10 months ago

ognjenkurtic commented 1 year ago

Overview

Currently automapping from Prisma models to domain objects is broken, as automapper complains about using type (Prisma model) when invoking the mapping so we use domain objects as source which causes various issues and worksarounds (look for TODOs with the id of this issue).

example of a wrong mapping:

return this.mapper.map(bpiAccountModel, BpiAccount, BpiAccount);

should be something like:

return this.mapper.map(bpiAccountModel, BpiAccountPrismaClientModel, BpiAccount);

Reference

https://github.com/nartc/mapper/discussions/280

Questions

Acceptance

ognjenkurtic commented 1 year ago

This branch has a POC of using the pojos strategy of automapper to achieve mapping from prisma model to a domain object, on the example of reading a bpi subject via an id:

https://github.com/eea-oasis/baseline/tree/feature/740-fix-mappings-from-prisma-models-to-domain-objects

Obviously some more polishing is needed but the overall approach works and can be utilized to solve the issue we currently have. Please have a look.

@biscuitdey @Kasshern @Therecanbeonlyone1969 @Ybittan