-
Notifications
You must be signed in to change notification settings - Fork 21
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
Refactor getNotesOfChild to EntityMapper #221
Comments
https://pouchdb.com/guides/queries.html These indices affect two separate use cases:
I'm fine with statistics not being part of the EntityMapper, but traversing relations is a general problem: Health Checks, Notes, ChildSchoolRelationships, ... Shouln't the Entity to be queried by provide the map-function? export class Note extends Entity {
static ENTITY_TYPE = 'Note';
static dbViews : any = [/* All Design Docs relevant for the Entity */]
} The EntityMapper may then be queried like this: this._entityMapper.getRelational<Child, Note>(childId); At the point, this method is called, the EntityMapper should make sure that for both Child and Note the dbViews have been added to PouchDB and use the right index to execute the Query and construct the Entities. (There needs to be put some more thought into having metadata for the dbViews so that the EntityMapper can pick the correct one, but this seems like a solution to me) |
@TheSlimvReal How did you implement this for the ChildSchoolRelations? |
The idea behind our architecture of Therefore, I would try to put that stuff into The index for Notes is triggered in the constructor of |
I wanted to implement a function to get all Health Checks for a certain loaded child.
I wanted to do it familiar to the way we load notes of a child into the ChildDetailComponent.
But i dont know how to implement a index in pouchDB that i can query.
We should refactor and rethink the following:
In my opinion, this belongs into the Entity Mapper and should be made generic.
The text was updated successfully, but these errors were encountered: