Skip to content
Prev Previous commit
Next Next commit
Removing 'Satate' from the project. Minors upgrades.
  • Loading branch information
DiegoGalante committed Sep 26, 2021
commit a2941318e04786006189245e0a75ca1035b16e3b
6 changes: 4 additions & 2 deletions AzureDevopsTracker/Adapters/WorkItemAdapter.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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()
};
}

Expand Down
12 changes: 6 additions & 6 deletions AzureDevopsTracker/Configurations/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<AzureDevopsStateTrackerContext>(options =>
services.AddDbContext<AzureDevopsTrackerContext>(options =>
options.UseSqlServer(DataBaseConfig.ConnectionsString));

services.AddScoped<AzureDevopsStateTrackerContext>();
services.AddScoped<AzureDevopsTrackerContext>();
services.AddScoped<IWorkItemAdapter, WorkItemAdapter>();
services.AddScoped<IWorkItemRepository, WorkItemRepository>();
services.AddScoped<IAzureDevopsStateTrackerService, AzureDevopsStateTrackerService>();
services.AddScoped<IAzureDevopsTrackerService, AzureDevopsTrackerService>();

return services;
}

public static IApplicationBuilder UseAzureDevopsStateTracker(this IApplicationBuilder app, IServiceProvider serviceProvider)
public static IApplicationBuilder UseAzureDevopsTracker(this IApplicationBuilder app, IServiceProvider serviceProvider)
{
var context = serviceProvider.GetService<AzureDevopsStateTrackerContext>();
var context = serviceProvider.GetService<AzureDevopsTrackerContext>();
context.Database.Migrate();

return app;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<WorkItem> WorkItems { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions AzureDevopsTracker/Data/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ namespace AzureDevopsTracker.Data
{
internal abstract class Repository<TEntity> : IRepository<TEntity> where TEntity : Entity
{
protected readonly AzureDevopsStateTrackerContext Db;
protected readonly AzureDevopsTrackerContext Db;
protected readonly DbSet<TEntity> DbSet;

public Repository(AzureDevopsStateTrackerContext db)
public Repository(AzureDevopsTrackerContext db)
{
Db = db;
DbSet = db.Set<TEntity>();
Expand Down
2 changes: 1 addition & 1 deletion AzureDevopsTracker/Data/WorkItemRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace AzureDevopsTracker.Data
{
internal class WorkItemRepository : Repository<WorkItem>, IWorkItemRepository
{
public WorkItemRepository(AzureDevopsStateTrackerContext context) : base(context) { }
public WorkItemRepository(AzureDevopsTrackerContext context) : base(context) { }

public async Task<WorkItem> GetByWorkItemId(string workItemId)
{
Expand Down
2 changes: 1 addition & 1 deletion AzureDevopsTracker/Extensions/HelperExtenions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace AzureDevopsTracker.Interfaces
{
public interface IAzureDevopsStateTrackerService
public interface IAzureDevopsTrackerService
{
Task Create(CreateWorkItemDTO createDto, bool addWorkItemChange = true);
Task Update(UpdatedWorkItemDTO updateDto);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace AzureDevopsTracker.Migrations
{
[DbContext(typeof(AzureDevopsStateTrackerContext))]
[DbContext(typeof(AzureDevopsTrackerContext))]
partial class AzureDevopsStateTrackerContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

namespace AzureDevopsTracker.Services
{
public class AzureDevopsStateTrackerService : IAzureDevopsStateTrackerService
public class AzureDevopsTrackerService : IAzureDevopsTrackerService
{
public readonly IWorkItemRepository _workItemRepository;
internal readonly IWorkItemRepository _workItemRepository;
public readonly IWorkItemAdapter _workItemAdapter;

public AzureDevopsStateTrackerService(
public AzureDevopsTrackerService(
IWorkItemAdapter workItemAdapter, IWorkItemRepository workItemRepository)
{
_workItemAdapter = workItemAdapter;
Expand Down Expand Up @@ -103,7 +103,10 @@ public async Task<WorkItemDTO> 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);
}
Expand Down