})

budget_fields = fields.Nested({
    'id': fields.Integer,
    'color': fields.String,
    'name': fields.String,
})

payment_fields = fields.Nested({
    'name': fields.String,
    'id': fields.Integer,
    'member': member_fields,
    'payment_type': payment_type_fields,
    'budget': budget_fields,
    'date': fields.DateTime(dt_format='iso8601'),
    'cost': fields.Price(decimals=2),
})

resource_fields = {
    'transactions':
    fields.List(
        fields.Nested({
            'id': fields.Integer(),
            'date': fields.DateTime(dt_format='iso8601'),
            'title': fields.String(),
            'name': fields.String(),
            'cost': fields.Price(decimals=2),
            'iban': fields.String(),
            'payments': fields.List(payment_fields),
            'proposed_member_id': fields.String,
            'proposed_type_name': fields.String,
Beispiel #2
0
query_parser.add_argument('month', type=month_type)


transaction_fields = {
    'date': fields.DateTime(dt_format='iso8601'),
    'name': fields.String,
    'title': fields.String,
}

member_fields = fields.Nested({
    'name': fields.String,
    'id': fields.Integer,
})

month_fields = {
    'sum': fields.Price(2),
    'count': fields.Integer,
}

payment_sum_fields = {
    'member_id': fields.Integer,
    'months': cebulany_fields.Dict(fields.Nested(month_fields)),
}


class PaymentTableResource(ModelListResource):
    cls = Payment
    parser = parser
    resource_fields = payment_sum_fields

    @marshal_with(payment_sum_fields)
from flask_restful import Resource, Api, reqparse, fields, marshal_with
from flask_mail import Message
from .base_email import mail

from models.database import (db, ComissionModel, MonthComissionModel,
                             SellerModel, SellerComissionModel)

comission_fields_post = {'id': fields.Integer}

comission_fields_get = {
    'id': fields.Integer,
    'min_value': fields.Price(decimals=2),
    'lower_percentage': fields.Float(),
    'upper_percentage': fields.Float()
}

parser_comission = reqparse.RequestParser(bundle_errors=True)

parser_comission.add_argument('min_value',
                              type=float,
                              required=True,
                              help='min_value is required')

parser_comission.add_argument('lower_percentage',
                              type=float,
                              required=True,
                              help='lower_percentage is required')

parser_comission.add_argument('upper_percentage',
                              type=float,
                              required=True,
import json
import models
from resources.restaurants import restaurant_fields
from resources.users import user_fields
from peewee import *
from flask import jsonify, Blueprint, abort
from flask_restful import (Resource, Api, reqparse, inputs, fields, marshal,
                           marshal_with, url_for)

reservation_fields = {
    'id': fields.Integer,
    'restaurant_id': fields.Nested(restaurant_fields),
    'seller_id': fields.Nested(user_fields),
    'current_owner_id': fields.Nested(user_fields),
    'party_size': fields.Integer,
    'price': fields.Price(2),
    'date': fields.String,
    'time': fields.String,
    'is_closed': fields.Boolean,
    'is_sold': fields.Boolean
}


class Reservation_List(Resource):
    def __init__(self):
        self.reqparse = reqparse.RequestParser()
        self.reqparse.add_argument('user_id',
                                   required=False,
                                   help='No user ID provided',
                                   location=['json', 'args'])
        self.reqparse.add_argument('restaurant_id',