JobCompare / jc-api

API Management for JobCompare
MIT License
0 stars 0 forks source link

Implement QueryBuilder #9

Open bsoe003 opened 7 years ago

bsoe003 commented 7 years ago

The purpose of QueryBuilder class is to convert URI/URL query key-values to Camo-acceptable options. Here's an example:

  1. send GET request to the endpoint: /companies?match=name>goo&show=name,location,logo
  2. the req value grabbed by express will convert the query to:
    {
        match: 'name>goo',
        show: 'name,location,logo',
    }
  3. With QueryBuilder's conversion, we should be able to do following Camo statement:
    const result = await Company.find({ name: 'goo' }, { populate: ['name', 'location', 'logo'] });

Tasks:

Query Specs: TBD

Reference: