Permalink
Browse files

feat(repository): Added findPath and getResource methods for flexibil…

…ity.
  • Loading branch information...
RWOverdijk committed Dec 21, 2015
1 parent 986266f commit 2f32bafd3eba087dcbe49b1f6f58727066c0d514
Showing with 23 additions and 2 deletions.
  1. +23 −2 src/repository.js
@@ -27,15 +27,36 @@ export class Repository {
return this;
}
/**
* Get the resource name of this repository instance's reference.
*
* @return {string|null}
*/
getResource() {
return this.resource;
}
/**
* Perform a find query.
*
* @param {null|{}|Number} criteria Criteria to add to the query.
* @param {boolean} raw Set to true to get a POJO in stead of populated entities.
* @param {boolean} [raw] Set to true to get a POJO in stead of populated entities.
* @return {*}
*/
find(criteria, raw) {
let findQuery = this.api.find(this.resource, criteria);
return this.findPath(this.resource, criteria, raw);
}
/**
* Perform a find query for `path`.
*
* @param {string} path
@param {null|{}|Number} criteria Criteria to add to the query.
* @param {boolean} [raw] Set to true to get a POJO in stead of populated entities.
* @return {*}
*/
findPath(path, criteria, raw) {
let findQuery = this.api.find(path, criteria);
if (raw) {
return findQuery;

0 comments on commit 2f32baf

Please sign in to comment.