'length': fields.String(required=True) }) SESSION_TYPE_POST = api.clone('SessionTypePost', SESSION_TYPE) del SESSION_TYPE_POST['id'] SESSION = api.model( 'Session', { 'id': fields.Integer(required=True), 'title': fields.String(required=True), 'subtitle': fields.String(), 'level': fields.String(), 'short_abstract': fields.String(), 'long_abstract': fields.String(), 'comments': fields.String(), 'start_time': fields.DateTime(required=True), 'end_time': fields.DateTime(required=True), 'track': fields.Nested(SESSION_TRACK, allow_null=True), 'speakers': fields.List(fields.Nested(SESSION_SPEAKER)), 'language': SessionLanguageField(), 'microlocation': fields.Nested(SESSION_MICROLOCATION, allow_null=True), 'slides': fields.Upload(), 'video': fields.Upload(), 'audio': fields.Upload(), 'signup_url': fields.Uri(), 'state': SessionStateField(), 'session_type': fields.Nested(SESSION_TYPE, allow_null=True) }) SESSION_PAGINATED = api.clone('SessionPaginated', PAGINATED_MODEL, {'results': fields.List(fields.Nested(SESSION))})
EVENT_COPYRIGHT = api.model( 'EventCopyright', { 'holder': fields.String(), 'holder_url': fields.Uri(), 'licence': fields.String(), 'licence_url': fields.Uri(), 'year': fields.Integer(), 'logo': fields.String() }) EVENT_CFS = api.model( 'EventCFS', { 'announcement': fields.String(), 'start_date': fields.DateTime(), 'end_date': fields.DateTime(), 'timezone': fields.String(), 'privacy': EventPrivacyField() # [public, private] }) EVENT_VERSION = api.model( 'EventVersion', { 'event_ver': fields.Integer(), 'sessions_ver': fields.Integer(), 'speakers_ver': fields.Integer(), 'tracks_ver': fields.Integer(), 'sponsors_ver': fields.Integer(), 'microlocations_ver': fields.Integer() })
from app.api.helpers.utils import POST_RESPONSES from app.api.helpers.utils import Resource from app.helpers.data_getter import DataGetter api = Namespace('tickets', description='Tickets', path='/') ORDER = api.model( 'Order', { 'id': fields.Integer(), 'identifier': fields.String(), 'amount': fields.Float(), 'paid_via': fields.String(), 'invoice_number': fields.String(), 'payment_mode': fields.String(), 'status': fields.String(), 'completed_at': fields.DateTime(), }) TICKET = api.model( 'Ticket', { 'id': fields.Integer(), 'name': fields.String(), 'description': fields.String(), 'type': fields.String(), 'price': fields.Float(), 'quantity': fields.Integer(), }) @api.route('/events/<string:event_id>/tickets/') class TicketsList(Resource):
USER_DETAIL = api.model( 'UserDetail', { 'firstname': fields.String(), 'lastname': fields.String(), 'details': fields.String(), 'avatar': fields.Upload(), 'contact': fields.String(), 'facebook': fields.String(), 'twitter': fields.String() }) USER = api.model( 'User', { 'id': fields.Integer(), 'email': fields.Email(required=True), 'signup_time': fields.DateTime(), 'last_access_time': fields.DateTime(), 'user_detail': fields.Nested(USER_DETAIL) }) USER_PAGINATED = api.clone('UserPaginated', PAGINATED_MODEL, {'results': fields.List(fields.Nested(USER))}) USER_PUT = api.clone('UserPut', USER) del USER_PUT['id'] del USER_PUT['signup_time'] del USER_PUT['last_access_time'] USER_POST = api.model('UserPost', { 'email': fields.Email(required=True), 'password': fields.String(required=True)
from app.api.helpers.helpers import (can_create, requires_auth, replace_event_id) from app.api.helpers.utils import PAGINATED_MODEL, ServiceDAO, \ POST_RESPONSES from app.api.helpers.utils import Resource api = Namespace('notifications', description='Notifications', path='/') NOTIFICATION = api.model( 'Notification', { 'id': fields.Integer(required=True), 'email': fields.String(required=True), 'title': fields.String(), 'message': fields.String(), 'action': fields.String(), 'received_at': fields.DateTime(), }) NOTIFICATION_PAGINATED = api.clone( 'NotificationPaginated', PAGINATED_MODEL, {'results': fields.List(fields.Nested(NOTIFICATION))}) NOTIFICATION_POST = api.clone('NotificationPost', NOTIFICATION) del NOTIFICATION_POST['id'] # Create DAO class NotificationDAO(ServiceDAO): version_key = 'notifications_ver' def create_user_notify(self, payload):
from app.api.helpers.utils import Resource, ETAG_HEADER_DEFN api = Namespace('events', description='Events') EVENT_COPYRIGHT = api.model('EventCopyright', { 'holder': fields.String(), 'holder_url': fields.Uri(), 'licence': fields.String(), 'licence_url': fields.Uri(), 'year': fields.Integer(), 'logo': fields.String() }) EVENT_CFS = api.model('EventCFS', { 'announcement': fields.String(), 'start_date': fields.DateTime(), 'end_date': fields.DateTime(), 'timezone': fields.String(), 'privacy': EventPrivacyField() # [public, private] }) EVENT_VERSION = api.model('EventVersion', { 'event_ver': fields.Integer(), 'sessions_ver': fields.Integer(), 'speakers_ver': fields.Integer(), 'tracks_ver': fields.Integer(), 'sponsors_ver': fields.Integer(), 'microlocations_ver': fields.Integer() }) SOCIAL_LINK = api.model('SocialLink', {
'name': fields.String(required=True), 'length': fields.String(required=True) }) SESSION_TYPE_POST = api.clone('SessionTypePost', SESSION_TYPE) del SESSION_TYPE_POST['id'] SESSION = api.model('Session', { 'id': fields.Integer(required=True), 'title': fields.String(required=True), 'subtitle': fields.String(), 'level': fields.String(), 'short_abstract': fields.String(), 'long_abstract': fields.String(), 'comments': fields.String(), 'start_time': fields.DateTime(attribute='start_time_tz', required=True), 'end_time': fields.DateTime(attribute='end_time_tz', required=True), 'track': fields.Nested(SESSION_TRACK, allow_null=True), 'speakers': fields.List(fields.Nested(SESSION_SPEAKER)), 'language': SessionLanguageField(), 'microlocation': fields.Nested(SESSION_MICROLOCATION, allow_null=True), 'slides': fields.Upload(), 'video': fields.Upload(), 'audio': fields.Upload(), 'signup_url': fields.Uri(), 'state': SessionStateField(), 'session_type': fields.Nested(SESSION_TYPE, allow_null=True) }) SESSION_PAGINATED = api.clone('SessionPaginated', PAGINATED_MODEL, { 'results': fields.List(fields.Nested(SESSION))
EVENT_COPYRIGHT = api.model( 'EventCopyright', { 'holder': fields.String(), 'holder_url': fields.Uri(), 'licence': fields.String(), 'licence_url': fields.Uri(), 'year': fields.Integer(), 'logo': fields.String() }) EVENT_CFS = api.model( 'EventCFS', { 'announcement': fields.String(), 'start_date': fields.DateTime(attribute='start_date_tz'), 'end_date': fields.DateTime(attribute='end_date_tz'), 'timezone': fields.String(), 'privacy': EventPrivacyField() # [public, private] }) EVENT_VERSION = api.model( 'EventVersion', { 'event_ver': fields.Integer(), 'sessions_ver': fields.Integer(), 'speakers_ver': fields.Integer(), 'tracks_ver': fields.Integer(), 'sponsors_ver': fields.Integer(), 'microlocations_ver': fields.Integer() })