58 lines
2 KiB
Python
58 lines
2 KiB
Python
# Configure logger
|
|
import logging
|
|
from fastapi import APIRouter
|
|
|
|
from modules.connectors.connectorTicketJira import ConnectorTicketJira
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
router = APIRouter(
|
|
prefix="/api/users",
|
|
tags=["Manage Users"],
|
|
)
|
|
|
|
|
|
@router.post("/sync/delta-group")
|
|
async def sync_jira():
|
|
logger.info("Syncing Jira issues...")
|
|
# Implement synchronization logic here
|
|
|
|
jira_username = None
|
|
jira_api_token = None
|
|
sharepoint_client_id = None
|
|
sharepoint_client_secret = None
|
|
jira_url = "https://deltasecurity.atlassian.net"
|
|
project_code = "DCS"
|
|
issue_type = "Task"
|
|
task_sync_definition = {
|
|
# key=excel-header, [get:jira>excel | put: excel>jira, jira-xml-field-list]
|
|
"ID": ["get", ["key"]],
|
|
"Module Category": ["get", ["fields", "customfield_10058", "value"]],
|
|
"Summary": ["get", ["fields", "summary"]],
|
|
"Description": ["get", ["fields", "description"]],
|
|
"References": ["get", ["fields", "customfield_10066"]],
|
|
"Priority": ["get", ["fields", "priority", "name"]],
|
|
"Issue Status": ["get", ["fields", "customfield_10062"]],
|
|
"Assignee": ["get", ["fields", "assignee", "displayName"]],
|
|
"Issue Created": ["get", ["fields", "created"]],
|
|
"Due Date": ["get", ["fields", "duedate"]],
|
|
"DELTA Comments": ["get", ["fields", "customfield_10060"]],
|
|
"SELISE Ticket References": ["put", ["fields", "customfield_10067"]],
|
|
"SELISE Status Values": ["put", ["fields", "customfield_10065"]],
|
|
"SELISE Comments": ["put", ["fields", "customfield_10064"]],
|
|
}
|
|
|
|
# Create the jira connector instance
|
|
jira_connector = ConnectorTicketJira(
|
|
jira_username=jira_username,
|
|
jira_api_token=jira_api_token,
|
|
jira_url=jira_url,
|
|
project_code=project_code,
|
|
issue_type=issue_type,
|
|
)
|
|
|
|
# Read the JIRA tickets
|
|
jira_attributes = await jira_connector.read_tasks(limit=0)
|
|
|
|
return {"message": "Jira issues synchronized successfully"}
|