Passed
Push — master ( 38bed0...e25529 )
by torrua
01:14
created

app.api.schemas.author   A

Complexity

Total Complexity 0

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 0
eloc 14
dl 0
loc 26
rs 10
c 0
b 0
f 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