Merge branch 'jwt' of https://git.androiddrew.com/androiddrew/cookie-api into jwt
commit
37355d14cb
@ -1,4 +0,0 @@
|
||||
# config.ini
|
||||
|
||||
[user]
|
||||
BCRYPT_LOG_ROUNDS : 13
|
@ -0,0 +1,16 @@
|
||||
import sys
|
||||
import logbook
|
||||
|
||||
|
||||
def global_init(settings={}):
|
||||
_logging_setting = settings.get("LOGGING", {"LEVEL": logbook.TRACE})
|
||||
|
||||
_log_file = _logging_setting.get("LOG_FILE")
|
||||
_level = _logging_setting.get("LEVEL")
|
||||
|
||||
if _log_file is not None:
|
||||
logbook.TimedRotatingFileHandler(_log_file, level=_level).push_application()
|
||||
else:
|
||||
logbook.StreamHandler(sys.stdout, level=_level).push_application()
|
||||
|
||||
|
@ -1,25 +1,12 @@
|
||||
from marshmallow import Schema, fields, ValidationError
|
||||
|
||||
|
||||
def non_neg(value):
|
||||
if not value >= 0:
|
||||
raise ValidationError('Value cannot be negative')
|
||||
|
||||
|
||||
def non_neg_non_zero(value):
|
||||
if not value > 0:
|
||||
raise ValidationError('Value cannot be negative or zero')
|
||||
from marshmallow import Schema, fields
|
||||
|
||||
|
||||
class CookieSchema(Schema):
|
||||
id = fields.Int(dump_only=True)
|
||||
created_date = fields.DateTime(dump_only=True)
|
||||
id = fields.Int()
|
||||
created_date = fields.DateTime()
|
||||
modified_date = fields.DateTime()
|
||||
name = fields.Str(required=True, error_messages={'required': "Cookie name is required"})
|
||||
name = fields.Str(required=True)
|
||||
recipe_url = fields.Str()
|
||||
sku = fields.Str(required=True, error_messages={'required': "Cookie sku is required"})
|
||||
qoh = fields.Int(validate=non_neg, required=True, error_messages={'required': "Cookie qoh is required"})
|
||||
unit_cost = fields.Decimal(validate=non_neg_non_zero, required=True, error_messages={'required': "Cookie unit_cost is required"})
|
||||
|
||||
class Meta:
|
||||
ordered = True
|
||||
sku = fields.Str(required=True)
|
||||
qoh = fields.Int(required=True)
|
||||
unit_cost = fields.Decimal(required=True)
|
||||
|
Loading…
Reference in New Issue