Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
schefbi committed May 24, 2024
1 parent d6ac3a2 commit 450e690
Show file tree
Hide file tree
Showing 9 changed files with 903 additions and 0 deletions.
25 changes: 25 additions & 0 deletions JiraSync/JiraSync.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.33403.129
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiraSync", "JiraSync\JiraSync.csproj", "{4A348174-A464-4C09-AA62-C30ECA557224}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4A348174-A464-4C09-AA62-C30ECA557224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A348174-A464-4C09-AA62-C30ECA557224}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A348174-A464-4C09-AA62-C30ECA557224}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A348174-A464-4C09-AA62-C30ECA557224}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {534A2F90-579F-430E-8E51-D8208CE98A41}
EndGlobalSection
EndGlobal
159 changes: 159 additions & 0 deletions JiraSync/JiraSync/App.config.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
"jiraServices": [
{
"jiraUrlSearch": "https://jira/rest/api/latest/search",
"personalAccessToken": "MyJiraToken",
"searchPostBody": {
"jql": "project = EVO AND issuetype != 11 AND reporter = currentUser() AND (status != Closed OR updated >= -30d )",
"maxResults": 200,
"fields": [ "issuetype", "components", "description", "fixVersions", "resolution", "summary", "lastViewed", "priority", "versions", "updated", "status" ]
},
"targetGeminProject": "EVT",
"geminiCustomFieldJiraKey": "FremdId",
"defaultComponent": "SLH",
"mapping": [
{
"property": "issuetype",
"source": "Bug",
"target": "Bug"
},
{
"property": "issuetype",
"source": "Change Request",
"target": "Change Request"
},
{
"property": "priority",
"source": "Blocker",
"target": "Hoch"
},
{
"property": "priority",
"source": "Critical",
"target": "Mittel"
},
{
"property": "priority",
"source": "Major",
"target": "Tief"
},
{
"property": "priority",
"source": "Minor",
"target": "Tief"
},
{
"property": "priority",
"source": "Trivial",
"target": "Tief"
},
{
"property": "resolution",
"source": "Ausgeliefert",
"target": "Komplett"
},
{
"property": "resolution",
"source": "Beantwortet",
"target": "Komplett"
},
{
"property": "resolution",
"source": "Duplikat",
"target": "Duplikat"
},
{
"property": "status",
"source": "In Bearbeitung",
"target": "In Abklärung"
},
{
"property": "status",
"source": "zurückstellen",
"target": "In Abklärung"
},
{
"property": "status",
"source": "Angenommen",
"target": "Angenommen"
},
{
"property": "status",
"source": "Eingeplant",
"target": "Eingeplant"
},
{
"property": "status",
"source": "Geschlossen",
"target": "Testen"
},
{
"property": "status",
"source": "Behoben",
"target": "Testen"
},
{
"property": "components",
"source": "Lehrgang",
"target": "Lehrgang"
},
{
"property": "components",
"source": "NewGeneration",
"target": "NG"
},
{
"property": "components",
"source": "OAuth",
"target": "OAuth"
},
{
"property": "components",
"source": "Reportmanager",
"target": "NG"
},
{
"property": "components",
"source": "Reports",
"target": "Report"
},
{
"property": "components",
"source": "RestAPI",
"target": "REST API"
},
{
"property": "components",
"source": "SDK",
"target": "SDK"
},
{
"property": "components",
"source": "Web",
"target": "Web"
},
{
"property": "components",
"source": "Web-Module",
"target": "JSModules"
},
{
"property": "components",
"source": "Office",
"target": "Office"
},
{
"property": "components",
"source": "Kundenspezifische Schnittstelle",
"target": "FBI"
},
{
"property": "components",
"source": "Admin",
"target": "Admin"
}

]
}
]
}
46 changes: 46 additions & 0 deletions JiraSync/JiraSync/AppConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System.Collections.Generic;

namespace JiraSync.Configuration
{
public class AppConfig
{
public List<JiraService> JiraServices { get; set; }
}

public class JiraService
{
public string JiraUrlSearch { get; set; }
public string PersonalAccessToken { get; set; }
public SearchPostBody SearchPostBody { get; set; }
public string TargetGeminProject { get; set; }
public int TargetGeminProjectId { get; set; }
public string GeminiCustomFieldJiraKey { get; set; }
public int GeminiCustomFieldJiraKeyId { get; set; }
public string DefaultComponent { get; set; }
public int DefaultComponentId { get; set; }
public List<Mapping> Mapping { get; set; }
}

public class Mapping
{
public string Property { get; set; }
public string Source { get; set; }
public string Target { get; set; }
public int TargetId { get; set; }
}



/// <summary>
/// Naming rule violation: These words must begin with upper case characters: jql JiraSync.
/// Its important begin with lower characters because on post body you will receive a 400 Bad Request.
/// </summary>
public class SearchPostBody
{
public string jql { get; set; }
public int maxResults { get; set; }
public List<string> fields { get; set; }
}


}
122 changes: 122 additions & 0 deletions JiraSync/JiraSync/JiraResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JiraSync
{
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);

public class JiraResponse
{
public string Expand { get; set; }
public int StartAt { get; set; }
public int MaxResults { get; set; }
public int Total { get; set; }
public List<Issue> Issues { get; set; }
}

public class Component
{
public string Self { get; set; }
public string Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
}

public class Fields
{
public string Summary { get; set; }
public Issuetype Issuetype { get; set; }
public DateTime? LastViewed { get; set; }
public List<Component> Components { get; set; }
public List<Version> Versions { get; set; }
public string Description { get; set; }
public List<FixVersion> FixVersions { get; set; }
public Priority Priority { get; set; }
public Resolution Resolution { get; set; }
public DateTime Updated { get; set; }
public Status Status { get; set; }
}

public class FixVersion
{
public string Self { get; set; }
public string Id { get; set; }
public string Description { get; set; }
public string Name { get; set; }
public bool Archived { get; set; }
public bool Released { get; set; }
public DateTime ReleaseDate { get; set; }
}

public class Issue
{
public string Expand { get; set; }
public string Id { get; set; }
public string Self { get; set; }
public string Key { get; set; }
public Fields Fields { get; set; }
}

public class Issuetype
{
public string Self { get; set; }
public string Id { get; set; }
public string Description { get; set; }
public string IconUrl { get; set; }
public string Name { get; set; }
public bool Subtask { get; set; }
public int AvatarId { get; set; }
}

public class Priority
{
public string Self { get; set; }
public string IconUrl { get; set; }
public string Name { get; set; }
public string Id { get; set; }
}

public class Resolution
{
public string Self { get; set; }
public string Id { get; set; }
public string Description { get; set; }
public string Name { get; set; }
}


public class Status
{
public string Self { get; set; }
public string Description { get; set; }
public string IconUrl { get; set; }
public string Name { get; set; }
public string Id { get; set; }
public StatusCategory StatusCategory { get; set; }
}

public class StatusCategory
{
public string Self { get; set; }
public int Id { get; set; }
public string Key { get; set; }
public string ColorName { get; set; }
public string Name { get; set; }
}

public class Version
{
public string Self { get; set; }
public string Id { get; set; }
public string Description { get; set; }
public string Name { get; set; }
public bool Archived { get; set; }
public bool Released { get; set; }
public string ReleaseDate { get; set; }
}


}
Loading

0 comments on commit 450e690

Please sign in to comment.