odapi/app/schema.py

102 lines
2.7 KiB
Python
Raw Normal View History

2020-04-28 20:49:13 +02:00
from app import ma
from app.models import *
from marshmallow import fields
from marshmallow.validate import Length, Range
class UsersSchema(ma.Schema):
full_name = fields.Str(required=True, validate=Length(max=255))
email = fields.Email(required=True, validate=Length(max=255))
password = fields.Str(validate=Length(max=255))
gender = fields.Integer(required=True, validate=Range(min=1, max=2))
mobile = fields.Str(required=True, validate=Length(max=13))
user_image = fields.Str(validate=Length(max=255))
user_type = fields.Integer(required=True, validate=Range(min=1, max=2))
lang_type = fields.Integer(required=True, validate=Range(min=1, max=2))
device_type = fields.Integer(required=True, validate=Range(min=1, max=2))
device_id = fields.Str(required=True)
class CitiesSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Cities
load_instance = True
include_relationships = True
class GamesSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Games
load_instance = True
include_relationships = True
class PlayerAvailabilitiesSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = PlayerAvailabilities
load_instance = True
include_relationships = True
class PlayerCancelGamesSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = PlayerCancelGames
load_instance = True
include_relationships = True
class PurchaseGamesSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = PurchaseGames
load_instance = True
include_relationships = True
class SportsSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Sports
load_instance = True
include_relationships = True
class TeamsSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Teams
load_instance = True
include_relationships = True
class UserRatingsSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = UserRatings
load_instance = True
include_relationships = True
class VenueImagesSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = VenueImages
load_instance = True
include_relationships = True
class VenuesSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = Venues
load_instance = True
include_relationships = True
class ViewNewsSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = ViewNews
load_instance = True
include_relationships = True
class WebBookingsSchema(ma.SQLAlchemyAutoSchema):
class Meta:
model = WebBookings
load_instance = True
include_relationships = True