-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemas.py
More file actions
30 lines (23 loc) · 783 Bytes
/
Copy pathschemas.py
File metadata and controls
30 lines (23 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from core import app, Marshmallow
from models import Product
serializer = Marshmallow(app)
class Products(serializer.Schema):
class Meta:
fields = ('id','title', 'image', 'price')
class OverloadCreate(serializer.Schema):
class Meta:
fields = ('id','overload_create')
class OverloadUpdate(serializer.Schema):
class Meta:
fields = ('id','overload_update')
# Schemas { Json }
class Schemas:
def overlayCreate():
content = OverloadCreate(many=True)
return content.jsonify(Product.default())
def overlayUpdate():
content = OverloadUpdate(many=True)
return content.jsonify(Product.default())
def overlayProducts():
content = Products(many=True)
return content.jsonify(Product.default())