Total Complexity | 0 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # -*- coding:utf-8 -*- |
||
2 | """ |
||
3 | AuthorSchema module |
||
4 | """ |
||
5 | |||
6 | from loglan_core import Author, Word |
||
7 | from marshmallow_sqlalchemy.fields import Nested |
||
8 | |||
9 | from app.api.schemas import ma |
||
10 | |||
11 | |||
12 | class AuthorSchema(ma.SQLAlchemyAutoSchema): |
||
13 | class Meta: |
||
14 | model = Author |
||
15 | include_fk = True |
||
16 | exclude = ("created", "updated", "_contribution") |
||
17 | |||
18 | _contribution = Nested("WordSchema", only=Word.attributes_basic(), many=True) |
||
19 | contribution = _contribution |
||
20 | |||
21 | |||
22 | author_schema_nested = AuthorSchema(only=Author.attributes_basic()) |
||
23 | author_schema_full = AuthorSchema(only=(*Author.attributes_extended(), "contribution")) |
||
24 | |||
25 | blue_print_export = (Author, author_schema_nested, author_schema_full) |
||
26 |