This repository has been archived by the owner on Aug 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.py
69 lines (56 loc) · 1.72 KB
/
schema.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from flask_marshmallow import Marshmallow
from marshmallow import fields
from models import *
ma = Marshmallow()
class VTuberSchema(ma.Schema):
id = fields.Integer(dump_only=True)
fullname = fields.String()
kanji = fields.String()
gender = fields.String()
age = fields.Integer()
units = fields.List(fields.String())
debut = fields.String()
fanname = fields.String()
zodiac = fields.String()
birthday = fields.String()
height = fields.Integer()
youtube = fields.Url()
illust = fields.String()
hashtags = ma.Nested('HashTagSchema')
avatar = ma.Nested('AvatarSchema')
aliases = ma.Nested('AliasSchema', many=True)
social = ma.Nested('SocialSchema', many=True)
songs = ma.Nested('SongsSchema', many=True)
class HashTagSchema(ma.Schema):
stream_tag = fields.String()
fanart_tag = fields.String()
class AvatarSchema(ma.Schema):
file = fields.Url()
source = fields.Url()
creator = fields.String()
app = fields.String()
class SocialSchema(ma.Schema):
id = fields.Integer(dump_only=True)
socialapp = fields.String()
socialurl = fields.Url()
class AliasSchema(ma.Schema):
id = fields.Integer(dump_only=True)
alias = fields.String()
class SongsSchema(ma.Schema):
id = fields.Integer(dump_only=True)
name = fields.String()
album = fields.String()
releasedate = fields.String()
compositor = fields.String()
lyrics = fields.String()
albumpt = fields.Url()
class UserSchema(ma.Schema):
class Meta:
model = User
fields = (
'id', 'username', 'email', 'is_admin'
)
class FileSchema(ma.Schema):
class Meta:
model = File
fields = ("id", "filename", "integrity")