diff --git a/AzureDevopsTracker/Adapters/WorkItemAdapter.cs b/AzureDevopsTracker/Adapters/WorkItemAdapter.cs index ea434f9..6ea1a4b 100644 --- a/AzureDevopsTracker/Adapters/WorkItemAdapter.cs +++ b/AzureDevopsTracker/Adapters/WorkItemAdapter.cs @@ -1,6 +1,8 @@ using AzureDevopsTracker.DTOs; using AzureDevopsTracker.Entities; +using AzureDevopsTracker.Extensions; using AzureDevopsTracker.Interfaces; +using System; using System.Collections.Generic; using System.Linq; @@ -86,8 +88,8 @@ public TimeByStateDTO ToTimeByStateDTO(TimeByState workItemStatusTime) { CreatedAt = workItemStatusTime.CreatedAt, State = workItemStatusTime.State, - //TotalTime = workItemStatusTime.TotalTimeText, - //TotalWorkedTime = workItemStatusTime.TotalWorkedTimeText + TotalTime = TimeSpan.FromSeconds(workItemStatusTime.TotalTime).ToTextTime(), + TotalWorkedTime = TimeSpan.FromSeconds(workItemStatusTime.TotalWorkedTime).ToTextTime() }; } diff --git a/AzureDevopsTracker/AzureDevopsTracker.csproj b/AzureDevopsTracker/AzureDevopsTracker.csproj index c6046b2..84bf675 100644 --- a/AzureDevopsTracker/AzureDevopsTracker.csproj +++ b/AzureDevopsTracker/AzureDevopsTracker.csproj @@ -8,22 +8,30 @@ TypingHard Azure DevOps Tracker - https://github.com/typinghard/azure-devops-state-tracker - https://github.com/typinghard/azure-devops-state-tracker + https://github.com/typinghard/azure-devops-tracker + https://github.com/typinghard/azure-devops-tracker adst_icon.png GitHub Azure DevOps Tracker Columns State Tracking Track Board Scrum Kanbam Time Column Timing Workitem Worked Hours Team Performance en LICENSE.md.txt + A NuGet that allows you to use a Azure DevOps Service Hook to track workitems changes in a simply and detailed way. + 1.0.0.0 + 1.0.0.0 + 1.0.1 - + + + True + + True diff --git a/AzureDevopsTracker/Configurations/Configuration.cs b/AzureDevopsTracker/Configurations/Configuration.cs index db034d2..2fc0d46 100644 --- a/AzureDevopsTracker/Configurations/Configuration.cs +++ b/AzureDevopsTracker/Configurations/Configuration.cs @@ -13,22 +13,22 @@ namespace AzureDevopsTracker.Configurations { public static class Configuration { - public static IServiceCollection AddAzureDevopsStateTracker(this IServiceCollection services, DataBaseConfig configurations) + public static IServiceCollection AddAzureDevopsTracker(this IServiceCollection services, DataBaseConfig configurations) { - services.AddDbContext(options => + services.AddDbContext(options => options.UseSqlServer(DataBaseConfig.ConnectionsString)); - services.AddScoped(); + services.AddScoped(); services.AddScoped(); services.AddScoped(); - services.AddScoped(); + services.AddScoped(); return services; } - public static IApplicationBuilder UseAzureDevopsStateTracker(this IApplicationBuilder app, IServiceProvider serviceProvider) + public static IApplicationBuilder UseAzureDevopsTracker(this IApplicationBuilder app, IServiceProvider serviceProvider) { - var context = serviceProvider.GetService(); + var context = serviceProvider.GetService(); context.Database.Migrate(); return app; diff --git a/AzureDevopsTracker/Data/Context/AzureDevopsStateTrackerContext.cs b/AzureDevopsTracker/Data/Context/AzureDevopsTrackerContext.cs similarity index 85% rename from AzureDevopsTracker/Data/Context/AzureDevopsStateTrackerContext.cs rename to AzureDevopsTracker/Data/Context/AzureDevopsTrackerContext.cs index 8d8d815..e6f534d 100644 --- a/AzureDevopsTracker/Data/Context/AzureDevopsStateTrackerContext.cs +++ b/AzureDevopsTracker/Data/Context/AzureDevopsTrackerContext.cs @@ -5,9 +5,9 @@ namespace AzureDevopsTracker.Data.Context { - public class AzureDevopsStateTrackerContext : DbContext, IDisposable + public class AzureDevopsTrackerContext : DbContext, IDisposable { - public AzureDevopsStateTrackerContext(DbContextOptions options) : base(options) + public AzureDevopsTrackerContext(DbContextOptions options) : base(options) { } public DbSet WorkItems { get; set; } diff --git a/AzureDevopsTracker/Data/Repository.cs b/AzureDevopsTracker/Data/Repository.cs index 29c7110..3bf46b4 100644 --- a/AzureDevopsTracker/Data/Repository.cs +++ b/AzureDevopsTracker/Data/Repository.cs @@ -10,10 +10,10 @@ namespace AzureDevopsTracker.Data { internal abstract class Repository : IRepository where TEntity : Entity { - protected readonly AzureDevopsStateTrackerContext Db; + protected readonly AzureDevopsTrackerContext Db; protected readonly DbSet DbSet; - public Repository(AzureDevopsStateTrackerContext db) + public Repository(AzureDevopsTrackerContext db) { Db = db; DbSet = db.Set(); diff --git a/AzureDevopsTracker/Data/WorkItemRepository.cs b/AzureDevopsTracker/Data/WorkItemRepository.cs index a1656ec..864f5b7 100644 --- a/AzureDevopsTracker/Data/WorkItemRepository.cs +++ b/AzureDevopsTracker/Data/WorkItemRepository.cs @@ -10,7 +10,7 @@ namespace AzureDevopsTracker.Data { internal class WorkItemRepository : Repository, IWorkItemRepository { - public WorkItemRepository(AzureDevopsStateTrackerContext context) : base(context) { } + public WorkItemRepository(AzureDevopsTrackerContext context) : base(context) { } public async Task GetByWorkItemId(string workItemId) { diff --git a/AzureDevopsTracker/Extensions/HelperExtenions.cs b/AzureDevopsTracker/Extensions/HelperExtenions.cs index 5b52794..372e2dd 100644 --- a/AzureDevopsTracker/Extensions/HelperExtenions.cs +++ b/AzureDevopsTracker/Extensions/HelperExtenions.cs @@ -25,7 +25,7 @@ public static string ExtractEmail(this string user) public static string ToTextTime(this TimeSpan timeSpan) { if (timeSpan.Days > 0) - return $@"{timeSpan:%d} Dia(s) {timeSpan:%h} h e {timeSpan:%m} min e {timeSpan:%s} s"; + return $@"{timeSpan:%d} Day(s) {timeSpan:%h} h e {timeSpan:%m} min e {timeSpan:%s} s"; if (timeSpan.Hours > 0) return $@"{timeSpan:%h} h e {timeSpan:%m} min e {timeSpan:%s} s"; diff --git a/AzureDevopsTracker/Interfaces/IAzureDevopsStateTrackerService.cs b/AzureDevopsTracker/Interfaces/IAzureDevopsTrackerService.cs similarity index 88% rename from AzureDevopsTracker/Interfaces/IAzureDevopsStateTrackerService.cs rename to AzureDevopsTracker/Interfaces/IAzureDevopsTrackerService.cs index de606f7..0d2e1fa 100644 --- a/AzureDevopsTracker/Interfaces/IAzureDevopsStateTrackerService.cs +++ b/AzureDevopsTracker/Interfaces/IAzureDevopsTrackerService.cs @@ -5,7 +5,7 @@ namespace AzureDevopsTracker.Interfaces { - public interface IAzureDevopsStateTrackerService + public interface IAzureDevopsTrackerService { Task Create(CreateWorkItemDTO createDto, bool addWorkItemChange = true); Task Update(UpdatedWorkItemDTO updateDto); diff --git a/AzureDevopsTracker/Migrations/20210719163846_AzureDevopsStateTrackerInitial.Designer.cs b/AzureDevopsTracker/Migrations/20210719163846_AzureDevopsStateTrackerInitial.Designer.cs index 7398a89..859edc1 100644 --- a/AzureDevopsTracker/Migrations/20210719163846_AzureDevopsStateTrackerInitial.Designer.cs +++ b/AzureDevopsTracker/Migrations/20210719163846_AzureDevopsStateTrackerInitial.Designer.cs @@ -10,7 +10,7 @@ namespace AzureDevopsTracker.Migrations { - [DbContext(typeof(AzureDevopsStateTrackerContext))] + [DbContext(typeof(AzureDevopsTrackerContext))] [Migration("20210719163846_AzureDevopsStateTrackerInitial")] partial class AzureDevopsStateTrackerInitial { diff --git a/AzureDevopsTracker/Migrations/20210720105645_FunctionToTimeInitial.Designer.cs b/AzureDevopsTracker/Migrations/20210720105645_FunctionToTimeInitial.Designer.cs index 77f0596..7e06153 100644 --- a/AzureDevopsTracker/Migrations/20210720105645_FunctionToTimeInitial.Designer.cs +++ b/AzureDevopsTracker/Migrations/20210720105645_FunctionToTimeInitial.Designer.cs @@ -10,7 +10,7 @@ namespace AzureDevopsTracker.Migrations { - [DbContext(typeof(AzureDevopsStateTrackerContext))] + [DbContext(typeof(AzureDevopsTrackerContext))] [Migration("20210720105645_FunctionToTimeInitial")] partial class FunctionToTimeInitial { diff --git a/AzureDevopsTracker/Migrations/20210831213210_UpdatingColumns.Designer.cs b/AzureDevopsTracker/Migrations/20210831213210_UpdatingColumns.Designer.cs index b76a53a..686f2eb 100644 --- a/AzureDevopsTracker/Migrations/20210831213210_UpdatingColumns.Designer.cs +++ b/AzureDevopsTracker/Migrations/20210831213210_UpdatingColumns.Designer.cs @@ -10,7 +10,7 @@ namespace AzureDevopsTracker.Migrations { - [DbContext(typeof(AzureDevopsStateTrackerContext))] + [DbContext(typeof(AzureDevopsTrackerContext))] [Migration("20210831213210_UpdatingColumns")] partial class UpdatingColumns { diff --git a/AzureDevopsTracker/Migrations/20210831213948_UpdatingCustomColumn.Designer.cs b/AzureDevopsTracker/Migrations/20210831213948_UpdatingCustomColumn.Designer.cs index ed2e4e3..c439c30 100644 --- a/AzureDevopsTracker/Migrations/20210831213948_UpdatingCustomColumn.Designer.cs +++ b/AzureDevopsTracker/Migrations/20210831213948_UpdatingCustomColumn.Designer.cs @@ -10,7 +10,7 @@ namespace AzureDevopsTracker.Migrations { - [DbContext(typeof(AzureDevopsStateTrackerContext))] + [DbContext(typeof(AzureDevopsTrackerContext))] [Migration("20210831213948_UpdatingCustomColumn")] partial class UpdatingCustomColumn { diff --git a/AzureDevopsTracker/Migrations/AzureDevopsStateTrackerContextModelSnapshot.cs b/AzureDevopsTracker/Migrations/AzureDevopsStateTrackerContextModelSnapshot.cs index f7e3969..c33ffdb 100644 --- a/AzureDevopsTracker/Migrations/AzureDevopsStateTrackerContextModelSnapshot.cs +++ b/AzureDevopsTracker/Migrations/AzureDevopsStateTrackerContextModelSnapshot.cs @@ -9,7 +9,7 @@ namespace AzureDevopsTracker.Migrations { - [DbContext(typeof(AzureDevopsStateTrackerContext))] + [DbContext(typeof(AzureDevopsTrackerContext))] partial class AzureDevopsStateTrackerContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) diff --git a/AzureDevopsTracker/Services/AzureDevopsStateTrackerService.cs b/AzureDevopsTracker/Services/AzureDevopsTrackerService.cs similarity index 94% rename from AzureDevopsTracker/Services/AzureDevopsStateTrackerService.cs rename to AzureDevopsTracker/Services/AzureDevopsTrackerService.cs index 053f7d5..676ff54 100644 --- a/AzureDevopsTracker/Services/AzureDevopsStateTrackerService.cs +++ b/AzureDevopsTracker/Services/AzureDevopsTrackerService.cs @@ -11,12 +11,12 @@ namespace AzureDevopsTracker.Services { - public class AzureDevopsStateTrackerService : IAzureDevopsStateTrackerService + public class AzureDevopsTrackerService : IAzureDevopsTrackerService { public readonly IWorkItemRepository _workItemRepository; public readonly IWorkItemAdapter _workItemAdapter; - public AzureDevopsStateTrackerService( + public AzureDevopsTrackerService( IWorkItemAdapter workItemAdapter, IWorkItemRepository workItemRepository) { _workItemAdapter = workItemAdapter; @@ -103,7 +103,10 @@ public async Task GetByWorkItemId(string workItemId) } #region Support Methods - public WorkItemChange ToWorkItemChange(string workItemId, string changedBy, string iterationPath, DateTime newDate, string newState, string oldState = null, DateTime? oldDate = null) + public WorkItemChange ToWorkItemChange( + string workItemId, string changedBy, + string iterationPath, DateTime newDate, string newState, + string oldState = null, DateTime? oldDate = null) { return new WorkItemChange(workItemId, changedBy.ExtractEmail(), iterationPath, newDate, newState, oldState, oldDate); }