Exemple #1
0
class NotificationWithTemplateSchema(BaseSchema):
    class Meta:
        model = models.Notification
        strict = True
        exclude = ('_personalisation', 'scheduled_notification')

    template = fields.Nested(TemplateSchema,
                             only=[
                                 'id', 'version', 'name', 'template_type',
                                 'content', 'subject',
                                 'redact_personalisation',
                                 'is_precompiled_letter'
                             ],
                             dump_only=True)
    job = fields.Nested(JobSchema,
                        only=["id", "original_file_name"],
                        dump_only=True)
    created_by = fields.Nested(UserSchema,
                               only=['id', 'name', 'email_address'],
                               dump_only=True)
    status = fields.String(required=False)
    personalisation = fields.Dict(required=False)
    key_type = field_for(models.Notification, 'key_type', required=True)
    key_name = fields.String()

    @pre_dump
    def add_api_key_name(self, in_data):
        if in_data.api_key:
            in_data.key_name = in_data.api_key.name
        else:
            in_data.key_name = None
        return in_data
Exemple #2
0
class NotificationSchema(ma.Schema):

    class Meta:
        strict = True

    status = fields.String(required=False)
    personalisation = fields.Dict(required=False)
Exemple #3
0
class DetailedServiceSchema(BaseSchema):
    statistics = fields.Dict()

    class Meta:
        model = models.Service
        exclude = (
            'api_keys',
            'templates',
            'users',
            'created_by',
            'jobs',
            'template_statistics',
            'service_provider_stats',
            'service_notification_stats',
            'email_branding',
            'service_sms_senders',
            'monthly_billing',
            'reply_to_email_addresses',
            'letter_contact_block',
            'message_limit',
            'email_from',
            'inbound_api',
            'dvla_organisation',
            'whitelist',
            'reply_to_email_address',
            'sms_sender',
            'permissions',
            'inbound_number',
            'inbound_sms'
        )
Exemple #4
0
class DetailedServiceSchema(BaseSchema):
    statistics = fields.Dict()
    organisation_type = field_for(models.Service, 'organisation_type')

    class Meta:
        model = models.Service
        exclude = (
            'api_keys',
            'templates',
            'users',
            'created_by',
            'jobs',
            'template_statistics',
            'service_provider_stats',
            'service_notification_stats',
            'email_branding',
            'service_sms_senders',
            'monthly_billing',
            'reply_to_email_addresses',
            'letter_contact_block',
            'message_limit',
            'email_from',
            'inbound_api',
            'guest_list',
            'reply_to_email_address',
            'sms_sender',
            'permissions',
            'inbound_number',
            'inbound_sms',
            'all_template_folders',
            'annual_billing',
            'contact_list',
            'created_by',
            'crown',
            'letter_logo_filename',
            'rate_limit',
            'returned_letters',
            'users',
            'version',
            'guest_list',
            'broadcast_messages',
        )
Exemple #5
0
class ErrorSchema(ma.Schema):
    messages = fields.Dict()
    message = fields.String(255)