<commit_before>class APIV1FilesetsController < APIBaseController

  before_action :validate_user, only: [ :add_fileset,
                                        :remove_fileset
                                      ]

  #
  # get the specified fileset
  #
  def get_fileset
    fileset = get_the_fileset
    if fileset.nil? == false
      render_fileset_response( :ok, API::Fileset.new.from_fileset( fileset, "#{request.base_url}/api/v1" ) )
    else
      render_fileset_response( :not_found )
    end
  end

  #
  # add a new file(set)
  #
  def add_fileset
    work = get_the_work
    if work.nil?
      render_standard_response( :not_found )
    else
      render_standard_response( :bad_request, 'Not implemented' )
    end
  end

  #
  # remove the specified fileset
  #
  def remove_fileset

    fileset = get_the_fileset
    if fileset.nil? == false
      render_standard_response( :not_found, 'Fileset not available' )
    else
      # audit the information
    #  audit_log( "File #{fileset.title[0]} for work id #{work.id} (#{work.identifier}) deleted by #{User.cid_from_email( @api_user.email)}" )

    #  file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, @api_user )
    #  file_actor.destroy
      render_standard_response( :ok )
    end

  end

  private

  def render_fileset_response( status, fileset = nil )
    render json: API::FilesetResponse.new( status, fileset ), :status => status
  end

end

<commit_msg>Implement fileset delete API endpoint<commit_after>class APIV1FilesetsController < APIBaseController

  before_action :validate_user, only: [ :add_fileset,
                                        :remove_fileset
                                      ]

  #
  # get the specified fileset
  #
  def get_fileset
    fileset = get_the_fileset
    if fileset.nil? == false
      render_fileset_response( :ok, API::Fileset.new.from_fileset( fileset, "#{request.base_url}/api/v1" ) )
    else
      render_fileset_response( :not_found )
    end
  end

  #
  # add a new file(set)
  #
  def add_fileset
    work = get_the_work
    if work.nil?
      render_standard_response( :not_found )
    else
      render_standard_response( :bad_request, 'Not implemented' )
    end
  end

  #
  # remove the specified fileset
  #
  def remove_fileset

    fileset = get_the_fileset
    if fileset.nil? == false
      works = fileset.in_works
      work_id = works.empty? ? 'unknown' : works[0].id
      work_identifier = works.empty? ? 'unknown' : works[0].identifier

      # audit the information
      audit_log( "File #{fileset.title[0]} for work id #{work_id} (#{work_identifier}) deleted by #{User.cid_from_email( @api_user.email)}" )

      file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, @api_user )
      file_actor.destroy
      render_standard_response( :ok )
    else
      render_standard_response( :not_found, 'Fileset not available' )
    end

  end

  private

  def render_fileset_response( status, fileset = nil )
    render json: API::FilesetResponse.new( status, fileset ), :status => status
  end

end


{'fraction_non_alphanumeric': 0.09404490725675235, 'fraction_numerical': 0.0026033192320208264, 'mean_word_length': 2.721549636803874, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4936542', 'n_tokens_mistral': 1003, 'n_tokens_neox': 985, 'n_words': 222}