src/sync.py
def sync_asana_projects(milestone_name: str):
    """Create Asana projects from Linear projects"""
    asana_client = AsanaClient(current_app.config["ASANA_WORKSPACE_ID"])
    asana_master_portfolio_gid = current_app.config["ASANA_MASTER_PORTFOLIO"]  # contains all quarterly portfolios
    asana_milestone_portfolio_gid = current_app.config["LINEAR_MILESTONE_ASANA_PORTFOLIO"][milestone_name]

    linear_client = LinearClient()

    # Get template portfolio and duplicate it
    asana_template_portfolio = asana_client.client.portfolios.get_portfolio(
        current_app.config["ASANA_PORTFOLIO_TEMPLATE_ID"]
    )
    asana_tribes_templates = list(
        asana_client.client.portfolios.get_items_for_portfolio(
            asana_template_portfolio["gid"], opt_fields=["name", "owner", "members"]
        )
    )
    asana_tribes_portfolios = asana_client.create_tribes_portfolios(
        asana_milestone_portfolio_gid, asana_tribes_templates
    )
    linear_projects = get_linear_projects(linear_client, milestone_name)
    handle_tribes_portfolios(asana_client, asana_tribes_portfolios, linear_projects)
Create Asana projects from Linear projects
Create Asana projects from Linear projects
Create Asana projects from Linear projects
def sync_asana_projects(milestone_name: str):
    asana_client = AsanaClient(current_app.config["ASANA_WORKSPACE_ID"])
    asana_master_portfolio_gid = current_app.config["ASANA_MASTER_PORTFOLIO"]  
    asana_milestone_portfolio_gid = current_app.config["LINEAR_MILESTONE_ASANA_PORTFOLIO"][milestone_name]
    linear_client = LinearClient()
    asana_template_portfolio = asana_client.client.portfolios.get_portfolio(
        current_app.config["ASANA_PORTFOLIO_TEMPLATE_ID"]
    )
    asana_tribes_templates = list(
        asana_client.client.portfolios.get_items_for_portfolio(
            asana_template_portfolio["gid"], opt_fields=["name", "owner", "members"]
        )
    )
    asana_tribes_portfolios = asana_client.create_tribes_portfolios(
        asana_milestone_portfolio_gid, asana_tribes_templates
    )
    linear_projects = get_linear_projects(linear_client, milestone_name)
    handle_tribes_portfolios(asana_client, asana_tribes_portfolios, linear_projects)
def sync_asana_projects ( milestone_name : str ) : asana_client = AsanaClient ( current_app . config [ "ASANA_WORKSPACE_ID" ] ) asana_master_portfolio_gid = current_app . config [ "ASANA_MASTER_PORTFOLIO" ] asana_milestone_portfolio_gid = current_app . config [ "LINEAR_MILESTONE_ASANA_PORTFOLIO" ] [ milestone_name ] linear_client = LinearClient ( ) asana_template_portfolio = asana_client . client . portfolios . get_portfolio ( current_app . config [ "ASANA_PORTFOLIO_TEMPLATE_ID" ] ) asana_tribes_templates = list ( asana_client . client . portfolios . get_items_for_portfolio ( asana_template_portfolio [ "gid" ] , opt_fields = [ "name" , "owner" , "members" ] ) ) asana_tribes_portfolios = asana_client . create_tribes_portfolios ( asana_milestone_portfolio_gid , asana_tribes_templates ) linear_projects = get_linear_projects ( linear_client , milestone_name ) handle_tribes_portfolios ( asana_client , asana_tribes_portfolios , linear_projects )
Create Asana projects from Linear projects
Create Asana projects from Linear projects
"""Create Asana projects from Linear projects""" # contains all quarterly portfolios # Get template portfolio and duplicate it
milestone_name
str