solved new api for jira and fixes ui
This commit is contained in:
parent
4cf60b4230
commit
a3fe8abef4
2 changed files with 7 additions and 6 deletions
|
|
@ -52,7 +52,7 @@ class ConnectorTicketJira(TicketBase):
|
||||||
jql_query = f"project={self.project_code} AND issuetype={self.issue_type}"
|
jql_query = f"project={self.project_code} AND issuetype={self.issue_type}"
|
||||||
|
|
||||||
# Prepare the request URL and parameters
|
# Prepare the request URL and parameters
|
||||||
url = f"{self.jira_url}/rest/api/2/search"
|
url = f"{self.jira_url}/rest/api/3/search/jql"
|
||||||
params = {"jql": jql_query, "maxResults": 1, "expand": "names"}
|
params = {"jql": jql_query, "maxResults": 1, "expand": "names"}
|
||||||
|
|
||||||
# Prepare authentication
|
# Prepare authentication
|
||||||
|
|
@ -126,7 +126,7 @@ class ConnectorTicketJira(TicketBase):
|
||||||
|
|
||||||
# Prepare authentication
|
# Prepare authentication
|
||||||
auth = aiohttp.BasicAuth(self.jira_username, self.jira_api_token)
|
auth = aiohttp.BasicAuth(self.jira_username, self.jira_api_token)
|
||||||
url = f"{self.jira_url}/rest/api/2/search"
|
url = f"{self.jira_url}/rest/api/3/search/jql"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
|
|
@ -216,7 +216,7 @@ class ConnectorTicketJira(TicketBase):
|
||||||
update_data = {"fields": fields}
|
update_data = {"fields": fields}
|
||||||
|
|
||||||
# Make the update request
|
# Make the update request
|
||||||
url = f"{self.jira_url}/rest/api/2/issue/{task_id}"
|
url = f"{self.jira_url}/rest/api/3/issue/{task_id}"
|
||||||
|
|
||||||
async with session.put(
|
async with session.put(
|
||||||
url, json=update_data, headers=headers, auth=auth
|
url, json=update_data, headers=headers, auth=auth
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,9 @@ async def login(
|
||||||
async def auth_callback(code: str, state: str, request: Request) -> HTMLResponse:
|
async def auth_callback(code: str, state: str, request: Request) -> HTMLResponse:
|
||||||
"""Handle Google OAuth callback"""
|
"""Handle Google OAuth callback"""
|
||||||
try:
|
try:
|
||||||
|
# Import Token at function level to avoid scoping issues
|
||||||
|
from modules.interfaces.interfaceAppModel import Token
|
||||||
|
|
||||||
# Parse state
|
# Parse state
|
||||||
state_data = json.loads(state)
|
state_data = json.loads(state)
|
||||||
state_type = state_data.get("type", "login")
|
state_type = state_data.get("type", "login")
|
||||||
|
|
@ -232,7 +235,6 @@ async def auth_callback(code: str, state: str, request: Request) -> HTMLResponse
|
||||||
rootInterface = getRootInterface()
|
rootInterface = getRootInterface()
|
||||||
# Prefer connection flow reuse; fallback to user access token
|
# Prefer connection flow reuse; fallback to user access token
|
||||||
if connection_id:
|
if connection_id:
|
||||||
from modules.interfaces.interfaceAppModel import Token
|
|
||||||
existing_tokens = rootInterface.db.getRecordset(Token, recordFilter={
|
existing_tokens = rootInterface.db.getRecordset(Token, recordFilter={
|
||||||
"connectionId": connection_id,
|
"connectionId": connection_id,
|
||||||
"authority": AuthAuthority.GOOGLE
|
"authority": AuthAuthority.GOOGLE
|
||||||
|
|
@ -325,7 +327,6 @@ async def auth_callback(code: str, state: str, request: Request) -> HTMLResponse
|
||||||
jwt_token, jwt_expires_at = createAccessToken(jwt_token_data)
|
jwt_token, jwt_expires_at = createAccessToken(jwt_token_data)
|
||||||
|
|
||||||
# Create JWT token
|
# Create JWT token
|
||||||
from modules.interfaces.interfaceAppModel import Token
|
|
||||||
token = Token(
|
token = Token(
|
||||||
userId=user.id, # Use local user's ID
|
userId=user.id, # Use local user's ID
|
||||||
authority=AuthAuthority.GOOGLE,
|
authority=AuthAuthority.GOOGLE,
|
||||||
|
|
@ -444,7 +445,7 @@ async def auth_callback(code: str, state: str, request: Request) -> HTMLResponse
|
||||||
connection.externalEmail = user_info.get("email")
|
connection.externalEmail = user_info.get("email")
|
||||||
|
|
||||||
# Update connection record directly
|
# Update connection record directly
|
||||||
from modules.interfaces.interfaceAppModel import UserConnection, Token
|
from modules.interfaces.interfaceAppModel import UserConnection
|
||||||
rootInterface.db.recordModify(UserConnection, connection_id, connection.to_dict())
|
rootInterface.db.recordModify(UserConnection, connection_id, connection.to_dict())
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue