Skip to content
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(auto-mapper): fix processing simple object #26

Merged
merged 1 commit into from
Jan 5, 2023

Conversation

4lessandrodev
Copy link
Owner

Describe the bug
toObject method on entity is not processing simple objects

To Reproduce

interface Profile {
  name: string;
  age: number;
}

interface Props {
  id?: UID;
  profile: Profile;
}

class Example extends Entity<Props>{}

const example = Example.create({ profile: { name: "Jane", age:21 } }).value();

console.log(example.toObject()):

> {  
       id: "4666ce4b-10d9-4999-9da8-0caef5b7fd50", 
       createdAt: "2023-01-05T18:34:54.198Z", 
       updatedAt: "2023-01-05T18:34:54.198Z" 
 };

Expected behavior
the toObject method should process simple object and apply it to generated props

console.log(example.toObject()):

> {  
       id: "4666ce4b-10d9-4999-9da8-0caef5b7fd50", 
       createdAt: "2023-01-05T18:34:54.198Z", 
       updatedAt: "2023-01-05T18:34:54.198Z",
       profile: { name: "Jane", age: 21 }
 };

Lib Version
rich-domain v1.15.1

#25

@4lessandrodev 4lessandrodev merged commit 8f5dd36 into main Jan 5, 2023
@4lessandrodev 4lessandrodev deleted the fix/auto-mapper branch January 13, 2023 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant