forked from fossasia/open-event-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmails.py
More file actions
28 lines (21 loc) · 654 Bytes
/
mails.py
File metadata and controls
28 lines (21 loc) · 654 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
from flask_rest_jsonapi import ResourceDetail, ResourceList
from app.api.bootstrap import api
from app.api.schema.mails import MailSchema
from app.models import db
from app.models.mail import Mail
class MailList(ResourceList):
"""
List and create mails
"""
decorators = (api.has_permission('is_admin'),)
methods = ['GET']
schema = MailSchema
data_layer = {'session': db.session, 'model': Mail}
class MailDetail(ResourceDetail):
"""
Mail detail by id
"""
methods = ['GET']
schema = MailSchema
decorators = (api.has_permission('is_admin'),)
data_layer = {'session': db.session, 'model': Mail}