Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Donations controller #1315

Merged
merged 12 commits into from Dec 21, 2018
Merged

Donations controller #1315

merged 12 commits into from Dec 21, 2018

Conversation

vincemtnz
Copy link
Contributor

@vincemtnz vincemtnz commented Dec 20, 2018

Adds an endpoint to fetch the sum of all donations within a date range. For example:

GET /api/donations/totals?start=2018-12-01&end=2018-12-31
{
    "data": {
        "total_donations": {
            "AUD": "207.93",
            "CAD": "205.79",
            "CHF": "152.81",
            "EUR": "129.86",
            "GBP": "113.89",
            "NZD": "221.08",
            "USD": "159.81"
        }
    },
    "meta": {
        "end": "2018-12-31",
        "start": "2018-12-01"
    }
}

Leaving out the start and end query parameters will default to donations in the current calendar month.

If you only specify a start date, it will search from start to the end of the current calendar month. E.g.

GET /api/donations/totals?start=2018-10-01
{
    "data": {
        "total_donations": {
            "AUD": "909.91",
            "CAD": "900.53",
            "CHF": "668.68",
            "EUR": "568.27",
            "GBP": "498.33",
            "NZD": "967.44",
            "USD": "699.32"
        }
    },
    "meta": {
        "end": "2018-12-31",
        "start": "2018-10-01"
    }
}

If you provide a start date that is greater than the end date, the endpoint responds with an 400 Bad Request (the error raised is ArgumentError, 'Invalid date range').

PaperTrail updated and the following warning now appears:

> Association Tracking for PaperTrail has been extracted to a seperate gem.
> To use it, please add `paper_trail-association_tracking` to your Gemfile.
> If you don't use it (most people don't, that's the default) and you
> set `track_associations = false` somewhere (probably a rails initializer)
> you can remove that line now.

This commit removes that line.
@vincemtnz vincemtnz merged commit 700d4bb into development Dec 21, 2018
@vincemtnz vincemtnz deleted the feature/transactions-controller branch April 25, 2019 12:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant