예제 #1
0
class UserEmailSchema(SoftDeletionSchema):
    """
    API Schema for user email Model
    """
    class Meta:
        """
        Meta class for user email API schema
        """

        type_ = 'user-email'
        self_view = 'v1.user_emails_detail'
        self_view_kwargs = {'id': '<id>'}
        inflect = dasherize

    id = fields.Str(dump_only=True)
    email_address = TrimmedEmail(allow_none=False)
    type = fields.Str(
        allow_none=False,
        validate=validate.OneOf(
            choices=["home", "work", "business", "office", "other"]),
    )
    user_id = fields.Integer(allow_none=False)
    user = Relationship(
        self_view='v1.user_emails_user',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.user_detail',
        related_view_kwargs={'user_email_id': '<id>'},
        schema='UserSchema',
        type_='user',
    )
class UsersGroupsRolesSchema(Schema):
    """
    Api schema for users_groups_role Model
    """

    class Meta:
        """
        Meta class for users_groups_role Api Schema
        """

        type_ = 'users-groups-role'
        self_view = 'v1.users_groups_roles_detail'
        self_view_kwargs = {'id': '<id>'}
        inflect = dasherize

    id = fields.Str(dump_only=True)
    email = TrimmedEmail(required=True)
    accepted = fields.Bool(dump_only=True)
    token = fields.Str(dump_only=True)

    group = Relationship(
        self_view='v1.users_groups_roles_group',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.group_detail',
        related_view_kwargs={'users_groups_roles_id': '<id>'},
        schema='GroupSchema',
        type_='group',
    )

    user = Relationship(
        dump_only=True,
        self_view='v1.users_groups_roles_user',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.user_detail',
        related_view_kwargs={'users_groups_roles_id': '<id>'},
        schema='UserSchemaPublic',
        type_="user",
    )

    role = Relationship(
        self_view='v1.users_groups_roles_role',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.role_detail',
        related_view_kwargs={'users_groups_roles_id': '<id>'},
        schema='RoleSchema',
        type_="role",
    )
예제 #3
0
class ExhibitorSchema(JSONAPISchema):
    class Meta:

        type_ = 'exhibitor'
        self_view = 'v1.exhibitor_detail'
        self_view_kwargs = {'id': '<id>'}
        inflect = dasherize

    id = fields.Str(dump_only=True)
    name = fields.Str(required=True)
    status = fields.Str(
        allow_none=True,
        default=Exhibitor.Status.PENDING,
        validate=validate.OneOf(choices=Exhibitor.Status.STATUSES),
    )
    description = fields.Str(allow_none=True)
    url = fields.Url(allow_none=True)
    position = fields.Integer(allow_none=True, default=0)
    logo_url = fields.Url(allow_none=True)
    banner_url = fields.Url(allow_none=True)
    thumbnail_image_url = fields.Url(allow_none=True)
    enable_video_room = fields.Boolean(allow_none=True, default=False)
    video_url = fields.Url(allow_none=True)
    slides_url = fields.Url(allow_none=True)
    contact_email = TrimmedEmail(allow_none=True)
    contact_link = fields.Str(allow_none=True)
    social_links = fields.Nested(ExhibitorSocialLinkSchema, many=True, allow_none=True)
    event = Relationship(
        self_view='v1.exhibitor_event',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.event_detail',
        related_view_kwargs={'exhibitor_id': '<id>'},
        schema='EventSchemaPublic',
        type_='event',
    )
    sessions = Relationship(
        many=True,
        self_view='v1.exhibitor_session',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.session_list',
        related_view_kwargs={'exhibitor_id': '<id>'},
        schema='SessionSchema',
        type_='session',
    )
class UserSchemaPublic(SoftDeletionSchema):
    """
    Api schema for User Model which can be accessed by any resource to which user is related.
    Co-organizers of events to which the user will be related will have access to this info.
    """
    class Meta:
        """
        Meta class for User Api Schema
        """

        type_ = 'user'
        self_view = 'v1.user_detail'
        self_view_kwargs = {'id': '<id>'}
        inflect = dasherize

    id = fields.Str(dump_only=True)
    email = TrimmedEmail(required=True)
    avatar_url = fields.Url(allow_none=True)
    first_name = fields.Str(allow_none=True)
    last_name = fields.Str(allow_none=True)
    public_name = fields.Str(allow_none=True)
    is_profile_public = fields.Bool(default=False, allow_none=False)
    original_image_url = fields.Url(dump_only=True, allow_none=True)
    thumbnail_image_url = fields.Url(dump_only=True, allow_none=True)
    small_image_url = fields.Url(dump_only=True, allow_none=True)
    icon_image_url = fields.Url(dump_only=True, allow_none=True)
    was_registered_with_order = fields.Boolean()

    @pre_dump
    def handle_deleted_or_private_users(self, data):
        if not data:
            return data
        can_access = require_current_user() and (current_user.is_staff
                                                 or current_user.id == data.id)
        if data.deleted_at != None and not can_access:
            user = User(id=0,
                        email='*****@*****.**',
                        first_name='deleted',
                        last_name='user')
            return user
        return data
예제 #5
0
class MailSchema(Schema):
    """
    Api schema for mail Model
    """
    class Meta:
        """
        Meta class for mail Api Schema
        """

        type_ = 'mail'
        self_view = 'v1.mail_detail'
        self_view_kwargs = {'id': '<id>'}
        self_view_many = 'v1.mail_list'
        inflect = dasherize

    id = fields.Str(dump_only=True)
    recipient = TrimmedEmail(dump_only=True)
    time = fields.DateTime(dump_only=True)
    action = fields.Str(dump_only=True)
    subject = fields.Str(dump_only=True)
    message = fields.Str(dump_only=True)
class VideoStreamModeratorSchema(Schema):
    """
    Api schema for video_stream_moderator Model
    """

    class Meta:
        """
        Meta class for video_stream_moderator Api Schema
        """

        type_ = 'video-stream-moderator'
        self_view = 'v1.video_stream_moderator_detail'
        self_view_kwargs = {'id': '<id>'}
        inflect = dasherize

    id = fields.Str(dump_only=True)
    email = TrimmedEmail(required=True)

    user = Relationship(
        dumps_only=True,
        self_view='v1.video_stream_moderator_user',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.user_detail',
        related_view_kwargs={'video_stream_moderator_id': '<id>'},
        schema='UserSchemaPublic',
        type_='user',
    )

    video_stream = Relationship(
        self_view='v1.video_stream_moderator_stream',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.video_stream_detail',
        related_view_kwargs={'video_stream_moderator_id': '<id>'},
        schema='VideoStreamSchema',
        type_="video-stream",
    )
예제 #7
0
class SpeakerInviteSchema(Schema):
    """
    Public Api Schema for speaker invite model
    """
    class Meta:
        """
        Meta class for speaker invite public Api Schema
        """

        type_ = 'speaker-invite'
        self_view = 'v1.speaker_invite_detail'
        self_view_kwargs = {'id': '<id>'}
        inflect = dasherize

    id = fields.Str(dump_only=True)
    email = TrimmedEmail(required=True)
    status = fields.Str(
        validate=validate.OneOf(choices=["pending", "accepted", "rejected"]),
        default="pending",
    )
    session = Relationship(
        self_view='v1.speaker_invite_session',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.session_detail',
        related_view_kwargs={'speaker_invite_id': '<id>'},
        schema='SessionSchema',
        type_='session',
    )
    event = Relationship(
        self_view='v1.speaker_invite_event',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.event_detail',
        related_view_kwargs={'speaker_invite_id': '<id>'},
        schema='EventSchemaPublic',
        type_='event',
    )
예제 #8
0
class EventSchemaPublic(SoftDeletionSchema):
    class Meta:
        type_ = 'event'
        self_view = 'v1.event_detail'
        self_view_kwargs = {'id': '<id>'}
        self_view_many = 'v1.event_list'
        inflect = dasherize

    @validates_schema(pass_original=True)
    def validate_timezone(self, data, original_data):
        if 'id' in original_data['data']:
            try:
                event = Event.query.filter_by(id=original_data['data']['id']).one()
            except NoResultFound:
                raise ObjectNotFound({'source': 'data/id'}, "Event id not found")

            if 'timezone' not in data:
                data['timezone'] = event.timezone
        try:
            timezone(data['timezone'])
        except pytz.UnknownTimeZoneError:
            raise UnprocessableEntityError(
                {'pointer': '/data/attributes/timezone'},
                "Unknown timezone: '{}'".format(data['timezone']),
            )

    id = fields.Str(dump_only=True)
    identifier = fields.Str(dump_only=True)
    name = fields.Str(required=True)
    external_event_url = fields.Url(allow_none=True)
    starts_at = fields.DateTime(required=True, timezone=True)
    ends_at = fields.DateTime(required=True, timezone=True)
    timezone = fields.Str(required=True)
    online = fields.Boolean(default=False)
    latitude = fields.Float(validate=lambda n: -90 <= n <= 90, allow_none=True)
    longitude = fields.Float(validate=lambda n: -180 <= n <= 180, allow_none=True)
    logo_url = fields.Url(allow_none=True)
    location_name = fields.Str(allow_none=True)
    searchable_location_name = fields.Str(allow_none=True)
    public_stream_link = fields.Str(allow_none=True)
    stream_loop = fields.Boolean(default=False)
    stream_autoplay = fields.Boolean(default=False)
    description = fields.Str(allow_none=True)
    after_order_message = fields.Str(allow_none=True)
    original_image_url = fields.Url(allow_none=True)
    thumbnail_image_url = fields.Url(dump_only=True)
    large_image_url = fields.Url(dump_only=True)
    icon_image_url = fields.Url(dump_only=True)
    show_remaining_tickets = fields.Bool(allow_none=False, default=False)
    owner_name = fields.Str(allow_none=True)
    is_map_shown = fields.Bool(default=False)
    is_oneclick_signup_enabled = fields.Bool(default=False)
    has_owner_info = fields.Bool(default=False)
    owner_description = fields.Str(allow_none=True)
    is_sessions_speakers_enabled = fields.Bool(default=False)
    privacy = fields.Str(default="public")
    state = fields.Str(
        validate=validate.OneOf(choices=["published", "draft"]),
        allow_none=True,
        default='draft',
    )
    ticket_url = fields.Url(allow_none=True)
    code_of_conduct = fields.Str(allow_none=True)
    schedule_published_on = fields.DateTime(allow_none=True)
    is_featured = fields.Bool(default=False)
    is_promoted = fields.Bool(default=False)
    is_demoted = fields.Bool(default=False)
    is_announced = fields.Bool(default=False)
    is_ticket_form_enabled = fields.Bool(default=True)
    is_cfs_enabled = fields.Bool(default=False)
    payment_country = fields.Str(allow_none=True)
    payment_currency = fields.Str(allow_none=True)
    paypal_email = TrimmedEmail(allow_none=True)
    is_tax_enabled = fields.Bool(default=False)
    is_billing_info_mandatory = fields.Bool(default=False)
    is_donation_enabled = fields.Bool(default=False)
    is_chat_enabled = fields.Bool(default=False)
    is_videoroom_enabled = fields.Bool(default=False)
    is_document_enabled = fields.Boolean(default=False)
    document_links = fields.Nested(DocumentLinkSchema, many=True, allow_none=True)
    chat_room_name = fields.Str(dump_only=True)
    can_pay_by_paypal = fields.Bool(default=False)
    can_pay_by_stripe = fields.Bool(default=False)
    can_pay_by_cheque = fields.Bool(default=False)
    can_pay_by_bank = fields.Bool(default=False)
    can_pay_by_invoice = fields.Bool(default=False)
    can_pay_onsite = fields.Bool(default=False)
    can_pay_by_omise = fields.Bool(default=False)
    can_pay_by_alipay = fields.Bool(default=False)
    can_pay_by_paytm = fields.Bool(default=False)
    cheque_details = fields.Str(allow_none=True)
    invoice_details = fields.Str(allow_none=True)
    bank_details = fields.Str(allow_none=True)
    onsite_details = fields.Str(allow_none=True)
    is_sponsors_enabled = fields.Bool(default=False)
    created_at = fields.DateTime(dump_only=True, timezone=True)
    pentabarf_url = fields.Url(dump_only=True)
    ical_url = fields.Url(dump_only=True)
    xcal_url = fields.Url(dump_only=True)
    refund_policy = fields.String(allow_none=True)
    is_stripe_linked = fields.Boolean(dump_only=True, allow_none=True, default=False)

    tickets = Relationship(
        self_view='v1.event_ticket',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.ticket_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='TicketSchemaPublic',
        many=True,
        type_='ticket',
    )
    faqs = Relationship(
        self_view='v1.event_faqs',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.faq_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='FaqSchema',
        many=True,
        type_='faq',
    )
    faq_types = Relationship(
        self_view='v1.event_faq_types',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.faq_type_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='FaqTypeSchema',
        many=True,
        type_='faq_type',
    )
    feedbacks = Relationship(
        self_view='v1.event_feedbacks',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.feedback_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='FeedbackSchema',
        many=True,
        type_='feedback',
    )
    ticket_tags = Relationship(
        self_view='v1.event_ticket_tag',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.ticket_tag_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='TicketTagSchema',
        many=True,
        type_='ticket-tag',
    )
    microlocations = Relationship(
        attribute='microlocation',
        self_view='v1.event_microlocation',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.microlocation_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='MicrolocationSchema',
        many=True,
        type_='microlocation',
    )
    social_links = Relationship(
        attribute='social_link',
        self_view='v1.event_social_link',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.social_link_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='SocialLinkSchema',
        many=True,
        type_='social-link',
    )
    tracks = Relationship(
        attribute='track',
        self_view='v1.event_tracks',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.track_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='TrackSchema',
        many=True,
        type_='track',
    )
    sponsors = Relationship(
        attribute='sponsor',
        self_view='v1.event_sponsor',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.sponsor_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='SponsorSchema',
        many=True,
        type_='sponsor',
    )
    speakers_call = Relationship(
        self_view='v1.event_speakers_call',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.speakers_call_detail',
        related_view_kwargs={'event_id': '<id>'},
        schema='SpeakersCallSchema',
        type_='speakers-call',
    )
    session_types = Relationship(
        attribute='session_type',
        self_view='v1.event_session_types',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.session_type_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='SessionTypeSchema',
        many=True,
        type_='session-type',
    )
    event_copyright = Relationship(
        attribute='copyright',
        self_view='v1.event_copyright',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.event_copyright_detail',
        related_view_kwargs={'event_id': '<id>'},
        schema='EventCopyrightSchema',
        type_='event-copyright',
    )
    tax = Relationship(
        self_view='v1.event_tax',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.tax_detail',
        related_view_kwargs={'event_id': '<id>'},
        schema='TaxSchema',
        type_='tax',
    )
    sessions = Relationship(
        attribute='session',
        self_view='v1.event_session',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.session_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='SessionSchema',
        many=True,
        type_='session',
    )
    speakers = Relationship(
        attribute='speaker',
        self_view='v1.event_speaker',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.speaker_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='SpeakerSchema',
        many=True,
        type_='speaker',
    )
    event_type = Relationship(
        self_view='v1.event_event_type',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.event_type_detail',
        related_view_kwargs={'event_id': '<id>'},
        schema='EventTypeSchema',
        type_='event-type',
    )
    event_topic = Relationship(
        self_view='v1.event_event_topic',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.event_topic_detail',
        related_view_kwargs={'event_id': '<id>'},
        schema='EventTopicSchema',
        type_='event-topic',
    )
    event_sub_topic = Relationship(
        self_view='v1.event_event_sub_topic',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.event_sub_topic_detail',
        related_view_kwargs={'event_id': '<id>'},
        schema='EventSubTopicSchema',
        type_='event-sub-topic',
    )
    group = Relationship(
        self_view='v1.event_group',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.group_detail',
        related_view_kwargs={'event_id': '<id>'},
        schema='GroupSchema',
        type_='group',
    )
    custom_forms = Relationship(
        attribute='custom_form',
        self_view='v1.event_custom_forms',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.custom_form_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='CustomFormSchema',
        many=True,
        type_='custom-form',
    )
    owner = Relationship(
        self_view='v1.event_owner',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.user_detail',
        schema='UserSchemaPublic',
        related_view_kwargs={'event_id': '<id>'},
        type_='user',
    )
    organizers = Relationship(
        self_view='v1.event_organizers',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.user_list',
        schema='UserSchemaPublic',
        type_='user',
        many=True,
    )
    coorganizers = Relationship(
        self_view='v1.event_coorganizers',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.user_list',
        schema='UserSchemaPublic',
        type_='user',
        many=True,
    )
    stripe_authorization = Relationship(
        self_view='v1.stripe_authorization_event',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.stripe_authorization_detail',
        related_view_kwargs={'event_id': '<id>'},
        schema='StripeAuthorizationSchema',
        type_='stripe-authorization',
    )
    order_statistics = Relationship(
        self_view='v1.event_order_statistics',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.order_statistics_event_detail',
        related_view_kwargs={'id': '<id>'},
        schema='OrderStatisticsEventSchema',
        type_='order-statistics-event',
    )
    general_statistics = Relationship(
        self_view='v1.event_general_statistics',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.event_statistics_general_detail',
        related_view_kwargs={'id': '<id>'},
        schema='EventStatisticsGeneralSchema',
        type_='event-statistics-general',
    )
    video_stream = GetterRelationship(
        getter='safe_video_stream',
        self_view='v1.video_stream_event',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.video_stream_detail',
        related_view_kwargs={'event_id': '<id>'},
        schema='VideoStreamSchema',
        type_='video-stream',
    )
    exhibitors = Relationship(
        self_view='v1.event_exhibitor',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.exhibitor_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='ExhibitorSchema',
        many=True,
        type_='exhibitor',
    )
    session_favourites = Relationship(
        related_view='v1.user_favourite_sessions_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='UserFavouriteSessionSchema',
        type_='user-favourite-session',
        many=True,
    )
    speaker_invites = Relationship(
        self_view='v1.event_speaker_invites',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.speaker_invite_list',
        related_view_kwargs={'event_id': '<id>'},
        schema='SpeakerInviteSchema',
        type_='speaker-invite',
        many=True,
    )
예제 #9
0
class RoleInviteSchema(Schema):
    """
    Api Schema for role invite model
    """
    class Meta:
        """
        Meta class for role invite Api Schema
        """

        type_ = 'role-invite'
        self_view = 'v1.role_invite_detail'
        self_view_kwargs = {'id': '<id>'}
        inflect = dasherize

    @validates_schema(pass_original=True)
    def validate_satus(self, data, original_data):
        if 'role' in data and 'role_name' in data:
            try:
                role = Role.query.filter_by(id=data['role']).one()
            except NoResultFound:
                raise ObjectNotFound({'source': '/data/role'},
                                     "Role not found")
            if role.name != data['role_name']:
                raise UnprocessableEntityError(
                    {'pointer': '/data/attributes/role'},
                    "Role id do not match role name")
        if 'id' in original_data['data']:
            try:
                role_invite = RoleInvite.query.filter_by(
                    id=original_data['data']['id']).one()
            except NoResultFound:
                raise ObjectNotFound({'source': '/data/id'},
                                     "Role invite not found")
            if 'role' not in data:
                data['role'] = role_invite.role.id
            if 'role_name' in data:
                try:
                    role = Role.query.filter_by(id=data['role']).one()
                except NoResultFound:
                    raise ObjectNotFound({'source': '/data/role'},
                                         "Role not found")
                if role.name != data['role_name']:
                    raise UnprocessableEntityError(
                        {'pointer': '/data/attributes/role'},
                        "Role id do not match role name",
                    )

    id = fields.Str(dump_only=True)
    email = TrimmedEmail(required=True)
    hash = fields.Str(dump_only=True)
    created_at = fields.DateTime(dump_only=True, timezone=True)
    role_name = fields.Str(validate=validate.OneOf(choices=[
        "owner",
        "organizer",
        "coorganizer",
        "track_organizer",
        "moderator",
        "attendee",
        "registrar",
    ]))
    status = fields.Str(
        validate=validate.OneOf(choices=["pending", "accepted", "declined"]),
        default="pending",
    )
    event = Relationship(
        self_view='v1.role_invite_event',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.event_detail',
        related_view_kwargs={'role_invite_id': '<id>'},
        schema='EventSchemaPublic',
        type_='event',
    )
    role = Relationship(
        self_view='v1.role_invite_role',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.role_detail',
        related_view_kwargs={'role_invite_id': '<id>'},
        schema='RoleSchema',
        type_='role',
    )
예제 #10
0
class SpeakerSchema(SoftDeletionSchema):
    """
    Speaker Schema based on Speaker Model
    """
    @validates_schema(pass_original=True)
    def validate_json(self, data, original_data):
        validate_complex_fields_json(self, data, original_data)

    class Meta:
        """
        Meta class for speaker schema
        """

        type_ = 'speaker'
        self_view = 'v1.speaker_detail'
        self_view_kwargs = {'id': '<id>'}
        inflect = dasherize

    id = fields.Str(dump_only=True)
    name = fields.Str(required=True)
    email = TrimmedEmail(allow_none=True)
    photo_url = fields.Url(allow_none=True)
    thumbnail_image_url = fields.Url(allow_none=True)
    small_image_url = fields.Url(allow_none=True)
    icon_image_url = fields.Url(allow_none=True)
    short_biography = fields.Str(allow_none=True)
    long_biography = fields.Str(allow_none=True)
    speaking_experience = fields.Str(allow_none=True)
    mobile = fields.Str(allow_none=True)
    website = fields.Url(allow_none=True)
    twitter = fields.Url(allow_none=True)
    facebook = fields.Url(allow_none=True)
    github = fields.Url(allow_none=True)
    mastodon = fields.Url(allow_none=True)
    linkedin = fields.Url(allow_none=True)
    instagram = fields.Url(allow_none=True)
    organisation = fields.Str(allow_none=True)
    is_featured = fields.Boolean(default=False)
    is_email_overridden = fields.Boolean(default=False)
    position = fields.Str(allow_none=True)
    country = fields.Str(allow_none=True)
    city = fields.Str(allow_none=True)
    address = fields.Str(allow_none=True)
    gender = fields.Str(allow_none=True,
                        validate=validate.OneOf(choices=GENDER_CHOICES))
    order = fields.Integer(allow_none=True, default=0)
    heard_from = fields.Str(allow_none=True)
    sponsorship_required = fields.Str(allow_none=True)
    complex_field_values = CustomFormValueField(allow_none=True)
    event = Relationship(
        self_view='v1.speaker_event',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.event_detail',
        related_view_kwargs={'speaker_id': '<id>'},
        schema='EventSchemaPublic',
        type_='event',
    )
    user = Relationship(
        self_view='v1.speaker_user',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.user_detail',
        related_view_kwargs={'speaker_id': '<id>'},
        schema='UserSchemaPublic',
        type_='user',
        dump_only=True,
    )
    sessions = Relationship(
        self_view='v1.speaker_session',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.session_list',
        related_view_kwargs={'speaker_id': '<id>'},
        schema='SessionSchema',
        many=True,
        type_='session',
    )
예제 #11
0
class AttendeeSchemaPublic(SoftDeletionSchema):
    """
    Api schema for Ticket Holder Model
    """
    class Meta:
        """
        Meta class for Attendee API Schema
        """

        type_ = 'attendee'
        self_view = 'v1.attendee_detail'
        self_view_kwargs = {'id': '<id>'}
        inflect = dasherize

    @validates_schema(pass_original=True)
    def validate_json(self, data, original_data):
        validate_complex_fields_json(self, data, original_data)

    id = fields.Str(dump_only=True)
    firstname = fields.Str(required=True)
    lastname = fields.Str(required=True)
    email = TrimmedEmail(allow_none=True)
    address = fields.Str(allow_none=True)
    city = fields.Str(allow_none=True)
    state = fields.Str(allow_none=True)
    country = fields.Str(allow_none=True)
    job_title = fields.Str(allow_none=True)
    phone = fields.Str(allow_none=True)
    tax_business_info = fields.Str(allow_none=True)
    billing_address = fields.Str(allow_none=True)
    home_address = fields.Str(allow_none=True)
    shipping_address = fields.Str(allow_none=True)
    company = fields.Str(allow_none=True)
    work_address = fields.Str(allow_none=True)
    work_phone = fields.Str(allow_none=True)
    website = fields.Url(allow_none=True)
    blog = fields.Url(allow_none=True)
    twitter = fields.Url(allow_none=True)
    facebook = fields.Url(allow_none=True)
    github = fields.Url(allow_none=True)
    instagram = fields.Url(allow_none=True)
    linkedin = fields.Url(allow_none=True)
    gender = fields.Str(allow_none=True)
    accept_video_recording = fields.Boolean(allow_none=True)
    accept_share_details = fields.Boolean(allow_none=True)
    accept_receive_emails = fields.Boolean(allow_none=True)
    age_group = fields.Str(validate=validate.OneOf(choices=AGE_GROUP_CHOICES),
                           allow_none=True)
    birth_date = fields.DateTime(allow_none=True)

    ticket_id = fields.Str(allow_none=True)
    is_checked_in = fields.Boolean()
    device_name_checkin = fields.Str(allow_none=True)
    checkin_times = fields.Str(allow_none=True)
    checkout_times = fields.Str(allow_none=True)
    attendee_notes = fields.Str(allow_none=True)
    is_checked_out = fields.Boolean()
    pdf_url = fields.Url(dump_only=True)
    complex_field_values = CustomFormValueField(allow_none=True)
    event = Relationship(
        self_view='v1.attendee_event',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.event_detail',
        related_view_kwargs={'attendee_id': '<id>'},
        schema='EventSchema',
        type_='event',
        dump_only=True,
    )
    user = Relationship(
        self_view='v1.attendee_user',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.user_detail',
        related_view_kwargs={'attendee_id': '<id>'},
        schema='UserSchemaPublic',
        type_='user',
        dump_only=True,
    )
    ticket = Relationship(
        self_view='v1.attendee_ticket',
        self_view_kwargs={'id': '<id>'},
        related_view='v1.ticket_detail',
        related_view_kwargs={'attendee_id': '<id>'},
        schema='TicketSchemaPublic',
        type_='ticket',
        dump_only=True,
    )
예제 #12
0
class SettingSchemaPublic(Schema):
    """
    Public Api schema for settings Model
    """
    class Meta:
        """
        Meta class for setting Api Schema
        """

        type_ = 'setting'
        self_view = 'v1.setting_detail'
        self_view_kwargs = {'id': '<id>'}
        inflect = dasherize

    id = fields.Str(dump_only=True)

    # Name of the application. (Eg. Event Yay!, Open Event)
    app_name = fields.Str(allow_none=True)

    # Tagline for the application. (Eg. Event Management and Ticketing, Home)
    tagline = fields.Str(allow_none=True)

    # Order Expiry Time
    order_expiry_time = fields.Integer(allow_none=False,
                                       default=15,
                                       validate=lambda n: 1 <= n <= 60)

    # Start Page Event ID
    start_pg_event_id = fields.Str(allow_none=True, default=None)
    start_pg_enabled = fields.Str(allow_none=True, default='default')

    # Maximum number of complex custom fields allowed for a given form
    max_complex_custom_fields = fields.Integer(allow_none=False,
                                               default=30,
                                               validate=lambda n: 1 <= n <= 30)

    # Google Analytics
    analytics_key = fields.Str(allow_none=True)

    # FB
    fb_client_id = fields.Str(allow_none=True)

    #
    # Social links
    #
    google_url = fields.Str(allow_none=True)
    github_url = fields.Str(allow_none=True)
    twitter_url = fields.Str(allow_none=True)
    support_url = fields.Str(allow_none=True)
    facebook_url = fields.Str(allow_none=True)
    instagram_url = fields.Str(allow_none=True)
    patreon_url = fields.Str(allow_none=True)
    gitter_url = fields.Str(allow_none=True)
    telegram_url = fields.Str(allow_none=True)
    youtube_url = fields.Str(allow_none=True)
    weblate_url = fields.Str(allow_none=True)

    # Url of Frontend
    frontend_url = fields.Url(allow_none=True)

    rocket_chat_url = fields.Url(allow_none=True)

    #
    # Cookie Policy
    #
    cookie_policy = fields.Str(allow_none=True)
    cookie_policy_link = fields.Str(allow_none=True)

    #
    # Online Payment Flags
    #
    is_paytm_activated = fields.Bool(default=False)
    is_paypal_activated = fields.Bool(dump_only=True)
    is_stripe_activated = fields.Bool(dump_only=True)
    is_omise_activated = fields.Bool(dump_only=True)
    is_alipay_activated = fields.Bool(dump_only=True)
    is_billing_paypal_activated = fields.Bool(dump_only=True)

    #
    # Payment Gateways
    #

    # Stripe Credantials
    stripe_client_id = fields.Str(dump_only=True)
    stripe_publishable_key = fields.Str(dump_only=True)
    stripe_test_client_id = fields.Str(dump_only=True)
    stripe_test_publishable_key = fields.Str(dump_only=True)

    # PayPal Credentials
    paypal_mode = fields.Str(dump_only=True)
    paypal_client = fields.Str(dump_only=True)
    paypal_sandbox_client = fields.Str(dump_only=True)

    # Omise Credentials
    omise_mode = fields.Str(dump_only=True)
    omise_test_public = fields.Str(dump_only=True)
    omise_live_public = fields.Str(dump_only=True)

    # Alipay Credentials
    alipay_publishable_key = fields.Str(dump_only=True)

    # payTM credentials
    paytm_mode = fields.Str(dump_only=True)
    paytm_live_merchant = fields.Str(dump_only=True)
    paytm_sandbox_merchant = fields.Str(dump_only=True)

    # Admin Invoice Details
    admin_billing_contact_name = fields.Str(allow_none=True)
    admin_billing_phone = fields.Str(allow_none=True)
    admin_billing_email = TrimmedEmail(allow_none=True)
    admin_billing_state = fields.Str(allow_none=True)
    admin_billing_country = fields.Str(allow_none=True)
    admin_billing_tax_info = fields.Str(allow_none=True)
    admin_company = fields.Str(allow_none=True)
    admin_billing_address = fields.Str(allow_none=True)
    admin_billing_city = fields.Str(allow_none=True)
    admin_billing_zip = fields.Str(allow_none=True)
    admin_billing_additional_info = fields.Str(allow_none=True)
    admin_billing_logo = fields.Url(allow_none=True)

    #
    # image and slide size
    #
    logo_size = fields.Integer(allow_none=False, default=1000)
    image_size = fields.Integer(allow_none=False, default=10000)
    slide_size = fields.Integer(allow_none=False, default=20000)
예제 #13
0
class SettingSchemaAdmin(SettingSchemaNonAdmin):
    """
    Admin Api schema for settings Model
    """
    class Meta:
        """
        Meta class for setting Api Schema
        """

        type_ = 'setting'
        self_view = 'v1.setting_detail'
        self_view_kwargs = {'id': '<id>'}
        inflect = dasherize

    id = fields.Str(dump_only=True)
    #
    # General
    #

    app_environment = fields.Str(default=Environment.PRODUCTION)

    # Static domain
    static_domain = fields.Str(allow_none=True)

    #
    #  STORAGE
    #

    # storage place, local, s3, .. can be more in future
    storage_place = fields.Str(allow_none=True)
    # S3
    aws_key = fields.Str(allow_none=True)
    aws_secret = fields.Str(allow_none=True)
    aws_bucket_name = fields.Str(allow_none=True)
    aws_region = fields.Str(allow_none=True)
    # Google Storage
    gs_key = fields.Str(allow_none=True)
    gs_secret = fields.Str(allow_none=True)
    gs_bucket_name = fields.Str(allow_none=True)

    #
    # CAPTCHA
    #

    # Google reCAPTCHA
    is_google_recaptcha_enabled = fields.Bool(allow_none=False, default=False)
    google_recaptcha_site = fields.Str(allow_none=True)
    google_recaptcha_secret = fields.Str(allow_none=True)

    #
    # Social Login
    #

    # Google Auth
    google_client_id = fields.Str(allow_none=True)
    google_client_secret = fields.Str(allow_none=True)
    # FB
    fb_client_id = fields.Str(allow_none=True)
    fb_client_secret = fields.Str(allow_none=True)
    # Twitter
    tw_consumer_key = fields.Str(allow_none=True)
    tw_consumer_secret = fields.Str(allow_none=True)
    # Instagram
    in_client_id = fields.Str(allow_none=True)
    in_client_secret = fields.Str(allow_none=True)

    #
    # Payment Gateways
    #

    # Stripe Credantials
    stripe_client_id = fields.Str(allow_none=True)
    stripe_publishable_key = fields.Str(allow_none=True)
    stripe_secret_key = fields.Str(allow_none=True)
    stripe_test_client_id = fields.Str(allow_none=True)
    stripe_test_secret_key = fields.Str(allow_none=True)
    stripe_test_publishable_key = fields.Str(allow_none=True)

    # PayPal Credentials
    paypal_mode = fields.Str(allow_none=True)
    paypal_client = fields.Str(allow_none=True)
    paypal_secret = fields.Str(allow_none=True)
    paypal_sandbox_client = fields.Str(allow_none=True)
    paypal_sandbox_secret = fields.Str(allow_none=True)

    # Omise Credentials
    omise_mode = fields.Str(allow_none=True)
    omise_test_public = fields.Str(allow_none=True)
    omise_test_secret = fields.Str(allow_none=True)
    omise_live_public = fields.Str(allow_none=True)
    omise_live_secret = fields.Str(allow_none=True)

    # Alipay Credentials
    alipay_publishable_key = fields.Str(allow_none=True)
    alipay_secret_key = fields.Str(allow_none=True)

    # payTM credentials
    paytm_mode = fields.Str(allow_none=True)
    paytm_live_merchant = fields.Str(allow_none=True)
    paytm_live_secret = fields.Str(allow_none=True)
    paytm_sandbox_merchant = fields.Str(allow_none=True)
    paytm_sandbox_secret = fields.Str(allow_none=True)
    #
    # EMAIL
    #

    # Email service. (sendgrid,smtp)
    email_service = fields.Str(allow_none=True)
    email_from = fields.Str(allow_none=True)
    email_from_name = fields.Str(allow_none=True)
    # Sendgrid
    sendgrid_key = fields.Str(allow_none=True)
    # SMTP
    smtp_host = fields.Str(allow_none=True)
    smtp_username = fields.Str(allow_none=True)
    smtp_password = fields.Str(allow_none=True)
    smtp_port = fields.Integer(allow_none=True)
    smtp_encryption = fields.Str(allow_none=True)  # Can be tls, ssl, none

    rocket_chat_registration_secret = fields.Str(allow_none=True)

    # Event Invoices settings
    invoice_sending_day = fields.Integer(allow_none=False, default=1)
    invoice_sending_timezone = fields.Str(allow_none=False, default="UTC")

    # Admin Invoice Details
    admin_billing_paypal_email = TrimmedEmail(allow_none=True)