Skip to content

Commit

Permalink
Add additional fields for group health to API
Browse files Browse the repository at this point in the history
  • Loading branch information
carlobeltrame committed Sep 24, 2021
1 parent 32ad759 commit 77e311f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/models/pbs/person.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ module Pbs::Person

included do
Person::PUBLIC_ATTRS << :title << :salutation << :correspondence_language <<
:prefers_digital_correspondence << :kantonalverband_id
:prefers_digital_correspondence << :kantonalverband_id <<
:pbs_number << :entry_date << :leaving_date

alias_method_chain :full_name, :title

Expand Down
21 changes: 21 additions & 0 deletions app/serializers/pbs/people_serializer.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# encoding: utf-8

# Copyright (c) 2021, Pfadibewegung Schweiz. This file is part of
# hitobito and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito.

module Pbs::PeopleSerializer
extend ActiveSupport::Concern

included do
extension(:public) do |_|
details = h.can?(:show_details, item)
if details
map_properties :gender, :birthday, :pbs_number, :entry_date, :leaving_date,
:primary_group_id
end
end
end

end
1 change: 1 addition & 0 deletions lib/hitobito_pbs/wagon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class Wagon < Rails::Engine

### serializers
PersonSerializer.include Pbs::PersonSerializer
PeopleSerializer.include Pbs::PeopleSerializer
GroupSerializer.include Pbs::GroupSerializer
EventSerializer.include Pbs::EventSerializer
EventParticipationSerializer.include Pbs::EventParticipationSerializer
Expand Down

0 comments on commit 77e311f

Please sign in to comment.