1
0

Initial commit

This commit is contained in:
2022-09-07 17:03:40 +02:00
parent f8909a0159
commit ad083869fc
11 changed files with 325 additions and 0 deletions

33
Models/Schema.py Normal file
View File

@@ -0,0 +1,33 @@
from marshmallow_sqlalchemy import SQLAlchemyAutoSchema
from Models.User import User
from Models.Post import Post
from Models.Tag import Tag
class UserSchema(SQLAlchemyAutoSchema):
class Meta:
model = User
exclude = ("password",)
include_fk = True
include_relationships = True
load_instance = True
class PostSchema(SQLAlchemyAutoSchema):
class Meta:
model= Post
include_fk = True
include_relationships = True
load_instance = True
class TagSchema(SQLAlchemyAutoSchema):
class Meta:
model= Tag
include_fk = True
include_relationships = True
load_instance = True
user_schema = UserSchema()
users_schema = UserSchema(many=True)
post_schema = PostSchema()
posts_schema = PostSchema(many=True)
tag_schema = TagSchema()
tags_schema = TagSchema(many=True)