-
Notifications
You must be signed in to change notification settings - Fork 102
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
Moving debtor groups functions from ledger.js to debtorGroups.js #80
Moving debtor groups functions from ledger.js to debtorGroups.js #80
Conversation
function getGroupInvoices (id) { | ||
var def = q.defer(); | ||
|
||
if (!id) { def.reject(new Error('ERR_MISSING_REQUIRED_PARAMETERS')); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use a return
here to avoid making any database queries at all.
e1c0003
to
a1f9398
Compare
@@ -378,12 +379,19 @@ exports.configure = function (app) { | |||
app.get('/patients/search/name/:value', patient.searchFuzzy); | |||
app.get('/patients/search/reference/:value', patient.searchReference); | |||
|
|||
// Debtors API | |||
/** Debtors API */ | |||
/** @fixme `/debtors/groups` is deprecated, use `/debtor_groups` at the client side */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reference, there is a @deprecated tag in JSDoc. Pretty cool, huh?
@mbayopanda, this is an excellent pull request. You can ignore all my inline comments, they are for your information, not necessary fixes that need to land before this PR is merged. You are two critical tests for common conditions, that must be implemented before this API is usable:
These are two cases that will come up a lot. Once these two cases are implemented with passing tests, I'll merge this PR. It's a really good PR. |
@jniles i'm still waiting for your comment about this pull request, and in waiting that, i try some things with the breadcrumb directive |
|
||
db.exec(debtorDetailsQuery, [uuid]) | ||
.then(function (rows) { | ||
if (!rows.length) { return next(new req.codes.ERR_NOT_FOUND()); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reference, since you are in a promise chain, this line of code is equivalent:
if (!rows.length) { throw new req.codes.ERR_NOT_FOUND(); }
@mbayopanda , next time ping me with @jniles as soon as you've finished your changes. Your tests look good for the I've completed a second review. I know this PR is taking a while but the
After this change, we'll have a lot more confidence to use the API. Since you will be working on the client-side next, I think it will be a valuable change to make now. |
var expect = chai.expect; | ||
|
||
var helpers = require('./helpers'); | ||
var uuid = require('node-uuid'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's excellent to see you using node-uuid
. This is a step in the right direction!
LGTM. |
Moving debtor groups functions from ledger.js to debtorGroups.js
2447: Update chai-spies to the latest version 🚀 r=jniles a=greenkeeper[bot] ## Version **1.0.0** of [chai-spies](https://github.com/chaijs/chai-spies) was just published. <table> <tr> <th align=left> Dependency </td> <td> chai-spies </td> </tr> <tr> <th align=left> Current Version </td> <td> 0.7.1 </td> </tr> <tr> <th align=left> Type </td> <td> dependency </td> </tr> </table> The version **1.0.0** is **not covered** by your **current version range**. If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update. It might be worth looking into these changes and trying to get this project onto the latest version of chai-spies. If you have a solid test suite and good coverage, a passing build is a strong indicator that you can take advantage of these changes directly by merging the proposed change into your project. If the build fails or you don’t have such unconditional trust in your tests, this branch is a great starting point for you to work on the update. --- <details> <summary>Commits</summary> <p>The new version differs by 44 commits.</p> <ul> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/1f79da565cb6bb0d05968341179e5af3be786e28"><code>1f79da5</code></a> <code>chore(package): update rollup to version 0.53.4</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/ededa6af6786b9df2fdf5dbdb85dc921394e71e1"><code>ededa6a</code></a> <code>Merge pull request #93 from stalniy/feat/fn-body</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/9b599ca4b948a869dbf9397aeda63c609f21eaad"><code>9b599ca</code></a> <code>feat(spy): adds original function body to be exposed in spy.toString()</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/9a2d248098a2dfd7e804cc3691f8d8ad786b6116"><code>9a2d248</code></a> <code>docs(README): adds documentation about sandboxes and new methods</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/55ad5a5eca809015bddf69b9793125133b618adb"><code>55ad5a5</code></a> <code>1.0.0</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/509926a72174b178f0d78182a7b7a4463068550d"><code>509926a</code></a> <code>Merge pull request #91 from stalniy/fix/updates</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/27d9769faced90475edd22bf997cd3c1a71f53b9"><code>27d9769</code></a> <code>Fix formatting if readme</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/fc83ab53395c987c4d8729b895846d72835b9f83"><code>fc83ab5</code></a> <code>chore(travis): updates list of testing node versions</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/19dfebca47f0257e3095cf79249f01f230cf8ecb"><code>19dfebc</code></a> <code>chore(deps): upgrades rollup</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/c27ab283d2ecb7b74141aa62c1b4d20f9991a603"><code>c27ab28</code></a> <code>chore(package): drop support for node 0.x</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/f8c4df7d553e5e8c57a9c0ce0296b4052b00077f"><code>f8c4df7</code></a> <code>Merge pull request #84 from damianb/patch-2</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/fe7ed2a5cdef162bb97c180a92d731aa57c75a3a"><code>fe7ed2a</code></a> <code>Remove link to very dead project</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/fa6a9b05848952859134743e9ee6dd4f07c73f38"><code>fa6a9b0</code></a> <code>Merge pull request #80 from mLuby/patch-1</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/dab43739a19feb38be8ca5d9801d38cf6bc93b68"><code>dab4373</code></a> <code>Update Chai URL in README</code></li> <li><a href="https://urls.greenkeeper.io/chaijs/chai-spies/commit/e7530f11dbd4b4bdf4ef8d52d41ac2d2f429b9e9"><code>e7530f1</code></a> <code>Merge pull request #63 from chaijs/remove-lgtm</code></li> </ul> <p>There are 44 commits in total.</p> <p>See the <a href="https://urls.greenkeeper.io/chaijs/chai-spies/compare/9309677747faae40badb5219d1ef41d039273a60...1f79da565cb6bb0d05968341179e5af3be786e28">full diff</a></p> </details> <details> <summary>FAQ and help</summary> There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new). </details> --- Your [Greenkeeper](https://greenkeeper.io) bot 🌴
This PR :