Skip to content

Instantly share code, notes, and snippets.

@gfreezy
Last active April 17, 2017 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfreezy/afccb17720087b763a7c3d0bf8122d95 to your computer and use it in GitHub Desktop.
Save gfreezy/afccb17720087b763a7c3d0bf8122d95 to your computer and use it in GitHub Desktop.
class ImageDto(Model):
ident = StringType()
height = IntType()
width = IntType()
max_height = IntType()
max_width = IntType()
url_pattern = StringType()
class VideoDto(Model):
ident = StringType()
height = IntType()
width = IntType()
format = StringType()
url_pattern = StringType()
class ImageDtoMixin(Model):
image = ImageDto()
class MultipleImagesDtoMixin(Model, ImageDtoMixin):
extra_image = ListType(ImageDto)
class VideoDtoMixin(Model):
video = VideoDto()
class UrlDtoMixin(Model):
url = StringType()
class AuthorMixin(Model):
author = UserDto()
class RecipeStepDto(Model, ImageDtoMixin):
pos = IntType()
text = StringType()
class RecipeIngredientDto(Model):
name = StringType()
amount = StringType()
class UserDto(Model, ImageDtoMixin, UrlDtoMixin):
id = IntType()
name = StringType()
desc = StringType()
class RecipeDto(Model, ImageDto, VideoDto, UrlDtoMixin, AuthorMixin):
id = IntType(required=True)
name = StringType(required=True)
desc = StringType()
is_exclusive = BooleanType()
score = FloatType()
ings = ListType(RecipeIngredientDto)
steps = ListType(RecipeStepDto)
tips = StringType()
create_time = DateTimeType()
class DishSourceDto(Model, UrlDtoMixin):
flag = IntType()
name = StringType()
class PositionDto(Model):
x = IntType()
y = IntType()
class DishTagDto(Model, UrlDtoMixin):
name = StringType()
position = PositionDto()
class DishDiggUsers(Model):
total = IntType()
users = ListType(UserDto)
class DishDto(Model, MultipleImagesDtoMixin, AuthorMixin, UrlDtoMixin):
id = IntType()
name = StringType()
desc = StringType()
source = DishSourceDto()
pic_tags = ListType(DishTagDto)
digg_users = DishDiggUsers()
at_users = ListType(UserDto)
digged_by_me = BooleanType()
create_time = DateTimeType()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment