コード例 #1
0
class ExemptionUpdated(Resource):
    @api.marshal_with(page_of(exemption_item))
    @api.response(404, 'Exemption item not found.')
    def get(self, from_date, to_date):
        """ Returns exemptions updated between 'from' and 'to'. """
        return paginate(page_args, Exemption.query.filter(
            Exemption.last_update_date >= from_date & Exemption.last_update_date <= to_date))
コード例 #2
0
class ExemptionNewBy(Resource):
    @api.marshal_with(page_of(exemption_item))
    @api.response(404, 'Exemption item not found.')
    def get(self, days):
        """ Returns exemptions since the last given 'days'. """
        first_date = datetime.datetime.now() - datetime.timedelta(days=days + 1)
        return paginate(page_args, Exemption.query.filter(
            Exemption.last_update_date >= first_date).order_by(Exemption.last_update_date.desc))
コード例 #3
0
class ProcurementBudget(Resource):
    @api.marshal_with(page_of(procurement_item))
    @api.response(404, 'Procurement item not found.')
    def get(self, code):
        """ Returns procurements for code. """
        return paginate(
            page_args,
            Procurement.query.filter(Procurement.budget_code == code))
コード例 #4
0
class ProcurementEntity(Resource):
    @api.marshal_with(page_of(procurement_item))
    @api.response(404, 'Procurement item not found.')
    def get(self, entity_id):
        """ Returns procurements for entity. """
        return paginate(
            page_args,
            Procurement.query.filter(Procurement.entity_id == entity_id))
コード例 #5
0
class ChangesCode(Resource):
    @api.marshal_with(page_of(changes_item))
    @api.response(404, 'Changes not found.')
    def get(self, code):
        """ Returns changes for code """
        return paginate(
            page_args,
            Changes.query.filter(Changes.budget_code == code).order_by(
                Changes.year.desc(), Changes.date.desc()))
コード例 #6
0
class SupportEntity(Resource):
    @api.marshal_with(page_of(support_item))
    @api.response(404, 'Support item not found.')
    def get(self, entity_id):
        """ Returns supports for entity. """
        return paginate(
            page_args,
            Support.query.filter(Support.entity_id == entity_id).order_by(
                Support.year.desc))
コード例 #7
0
class SupportCode(Resource):
    @api.marshal_with(page_of(support_item))
    @api.response(404, 'Support item not found.')
    def get(self, code):
        """ Returns supports for code prefix. """
        return paginate(
            page_args,
            Support.query.filter(Support.code.like(code + '%')).order_by(
                Support.year))
コード例 #8
0
class ProcurementCodeKids(Resource):
    @api.marshal_with(page_of(procurement_item))
    @api.response(404, 'Procurement item not found.')
    def get(self, code):
        """ Returns procurements for code prefix. """
        return paginate(
            page_args,
            Procurement.query.filter(
                Procurement.budget_code.like(code + '%')).order_by(
                    Procurement.order_date))
コード例 #9
0
class SupportKindCode(Resource):
    @api.marshal_with(page_of(support_item))
    @api.response(404, 'Support item not found.')
    def get(self, kind, code):
        """ Returns supports for kind and code prefix. """
        return paginate(
            page_args,
            Support.query.filter(Support.kind == kind,
                                 Support.code.like(code + '%'),
                                 func.length(Support.code) == len(code) + 2))
コード例 #10
0
class ChangesLeadingReqYear(Resource):
    @api.marshal_with(page_of(changes_item))
    @api.response(404, 'Changes not found.')
    def get(self, leading_item, req_code, year):
        """ Returns changes by leading item, required code and year """
        return paginate(
            page_args,
            Changes.query.filter(Changes.leading_item == leading_item,
                                 Changes.req_code == req_code,
                                 Changes.year == year).order_by(
                                     Changes.date.desc()))
コード例 #11
0
class ExemptionNew(Resource):
    @api.marshal_with(page_of(exemption_item))
    @api.response(404, 'Exemption item not found.')
    def get(self):
        """ Returns exemption last updated. """
        return paginate(page_args, Exemption.query.order_by(Exemption.last_update_date.desc))
コード例 #12
0
class ExemptionBudget(Resource):
    @api.marshal_with(page_of(exemption_item))
    @api.response(404, 'Exemption item not found.')
    def get(self, code):
        """ Returns exemptions for budget code. """
        return paginate(page_args, Exemption.query.filter(Exemption.budget_code == code))
コード例 #13
0
class SupportKind(Resource):
    @api.marshal_with(page_of(support_item))
    @api.response(404, 'Support item not found.')
    def get(self, kind):
        """ Returns supports for kind. """
        return paginate(page_args, Support.query.filter(Support.kind == kind))
コード例 #14
0
class SupportRecipientYear(Resource):
    @api.marshal_with(page_of(support_item))
    @api.response(404, 'Support item not found.')
    def get(self, recipient, year):
        """ Returns supports for recipient. """
        raise NotImplementedError