2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
module Lfs
|
|
|
|
class LocksFinderService < BaseService
|
|
|
|
def execute
|
|
|
|
success(locks: find_locks)
|
2021-06-08 01:23:25 +05:30
|
|
|
rescue StandardError => ex
|
2018-03-17 18:26:18 +05:30
|
|
|
error(ex.message, 500)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2018-03-17 18:26:18 +05:30
|
|
|
def find_locks
|
2019-03-02 22:35:43 +05:30
|
|
|
options = params.slice(:id, :path).to_h.compact.symbolize_keys
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
project.lfs_file_locks.where(options)
|
|
|
|
end
|
2018-12-05 23:21:45 +05:30
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|