allow to aunarchive template

pull/217/head
Pete Matsyburka 2 years ago
parent 8f457be719
commit bc9f27cfed

@ -28,6 +28,12 @@ module Api
@template.folder = TemplateFolders.find_or_create_by_name(current_user, folder_name) @template.folder = TemplateFolders.find_or_create_by_name(current_user, folder_name)
end end
archived = params.key?(:archived) ? params[:archived] : params.dig(:template, :archived)
if archived.in?([true, false])
@template.archived_at = archived == true ? Time.current : nil
end
@template.update!(template_params) @template.update!(template_params)
render json: @template.as_json(only: %i[id updated_at]) render json: @template.as_json(only: %i[id updated_at])

Loading…
Cancel
Save