v3: implement user and org sync queries
This commit is contained in:
parent
841aaef368
commit
600aeabad9
|
@ -7,7 +7,9 @@ module Travis::API::V3
|
|||
raise WrongParams, 'missing organization.id'.freeze
|
||||
end
|
||||
|
||||
def sync
|
||||
def sync(org = find)
|
||||
user_query = Queries::User.new(params, main_type)
|
||||
org.users.each { |user| user_query.sync(user) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,11 @@ module Travis::API::V3
|
|||
raise WrongParams, 'missing user.id'.freeze
|
||||
end
|
||||
|
||||
def sync(user = find)
|
||||
def sync(user = find, force: false)
|
||||
return false if user.syncing? and not force
|
||||
perform_async(:sync_user, user)
|
||||
user.update_column(:is_syncing, true)
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
module Travis::API::V3
|
||||
class Services::Organization::Sync < Service
|
||||
def run!
|
||||
query.sync if access_control.writable? find
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user