This commit is contained in:
38
src/schemas.py
Normal file
38
src/schemas.py
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
from flask_marshmallow.sqla import auto_field
|
||||
|
||||
from models import User
|
||||
from marshm import ma
|
||||
from marshmallow import fields
|
||||
|
||||
|
||||
"""
|
||||
Marshmallow schemas
|
||||
"""
|
||||
|
||||
|
||||
__author__ = "@tormakris"
|
||||
__copyright__ = "Copyright 2020, videON Team"
|
||||
__module_name__ = "schemas"
|
||||
__version__text__ = "1"
|
||||
|
||||
|
||||
class UserSchema(ma.Schema):
|
||||
"""
|
||||
Parameters:
|
||||
- name (string)
|
||||
- passowrd (string)
|
||||
"""
|
||||
|
||||
name = fields.String(required=True)
|
||||
password = fields.String(required=True)
|
||||
|
||||
|
||||
class UserMetadataSchema(ma.SQLAlchemyAutoSchema):
|
||||
"""
|
||||
Marshmallow schema generated
|
||||
"""
|
||||
class Meta:
|
||||
model = User
|
||||
exclude = ('timestamp', 'password',)
|
||||
creation_date = auto_field("timestamp", dump_only=False)
|
Reference in New Issue
Block a user