from flask.ext.restplus import Namespace

from app.models.microlocation import Microlocation as MicrolocationModel
from app.api.helpers import custom_fields as fields
from app.api.helpers.helpers import (can_create, can_update, can_delete,
                                     requires_auth)
from app.api.helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, ServiceDAO, \
    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES, SERVICE_RESPONSES
from app.api.helpers.utils import Resource, ETAG_HEADER_DEFN

api = Namespace('microlocations', description='Microlocations', path='/')

MICROLOCATION = api.model(
    'Microlocation', {
        'id': fields.Integer(required=True),
        'name': fields.String(required=True),
        'latitude': fields.Float(),
        'longitude': fields.Float(),
        'floor': fields.Integer(),
        'room': fields.String(),
    })

MICROLOCATION_PAGINATED = api.clone(
    'MicrolocationPaginated', PAGINATED_MODEL,
    {'results': fields.List(fields.Nested(MICROLOCATION))})

MICROLOCATION_POST = api.clone('MicrolocationPost', MICROLOCATION)
del MICROLOCATION_POST['id']


# Create DAO
from app.api.helpers import custom_fields as fields
from app.api.helpers.helpers import (can_create, can_update, can_delete,
                                     replace_event_id)
from app.api.helpers.helpers import save_db_model, get_object_in_event, \
    model_custom_form, requires_auth, parse_args
from app.api.helpers.special_fields import SessionLanguageField, SessionStateField
from app.api.helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, ServiceDAO, \
    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES, SERVICE_RESPONSES
from app.api.helpers.utils import Resource, ETAG_HEADER_DEFN

api = Namespace('sessions', description='Sessions', path='/')

# Create models
SESSION_TRACK = api.model(
    'SessionTrack', {
        'id': fields.Integer(required=True),
        'name': fields.String(),
        'color': fields.Color(),
        'font_color': fields.Color(),
    })

SESSION_SPEAKER = api.model(
    'SessionSpeaker', {
        'id': fields.Integer(required=True),
        'name': fields.String(),
        'organisation': fields.String(),
        'city': fields.String(),
        'short_biography': fields.String(),
        'long_biography': fields.String(),
        'heard_from': fields.String(),
        'speaking_experience': fields.String(),
Пример #3
0
from flask.ext.restplus import Namespace

from app.api.tickets import ORDER, TICKET
from app.helpers.ticketing import TicketingManager

from app.api.helpers.helpers import (requires_auth, can_access,
                                     replace_event_id)
from app.api.helpers.utils import POST_RESPONSES
from app.api.helpers.utils import Resource
from app.api.helpers import custom_fields as fields

api = Namespace('attendees', description='Attendees', path='/')

ATTENDEE = api.model(
    'TicketHolder', {
        'id': fields.Integer(),
        'firstname': fields.String(),
        'lastname': fields.String(),
        'email': fields.Email(),
        'checked_in': fields.Boolean(),
        'order': fields.Nested(ORDER, allow_null=False),
        'ticket': fields.Nested(TICKET, allow_null=False)
    })


@api.route('/events/<string:event_id>/attendees/')
class AttendeesList(Resource):
    @requires_auth
    @replace_event_id
    @can_access
    @api.doc('check_in_toggle', responses=POST_RESPONSES)
Пример #4
0
from flask.ext.restplus import Namespace

from app.helpers.ticketing import TicketingManager
from app.api.helpers import custom_fields as fields
from app.api.helpers.helpers import (requires_auth, replace_event_id)
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(),
Пример #5
0
from app.api.helpers import custom_fields as fields
from app.api.helpers.helpers import requires_auth, parse_args, \
    can_access, fake_marshal_with, fake_marshal_list_with, erase_from_dict, replace_event_id
from app.api.helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, \
    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES, BaseDAO, ServiceDAO
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', {
from flask.ext.restplus import Namespace

from app.models.sponsor import Sponsor as SponsorModel
from app.api.helpers import custom_fields as fields
from app.api.helpers.helpers import (can_create, can_update, can_delete,
                                     requires_auth)
from app.api.helpers.utils import PAGINATED_MODEL, PaginatedResourceBase, ServiceDAO, \
    PAGE_PARAMS, POST_RESPONSES, PUT_RESPONSES, SERVICE_RESPONSES
from app.api.helpers.utils import Resource, ETAG_HEADER_DEFN

api = Namespace('sponsors', description='Sponsors', path='/')

SPONSOR = api.model(
    'Sponsor', {
        'id': fields.Integer(required=True),
        'name': fields.String(required=True),
        'url': fields.Uri(),
        'logo': fields.Upload(),
        'description': fields.String(),
        'level': fields.String(),
        'sponsor_type': fields.String(),
    })

SPONSOR_PAGINATED = api.clone('SponsorPaginated', PAGINATED_MODEL,
                              {'results': fields.List(fields.Nested(SPONSOR))})

SPONSOR_POST = api.clone('SponsorPost', SPONSOR)
del SPONSOR_POST['id']


# Create DAO