Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Question: async afterFetch not being called when extending User model #19

Open
kkomaz opened this issue Mar 5, 2019 · 1 comment
Open

Comments

@kkomaz
Copy link
Contributor

kkomaz commented Mar 5, 2019

When extending a user model, I tried calling the async afterFetch() function to add some relational information. I placed a debugger hoping it would hit when I fetch a single model via findOne however it does not hit.

screenshot of atom 3-4-19 7-22-47 pm

My workaround for this was to create a separate function

async addBasicInfo() {
  ...
}

then calling that function after the fetch is completed

  const user = await DebutUser.findOne({ username: action.payload.username })
  const debutUser = await user.addBasicInfo()

It would be nice if i could keep all the logic contained in the model itself as opposed to calling it on the user instance. Thoughts?

@hstove
Copy link
Collaborator

hstove commented Oct 22, 2019

Moving to icebox - afterFetch() should be working just fine, but it could use more test coverage.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants