2015-07-31 19:19:36 -04:00
|
|
|
Handler = require '../commons/Handler'
|
2016-04-06 13:56:06 -04:00
|
|
|
AnalyticsStripeInvoice = require './../models/AnalyticsStripeInvoice'
|
2015-07-31 19:19:36 -04:00
|
|
|
|
|
|
|
class AnalyticsStripeInvoiceHandler extends Handler
|
|
|
|
modelClass: AnalyticsStripeInvoice
|
|
|
|
jsonSchema: require '../../app/schemas/models/analytics_stripe_invoice'
|
|
|
|
|
|
|
|
hasAccess: (req) -> req.user?.isAdmin()
|
|
|
|
|
|
|
|
getByRelationship: (req, res, args...) ->
|
|
|
|
return @sendForbiddenError(res) unless @hasAccess(req)
|
|
|
|
return @getAll(req, res) if args[1] is 'all'
|
|
|
|
super(arguments...)
|
|
|
|
|
|
|
|
getAll: (req, res) ->
|
|
|
|
AnalyticsStripeInvoice.find {}, (err, docs) =>
|
|
|
|
return @sendDatabaseError(res, err) if err
|
|
|
|
@sendSuccess(res, docs)
|
|
|
|
|
|
|
|
module.exports = new AnalyticsStripeInvoiceHandler()
|