Sha256: e3da02fb015fa5670cc763ac1317edcbd6adfe02d8a5a6cc5b2aa4b8d30a218d
Contents?: true
Size: 715 Bytes
Versions: 30
Compression:
Stored size: 715 Bytes
Contents
module Mutations class Update<%= @camelize_name %> <%= "<" %> BaseMutation include Guardian argument :id, ID, required: true <% for field in @update_mutation_lines %><%=field%> <% end %> type Types::<%= @camelize_name %>Type def resolve(**params) check_authentication! update_<%= @snake_case_name %>(params) end private def update_<%= @snake_case_name %>(params) <%= "#{@snake_case_name} = #{@camelize_name}.find(params[:id])" %> if <%=@snake_case_name%>.update(params) <%=@snake_case_name%> else raise GraphQL::ExecutionError, "Invalid input: #{<%=@snake_case_name%>.errors.full_messages.join(', ')}" end end end end
Version data entries
30 entries across 30 versions & 2 rubygems