feat: add teams end point

This commit is contained in:
Muhsin Keloth
2024-05-02 16:11:21 +05:30
parent ead7cc0c36
commit 68cb6b19b0
3 changed files with 48 additions and 16 deletions
+15 -5
View File
@@ -1,17 +1,27 @@
class Integrations::Linear::ProcessorService
pattr_initialize [:account!, :conversation!]
def create_issue; end
def teams
response = linear_client.teams
return response if response[:error]
def link_issue; end
response['teams']['nodes'].map(&:as_json)
end
def list_issues
issues = linear_client.list_issues
issues.map(&:as_json)
# get labels for a team
def labels(team_id)
response = linear_client.labels(team_id)
return response if response[:error]
response['team']['labels']['nodes'].map(&:as_json)
end
private
def conversation_link
"#{ENV.fetch('FRONTEND_URL', nil)}/app/accounts/#{account.id}/conversations/#{conversation.display_id}"
end
def linear_hook
@linear_hook ||= account.hooks.find_by!(app_id: 'linear')
end