Sha256: 7da0070ec4f3c186c168a1c0f44445e2c32baefcb649f66e509fb277cbcc1182

Contents?: true

Size: 753 Bytes

Versions: 44

Compression:

Stored size: 753 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Meetings
    class RegistrationSerializer < Decidim::Exporters::Serializer
      include Decidim::TranslationsHelper
      # Serializes a registration
      def serialize
        {
          id: resource.id,
          code: resource.code,
          user: {
            name: resource.user.name,
            email: resource.user.email,
            user_group: resource.user_group&.name || ""
          },
          registration_form_answers: serialize_answers
        }
      end

      private

      def serialize_answers
        Decidim::Forms::UserAnswersSerializer.new(
          resource.meeting.questionnaire.answers.where(user: resource.user)
        ).serialize
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
decidim-meetings-0.29.1 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.28.4 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.27.9 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.29.0 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.28.3 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.27.8 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.29.0.rc4 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.29.0.rc3 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.29.0.rc2 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.29.0.rc1 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.28.2 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.27.7 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.28.1 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.27.6 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.26.10 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.26.9 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.28.0 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.27.5 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.28.0.rc5 app/serializers/decidim/meetings/registration_serializer.rb
decidim-meetings-0.28.0.rc4 app/serializers/decidim/meetings/registration_serializer.rb