15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/decidim/api/mutations/create_meeting_type.rb', line 15
def resolve(attributes:, locale:, toggle_translations:)
set_locale(locale:, toggle_translations:)
params = attributes.to_h.slice(
:address,
:available_slots,
:description,
:end_time,
:iframe_access_level,
:iframe_embed_type,
:latitude,
:location,
:location_hints,
:longitude,
:online_meeting_url,
:registration_terms,
:registration_type,
:registration_url,
:registrations_enabled,
:start_time,
:taxonomies,
:title,
:type_of_meeting
)
params[:taxonomies] = Decidim::Taxonomy.where(organization: current_organization, id: params[:taxonomies]).pluck(:id) if params[:taxonomies]
form = form(Decidim::Meetings::MeetingForm).from_params(params)
Decidim::Meetings::CreateMeeting.call(form) do
on(:ok) do |meeting|
return meeting.reload
end
on(:invalid) do
raise Decidim::Api::Errors::AttributeValidationError, form.errors
end
end
end
|