-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.py
More file actions
36 lines (25 loc) · 911 Bytes
/
schema.py
File metadata and controls
36 lines (25 loc) · 911 Bytes
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
from marshmallow import Schema, fields, EXCLUDE, post_load
from attendees import Attendee
class TicketSchema(Schema):
class Meta:
unknown = EXCLUDE
first_name = fields.String(missing=None)
last_name = fields.String(missing=None)
name = fields.String(missing=None)
email = fields.String(missing=None)
responses = fields.Dict(missing={})
reference = fields.String(required=True)
ticket_title = fields.String(attribute="release_title")
updated_at = fields.DateTime(missing=None)
@post_load
def make_object(self, data, **kwargs):
return Attendee(data)
class PaginationSchema(Schema):
class Meta:
unknown = EXCLUDE
next_page = fields.Integer(missing=None)
class TicketAPISchema(Schema):
class Meta:
unknown = EXCLUDE
tickets = fields.List(fields.Nested(TicketSchema))
meta = fields.Nested(PaginationSchema())