|
|
|
from apistar import typesystem
|
|
|
|
# from marshmallow import Schema, fields
|
|
|
|
|
|
|
|
from cookie_api.types import Datetime, Decimal
|
|
|
|
|
|
|
|
|
|
|
|
# class CookieSchema(Schema):
|
|
|
|
# id = fields.Int()
|
|
|
|
# created_date = fields.DateTime()
|
|
|
|
# modified_date = fields.DateTime()
|
|
|
|
# name = fields.Str(required=True)
|
|
|
|
# recipe_url = fields.Str()
|
|
|
|
# sku = fields.Str(required=True)
|
|
|
|
# qoh = fields.Int(required=True)
|
|
|
|
# unit_cost = fields.Decimal(required=True)
|
|
|
|
|
|
|
|
|
|
|
|
class UserSchema(typesystem.Object):
|
|
|
|
description = 'A User respresentation'
|
|
|
|
properties = {
|
|
|
|
'id': typesystem.integer(),
|
|
|
|
'created_date': Datetime,
|
|
|
|
'modified_date': Datetime,
|
|
|
|
'email': typesystem.string(max_length=255),
|
|
|
|
'confirmed': typesystem.boolean(),
|
|
|
|
'admin': typesystem.boolean()
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class UserCreateSchema(typesystem.Object):
|
|
|
|
description = 'A User respresentation for creating a user'
|
|
|
|
properties = {
|
|
|
|
'email': typesystem.string(max_length=255),
|
|
|
|
'password': typesystem.string(max_length=255)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class CookieSchema(typesystem.Object):
|
|
|
|
properties = {
|
|
|
|
'id': typesystem.integer(),
|
|
|
|
'created_date': Datetime,
|
|
|
|
'modified_date': Datetime,
|
|
|
|
'name': typesystem.string(),
|
|
|
|
'recipe_url': typesystem.string(),
|
|
|
|
'sku': typesystem.string(),
|
|
|
|
'qoh': typesystem.integer(),
|
|
|
|
'unit_cost': Decimal
|
|
|
|
}
|