-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix mappings from prisma models to domain objects accross the codebase #780
fix mappings from prisma models to domain objects accross the codebase #780
Conversation
…r BpiAccount and Stateleafvalues
…r BpiSubjectAccount
…r BpiWorkgroup and Workstep
…cts for BpiMerkleTree
export class PrismaMapper { | ||
constructor(private readonly merkleTreeService: MerkleTreeService) {} | ||
|
||
public mapBpiSubjectPrismaModelToDomainObject( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im a bit rusty with typescript, but can these be like generic method, and then only define these verbose methods if there is something more tricky than simple assign? generic like this (this is also ugly, but just as illustration):
public map<T extends object>(source: any, targetType: IConstructor<T>): T {
const target = this.activator(targetType)
Object.assign(target, source);
return target;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, spent some time during POC trying to implement the generic method but got stuck with some dumb issue and decided to leave it for later. Applied now everywhere based on your proposal, please rereview. We can improve as we go. @skosito
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Apply the previously approved POC for mapping of prisma models to domain objects across the codebase.
PR review hint: Go through commits one by one from oldest.
Related Issue
#740
Motivation and Context
Fixes broken mapping that was present previously
How Has This Been Tested
Ran all unit tests
Ran e2e test locally
Executed random endpoints via Postman manually
Screenshots (if appropriate)
Types of changes
Checklist