Moving to Typesystem
Moving to type system. Added registration endpoint. Added custom Decimal type.deb
parent
3ef15e7b48
commit
7b23ad97d8
@ -1,12 +1,48 @@
|
|||||||
from marshmallow import Schema, fields
|
from apistar import typesystem
|
||||||
|
# from marshmallow import Schema, fields
|
||||||
|
|
||||||
class CookieSchema(Schema):
|
from cookie_api.types import Datetime, Decimal
|
||||||
id = fields.Int()
|
|
||||||
created_date = fields.DateTime()
|
|
||||||
modified_date = fields.DateTime()
|
# class CookieSchema(Schema):
|
||||||
name = fields.Str(required=True)
|
# id = fields.Int()
|
||||||
recipe_url = fields.Str()
|
# created_date = fields.DateTime()
|
||||||
sku = fields.Str(required=True)
|
# modified_date = fields.DateTime()
|
||||||
qoh = fields.Int(required=True)
|
# name = fields.Str(required=True)
|
||||||
unit_cost = fields.Decimal(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
|
||||||
|
}
|
Loading…
Reference in New Issue