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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Extend wilayaProjection to project nested fields #27

Open
Fcmam5 opened this issue Sep 30, 2020 · 7 comments
Open

Feature request: Extend wilayaProjection to project nested fields #27

Fcmam5 opened this issue Sep 30, 2020 · 7 comments
Assignees
Labels
enhancement New feature or request Hacktoberfest

Comments

@Fcmam5
Copy link
Collaborator

Fcmam5 commented Sep 30, 2020

Related to wilayaProjection:

The goal if this helper function is to return only the Wilaya objects properties that a user wants (Otherwise they will receive an element like this big & ugly 馃槃 ).

For now we can use this feature to only return only wilaya fields we want (example, and it will be great if we can project dairats (a Wilaya property containing an array of objects).

So when we call:

projectWilaya(someWilayaObject, ['name', 'dairats.name']);

You should only return the wilaya name and only names of its dairats.

We'd prefer a simple and minimalist solution, but if needed you can use any library you like. If you need some inspiration you can check projects like jq. Or just keep it simple, split by . and then add a magical recursive function to project daira object

@Fcmam5
Copy link
Collaborator Author

Fcmam5 commented Sep 30, 2020

@InternetRamen can you take it?

@InternetRamen
Copy link

@Fcmam5 I think I can take it.

@InternetRamen
Copy link

@Fcmam5 In your example,
projectWilaya(someWilayaObject, ['name', 'dairats.name']);, would it return ['name', 'theNameOfDairats'] or something more like ['name', {name: "theNameOfDairats"}}

@Fcmam5
Copy link
Collaborator Author

Fcmam5 commented Oct 1, 2020

I mean that if we want only the wilaya name, and its dairats' names we call it with projectWilaya(someWilayaObject, ['name', 'dairats.name']);
Example: For Adrar wilaya object, I'd expect it to return something like:

[
  {
    "name": "Adrar",
    "dairats": [
      {
        "name": "ADRAR"
      },
      {
        "name": "CHAROUINE"
      },
      {
        "name": "REGGANE"
      },
      ...
    ]
  }
]     

@InternetRamen
Copy link

#28

@AMTazi
Copy link
Contributor

AMTazi commented Dec 4, 2020

@Fcmam5 mattricule is mandatory or it was just a typo?

@Fcmam5
Copy link
Collaborator Author

Fcmam5 commented Dec 5, 2020

@Fcmam5 mattricule is mandatory or it was just a typo?

Sorry, it was a typo 馃槄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Hacktoberfest
Projects
Status: Backlog
Development

No branches or pull requests

3 participants