2018-07-17 12:50:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-02-07 08:00:53 -05:00
|
|
|
module Lfs
|
|
|
|
class LocksFinderService < BaseService
|
|
|
|
def execute
|
|
|
|
success(locks: find_locks)
|
2021-04-26 08:09:44 -04:00
|
|
|
rescue StandardError => ex
|
2018-02-07 08:00:53 -05:00
|
|
|
error(ex.message, 500)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2018-02-07 08:00:53 -05:00
|
|
|
def find_locks
|
2019-01-02 15:06:55 -05:00
|
|
|
options = params.slice(:id, :path).to_h.compact.symbolize_keys
|
2018-02-07 08:00:53 -05:00
|
|
|
|
|
|
|
project.lfs_file_locks.where(options)
|
|
|
|
end
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2018-02-07 08:00:53 -05:00
|
|
|
end
|
|
|
|
end
|