You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cookie-api/cookie_api/schema.py

48 lines
1.4 KiB
Python

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
}