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